How to use the galpy.util.multi 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
effsel_4vol= self(self._dists_4vol,
                                  self._ra_cen_4vol[0],
                                  self._dec_cen_4vol[0],MJ=MJ,JK=JK)
                self._effsel_4vol= numpy.tile(effsel_4vol,
                                              (len(self._ra_cen_4vol),1))
            else: # Need to treat each los separately
                if ncpu is None:
                    self._effsel_4vol= numpy.empty((len(self._ra_cen_4vol),
                                                    len(self._dists_4vol)))
                    for ii,(ra_cen, dec_cen) \
                            in enumerate(tqdm.tqdm(zip(self._ra_cen_4vol,
                                                       self._dec_cen_4vol))):
                        self._effsel_4vol[ii]= self(self._dists_4vol,
                                                    ra_cen,dec_cen,MJ=MJ,JK=JK)
                else:
                    multiOut= multi.parallel_map(\
                        lambda x: self(self._dists_4vol,
                                       self._ra_cen_4vol[x],
                                       self._dec_cen_4vol[x],MJ=MJ,JK=JK),
                        range(len(self._ra_cen_4vol)),
                        numcores=ncpu)
                    self._effsel_4vol= numpy.array(multiOut)
            self._vol_MJ_hash= new_hash
            self._ndists_4vol= ndists
            self._linearDist_4vol= linearDist
        out= 0.
        if xyz:
            out= numpy.sum(\
                self._effsel_4vol\
                    *vol_func(self._X_4vol,self._Y_4vol,self._Z_4vol)\
                    *self._tiled_dists3_4vol)
        else: