packages/vaex-astro/vaex/astro/transformations.py
def add_virtual_columns_lbrvr_proper_motion2vcartesian(self, long_in="l", lat_in="b", distance="distance", pm_long="pm_l", pm_lat="pm_b",
                                                       vr="vr", vx="vx", vy="vy", vz="vz",
                                                       center_v=(0, 0, 0),
                                                       propagate_uncertainties=False, radians=False):
    """Convert radial velocity and galactic proper motions (and positions) to cartesian velocities wrt the center_v

    Based on http://adsabs.harvard.edu/abs/1987AJ.....93..864J


    :param long_in: Name/expression for galactic longitude
    :param lat_in: Name/expression for galactic latitude
    :param distance: Name/expression for heliocentric distance
    :param pm_long: Name/expression for the galactic proper motion in latitude direction (pm_l*, so cosine(b) term should be included)
    :param pm_lat: Name/expression for the galactic proper motion in longitude direction
    :param vr: Name/expression for the radial velocity
    :param vx: Output name for the cartesian velocity x-component
    :param vy: Output name for the cartesian velocity y-component
    :param vz: Output name for the cartesian velocity z-component
    :param center_v: Extra motion that should be added, for instance lsr + motion of the sun wrt the galactic restframe
    :param radians: input and output in radians (True), or degrees (False)
    :return:
    """
    k = 4.74057
    a, d, distance = self._expr(long_in, lat_in, distance)
    pm_long, pm_lat, vr = self._expr(pm_long, pm_lat, vr)
    if not radians:
        a = a * np.pi/180
        d = d * np.pi/180
    A = [[np.cos(a)*np.cos(d), -np.sin(a), -np.cos(a)*np.sin(d)],
         [np.sin(a)*np.cos(d),  np.cos(a), -np.sin(a)*np.sin(d)],
         [np.sin(d), d*0, np.cos(d)]]
    self.add_virtual_columns_matrix3d(vr, k * pm_long * distance, k * pm_lat * distance, vx, vy, vz, A, translation=center_v)
    if propagate_uncertainties:
        self.propagate_uncertainties([self[vx], self[vy], self[vz]])
def add_virtual_columns_lbrvr_proper_motion2vcartesian(self, long_in="l", lat_in="b", distance="distance", pm_long="pm_l", pm_lat="pm_b",
                                                       vr="vr", vx="vx", vy="vy", vz="vz",
                                                       center_v=(0, 0, 0),
                                                       propagate_uncertainties=False, radians=False):
    """Convert radial velocity and galactic proper motions (and positions) to cartesian velocities wrt the center_v

    Based on http://adsabs.harvard.edu/abs/1987AJ.....93..864J


    :param long_in: Name/expression for galactic longitude
    :param lat_in: Name/expression for galactic latitude
    :param distance: Name/expression for heliocentric distance
    :param pm_long: Name/expression for the galactic proper motion in latitude direction (pm_l*, so cosine(b) term should be included)
    :param pm_lat: Name/expression for the galactic proper motion in longitude direction
    :param vr: Name/expression for the radial velocity
    :param vx: Output name for the cartesian velocity x-component
    :param vy: Output name for the cartesian velocity y-component
    :param vz: Output name for the cartesian velocity z-component
    :param center_v: Extra motion that should be added, for instance lsr + motion of the sun wrt the galactic restframe
    :param radians: input and output in radians (True), or degrees (False)
    :return:
    """
    k = 4.74057
    a, d, distance = self._expr(long_in, lat_in, distance)
    pm_long, pm_lat, vr = self._expr(pm_long, pm_lat, vr)
    if not radians:
        a = a * np.pi/180
        d = d * np.pi/180
    A = [[np.cos(a)*np.cos(d), -np.sin(a), -np.cos(a)*np.sin(d)],
         [np.sin(a)*np.cos(d),  np.cos(a), -np.sin(a)*np.sin(d)],
         [np.sin(d), d*0, np.cos(d)]]
    self.add_virtual_columns_matrix3d(vr, k * pm_long * distance, k * pm_lat * distance, vx, vy, vz, A, translation=center_v)
    if propagate_uncertainties:
        self.propagate_uncertainties([self[vx], self[vy], self[vz]])
def add_virtual_columns_lbrvr_proper_motion2vcartesian ( self , long_in = "l" , lat_in = "b" , distance = "distance" , pm_long = "pm_l" , pm_lat = "pm_b" , vr = "vr" , vx = "vx" , vy = "vy" , vz = "vz" , center_v = ( 0 , 0 , 0 ) , propagate_uncertainties = False , radians = False ) : k = 4.74057 a , d , distance = self . _expr ( long_in , lat_in , distance ) pm_long , pm_lat , vr = self . _expr ( pm_long , pm_lat , vr ) if not radians : a = a * np . pi / 180 d = d * np . pi / 180 A = [ [ np . cos ( a ) * np . cos ( d ) , - np . sin ( a ) , - np . cos ( a ) * np . sin ( d ) ] , [ np . sin ( a ) * np . cos ( d ) , np . cos ( a ) , - np . sin ( a ) * np . sin ( d ) ] , [ np . sin ( d ) , d * 0 , np . cos ( d ) ] ] self . add_virtual_columns_matrix3d ( vr , k * pm_long * distance , k * pm_lat * distance , vx , vy , vz , A , translation = center_v ) if propagate_uncertainties : self . propagate_uncertainties ( [ self [ vx ] , self [ vy ] , self [ vz ] ] )
Convert radial velocity and galactic proper motions (and positions) to cartesian velocities wrt the center_v

    Based on http://adsabs.harvard.edu/abs/1987AJ.....93..864J


    :param long_in: Name/expression for galactic longitude
    :param lat_in: Name/expression for galactic latitude
    :param distance: Name/expression for heliocentric distance
    :param pm_long: Name/expression for the galactic proper motion in latitude direction (pm_l*, so cosine(b) term should be included)
    :param pm_lat: Name/expression for the galactic proper motion in longitude direction
    :param vr: Name/expression for the radial velocity
    :param vx: Output name for the cartesian velocity x-component
    :param vy: Output name for the cartesian velocity y-component
    :param vz: Output name for the cartesian velocity z-component
    :param center_v: Extra motion that should be added, for instance lsr + motion of the sun wrt the galactic restframe
    :param radians: input and output in radians (True), or degrees (False)
    :return:
Convert radial velocity and galactic proper motions ( and positions ) to cartesian velocities wrt the center_v