Update desitarget code to avoid deprecated usage of np.int and np.float, e.g.
py/desitarget/cuts.py: if isinstance(Grr, np.float):
cases the following DeprecationWarning in tests:
/global/common/software/desi/cori/desiconda/20211217-2.0.0/code/desitarget/master/py/desitarget/cuts.py:2204: DeprecationWarning: `np.float` is a deprecated alias for the builtin `float`. To silence this warning, use `float` by itself. Doing this will not modify any behavior and is safe. If you specifically wanted the numpy scalar type, use `np.float64` here.
Deprecated in NumPy 1.20; for more details and guidance: https://numpy.org/devdocs/release/1.20.0-notes.html#deprecations
if isinstance(Grr, np.float):
np.float64, np.int32, np.int32, etc are fine, and I think this is too:
because that vector-based cast wouldn't work with a naive np.int -> int replacement.
Most other codes have tripped on this via code like np.ones(n, dtype=int); from a quick grep most desitarget cases are a little different, e.g. I'm not sure whether isinstance(Grr, float) actually would work for all flavors of numpy floats (the deprecating warning says it would, but please check...).
i.e. check this on a case by case basis and not a naive search/replace.
Update desitarget code to avoid deprecated usage of np.int and np.float, e.g.
cases the following DeprecationWarning in tests:
np.float64, np.int32, np.int32, etc are fine, and I think this is too:
because that vector-based cast wouldn't work with a naive
np.int
->int
replacement.Most other codes have tripped on this via code like
np.ones(n, dtype=int)
; from a quick grep most desitarget cases are a little different, e.g. I'm not sure whetherisinstance(Grr, float)
actually would work for all flavors of numpy floats (the deprecating warning says it would, but please check...).i.e. check this on a case by case basis and not a naive search/replace.