How to use the galpy.util.bovy_coords.lbd_to_XYZ function in galpy

To help you get started, we’ve selected a few galpy examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github jobovy / gaia_tools / gaia_tools / select / tgasSelect.py View on Github external
self._deltadm_4vol= dists[1]-dists[0]
            else:
                dms= numpy.linspace(0.,18.,ndists)
                self._deltadm_4vol= (dms[1]-dms[0])*numpy.log(10.)/5.
            self._dists_4vol= 10.**(0.2*dms-2.)
            self._tiled_dists3_4vol= numpy.tile(\
                self._dists_4vol**(3.-linearDist),(len(self._ra_cen_4vol),1))
            self._tiled_ra_cen_4vol= numpy.tile(self._ra_cen_4vol,
                                                 (len(self._dists_4vol),1)).T
            self._tiled_dec_cen_4vol= numpy.tile(self._dec_cen_4vol,
                                                 (len(self._dists_4vol),1)).T
            lb= bovy_coords.radec_to_lb(phi,numpy.pi/2.-theta)
            l= numpy.tile(lb[:,0],(len(self._dists_4vol),1)).T.flatten()
            b= numpy.tile(lb[:,1],(len(self._dists_4vol),1)).T.flatten()
            XYZ_4vol= \
                bovy_coords.lbd_to_XYZ(l,b,
                   numpy.tile(self._dists_4vol,
                              (len(self._ra_cen_4vol),1)).flatten())
            self._X_4vol= numpy.reshape(XYZ_4vol[:,0],(len(self._ra_cen_4vol),
                                                       len(self._dists_4vol)))
            self._Y_4vol= numpy.reshape(XYZ_4vol[:,1],(len(self._ra_cen_4vol),
                                                       len(self._dists_4vol)))
            self._Z_4vol= numpy.reshape(XYZ_4vol[:,2],(len(self._ra_cen_4vol),
                                                       len(self._dists_4vol)))
        # Cache effective-selection function
        MJ, JK= self._parse_mj_jk(MJ,JK)
        new_hash= hashlib.md5(numpy.array([MJ,JK])).hexdigest()
        if not hasattr(self,'_vol_MJ_hash') or new_hash != self._vol_MJ_hash \
             or (hasattr(self,'_ndists_4vol') and 
                 (ndists != self._ndists_4vol or 
                  linearDist != self._linearDist_4vol)):
            # Need to update the effective-selection function