High-level conceptsbpy.DataClass allows aliases for column names for flexibility. A in operator would be useful to extend the flexibility for the operations on fields.
Explain the relevance to sbpy
New feature to allow for better operability of sbpy.DataClass.
Proposal details
Implement DataClass.__contains__ method to allow for in operator. Make use of DataClass._translate_columns method.
Example (pseudo-)code
from astropy.time import Time
from sbpy.data import Ephem
ceres = Ephem.from_horizons('ceres', epochs=Time('2022-01-01'))
print(ceres['rh']) # print [2.7183022] AU
print(ceres['r']) # print [2.7183022] AU
print('r' in eph.field_names) # print True
print('rh' in eph.field_names) # print False
# new feature will allow for both lines below to print `True`
print('r' in eph)
print('rh' in eph) # print False, but I hope this will print True
This is a request for
The requested changes will be implemented by
High-level concept
sbpy.DataClass
allows aliases for column names for flexibility. Ain
operator would be useful to extend the flexibility for the operations on fields.Explain the relevance to sbpy New feature to allow for better operability of
sbpy.DataClass
.Proposal details Implement
DataClass.__contains__
method to allow forin
operator. Make use ofDataClass._translate_columns
method.Example (pseudo-)code