Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def coordinate_to_quantity(self, *coords):
if isinstance(coords[0], str):
if coords[0] in StokesProfile.profiles.keys():
return StokesProfile.profiles[coords[0]] * u.one
else:
return coords[0]
----------
indexes : `int`, `numpy.ndarray`
An index or array of indices to construct StokesProfile objects from.
"""
nans = np.isnan(indexes)
indexes = np.asanyarray(indexes, dtype=int)
out = np.empty_like(indexes, dtype=object)
out[nans] = np.nan
for profile, index in cls.profiles.items():
out[indexes == index] = profile
if out.size == 1 and not nans:
return StokesProfile(out.item())
elif nans.all():
return np.array(out, dtype=float)
return out
def _world_axis_object_classes(self):
return {'stokes': (
StokesProfile,
(),
{},
StokesProfile.from_index)}
def _world_axis_object_classes(self):
return {'stokes': (
StokesProfile,
(),
{},
StokesProfile.from_index)}