-
Notifications
You must be signed in to change notification settings - Fork 36
Description
Is your feature request related to a problem? Please describe.
The components are somewhat clunky, as recently noted in halomod/halomod#150.
Model parameters need to be specified independently for each component, even if two components really should just inherit from each other. Furthermore, it's difficult to do proper validation on model parameters.
Describe the solution you'd like
Split the components into two parts: one should be a part that accepts the quantities from the framework itself (e.g. mass, dndm or whatever is needed), and the other should be the actual model, whose input parameters really are the parameters of the model. They can be validated as standard attrs/dataclass attributes, and subclasses will respect normal subclassing inheritance of parameters etc.
Furthermore, then it will be possible to unify the xxx_model and xxx_parameters inputs to the framework... you should just be able to pass a single model instance (because it doesn't need access to generated quantities to define it).
Describe alternatives you've considered
I haven't really considered other alternatives. We could consider either basic dataclasses, or using attrs. I'd prefer the latter in general.
Additional context
We need to consider backwards compatibility, and so at least at first we should not remove the two-fold _model and _params specification. Maybe have it optional to provide params, and let the _model be an actual model instance OR a class.