jobovy / gaia_tools

Tools for working with the @ESAGaia data and related data sets
MIT License
60 stars 19 forks source link

Error when instantiating selection function object #25

Closed mitchellkarmen closed 4 years ago

mitchellkarmen commented 4 years ago

Hi,

I'm trying to use the TGAS selection function, and am using the following code to instantiate it:

tsf= gaia_tools.select.tgasSelect()

But I get the following error message:

---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
<ipython-input-4-5133f7bdd767> in <module>
----> 1 tsf= gaia_tools.select.tgasSelect()

~/anaconda3/lib/python3.7/site-packages/gaia_tools-0.2-py3.7.egg/gaia_tools/select/tgasSelect.py in __init__(self, min_nobs, max_nobs_std, max_plxerr, max_scd, min_lat, jmin, jmax, jkmin, jkmax)
    122         # related to statistics of 6 < J < 10
    123         self._setup_skyonly(min_nobs,max_nobs_std,max_plxerr,max_scd,min_lat)
--> 124         self._determine_selection(jmin,jmax,jkmin,jkmax)
    125         return None
    126 

~/anaconda3/lib/python3.7/site-packages/gaia_tools-0.2-py3.7.egg/gaia_tools/select/tgasSelect.py in _determine_selection(self, jmin, jmax, jkmin, jkmax)
    196             # Spline interpolate
    197             spl_indx= (exs > 4.25)*(exs < 13.5)\
--> 198                 *(True-numpy.isnan((nstartgas/nstar2mass)[:,ii]))
    199             tsf_spline= interpolate.UnivariateSpline(\
    200                 exs[spl_indx],(nstartgas/nstar2mass)[spl_indx,ii],

TypeError: numpy boolean subtract, the `-` operator, is deprecated, use the bitwise_xor, the `^` operator, or the logical_xor function instead.

If you could offer insight into what I'm doing wrong or what I need to do differently, I'd greatly appreciate it!

jobovy commented 4 years ago

Apologies, this is syntax that used to be allowed in Python, but hasn't for a few years now and I keep having to fix this bug in all of my code! Should be fixed in master now.

Note that with Gaia DR2 out now for more than 2 years, I don't know how useful the TGAS (Gaia DR1) selection function is at this point...