You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
For some reason, I have targets in np.ndarray. (I have to mask some targets frequently by comparing them (SkyCoord objects) with a catalog table)
The following code shows the problem:
importastroplanasapimportnumpyasnpfromastropy.coordinatesimportEarthLocation, SkyCoordfromastropy.timeimportTimeconsts= [ap.AtNightConstraint()]
observer=ap.Observer(EarthLocation(lat=0, lon=0, height=0))
targets=np.array([SkyCoord(ra=0, dec=0, unit='deg')])
times=Time("2020-01-01")
ap.is_observable(constraints=consts, observer=observer, targets=targets.tolist(), times=times)
# Works fine, giving [True]ap.is_observable(constraints=consts, observer=observer, targets=targets, times=times)
# AttributeError: 'numpy.ndarray' object has no attribute 'isscalar'
A simple update to the source code may fix it
# original from https://github.com/astropy/astroplan/blob/master/astroplan/constraints.py#L265iftargets.isscalar:
# Change toifhasattr(targets, "isscalar") andtargets.isscalar:
How do you think?
The text was updated successfully, but these errors were encountered:
Thanks for this note. In general we recommend that you use target lists as pure Python lists to prevent confusion. Creating object arrays will work for masking, but you can achieve a similar effect with the following syntax without numpy:
For some reason, I have
targets
innp.ndarray
. (I have to mask some targets frequently by comparing them (SkyCoord
objects) with a catalog table)The following code shows the problem:
A simple update to the source code may fix it
How do you think?
The text was updated successfully, but these errors were encountered: