When a method uses a single quantity that may be found in an sbpy DataClass, sbpy's coding guidelines recommends internally transforming that quantity into a DataClass object. From the docs:
@quantity_to_dataclass(eph=(Ephem, 'phase'))
def phase_func(eph):
...
This buries the physical dependency of the method (although that can be addressed in the docstring), and it also makes the code slightly harder to read, with references to eph["phase"] versus just phase.
Following the Zen of Python, where it is stated that "Simple is better than complex," and "Flat is better than nested," perhaps we should reverse the rule and instead transform DataClass to Quantity?
@dataclass_to_quantity(phase=(Ephem, "phase"))
def phase_func(phase):
...
This approach would still validate the parameter's dimensions. I think we would deprecate quantity_to_dataclass.
When a method uses a single quantity that may be found in an sbpy
DataClass, sbpy's coding guidelines recommends internally transforming that quantity into aDataClassobject. From the docs:This buries the physical dependency of the method (although that can be addressed in the docstring), and it also makes the code slightly harder to read, with references to
eph["phase"]versus justphase.Following the Zen of Python, where it is stated that "Simple is better than complex," and "Flat is better than nested," perhaps we should reverse the rule and instead transform
DataClasstoQuantity?This approach would still validate the parameter's dimensions. I think we would deprecate
quantity_to_dataclass.