synthpop.position
This file includes the Position class. It handles the generation of star positions within a given cone.
Classes
Position class for a Population class. |
Module Contents
- class synthpop.position.Position(coord_trans, **kwargs)
Position class for a Population class. This contains methods to randomly generate positions within a field/slice,
Attributes
- l_degfloat [degree]
Galactic longitude of the current field in degrees.
- l_radfloat [radian]
Galactic longitude of the current field in radians.
- b_degfloat [degree]
Galactic latitude of the current field in degrees.
- b_radfloat [radian]
Galactic latitude of the current field in radians.
- cone_anglefloat [radian]
opening angle of the cone
Methods
- __init__(l_deg: float, b_deg: float, solid_angle_sr: float)None
Initialize the Class
- update(*args, **kwargs)None
Update the class with new coordinates, passes arguments to __init__()
- draw_random_point_in_slice(dist_inner: float, dist_outer: float, N: int = 1): tuple
generate N points within the slice
- rotate_00_to_lb(delta_l: ndarray, delta_b: ndarray)Tuple[ndarray, ndarray]
rotates a cone from pointing toward 0,0 to (l,b)
- coord_trans
- l_deg = None
- l_rad = None
- b_deg = None
- b_rad = None
- cone_angle = None
- update_location(l_deg: float, b_deg: float, solid_angle: float)
Set the location and solid_angle
Parameters
- l_deg, b_degfloat [deg]
galactic longitude and latitude in degrees
- solid_anglefloat [sr]
size of the cone
- draw_random_point_in_slice(dist_inner: float, dist_outer: float, n_stars: int = 1) Tuple[numpy.ndarray, numpy.ndarray, numpy.ndarray, numpy.ndarray, numpy.ndarray, numpy.ndarray]
Draw one or more random point in a slice given coordinates (self.l, self.b) [degrees], solid angle[steradians], and distance range[kpc]
To get distance d, we draw from a cumulative quadratic distribution. To do so, we found the integrated r**2 such that our CDF is Prob(x) = (x**3 - dist_inner**3)/(dist_outer**3 - dist_inner**3) Then, we invert for x(Prob) so that we can draw Prob from Uniform(0,1) x = ((r_max**3 - r_min**3)*Prob + r_min**3)**(1/3)
Parameters
- dist_innerfloat [kpc]
lower distance
- dist_outerfloat [kpc]
upper distance
- n_starsint, None, optional
number of stars drawn if None return one position as float
Returns
- xfloat, ndarray [kpc]
Cartesian X coordinate (centered at the galactic center) of the drawn positions
- yfloat, ndarray [kpc]
Cartesian Y coordinate (centered at the galactic center) of the drawn positions
- zfloat, ndarray [kpc]
Cartesian Z coordinate (centered at the galactic center) of the drawn positions
- d_kpcfloat, ndarray [kpc]
distances of the drawn positions
- star_l_degfloat, ndarray [deg]
galactic longitude of the drawn positions
- star_b_degfloat, ndarray [deg]
galactic latitude of the drawn positions
- rotate_00_to_lb(delta_l: numpy.ndarray, delta_b: numpy.ndarray) Tuple[numpy.ndarray, numpy.ndarray]
Rotates coordinate system such that 0, 0 lands on self.l ,self.b
Parameters
- delta_lfloat, ndarray [radians]
difference in galactic longitude
- delta_bfloat, ndarray [radians]
difference in galactic longitude
Returns
- star_l_radfloat, ndarray [radians]
galactic longitude
- star_b_radfloat, ndarray [radians]
galactic latitude