skypyproject / skypy

SkyPy: A package for modelling the Universe.
BSD 3-Clause "New" or "Revised" License
117 stars 38 forks source link

BUG: Allow `schechter_smf_mass` input parameter `alpha` to be array and callable #524

Closed philipp128 closed 2 years ago

philipp128 commented 2 years ago

Description

The input parameter alpha (here) of the method schechter_smf_mass in skypy.galaxies.stellar_mass should be allowed to be an array_like or callable parameter.

This is especially correlated to the method schechter_smf in skypy.galaxies._schechter (here) where alpha is allowed to be array_like and callable and used to call schechter_smf_mass.

rrjbca commented 2 years ago

This is intended. Unlike varying m_star, each different value of alpha requires constructing a different CDF and we couldn't come up with an efficient way around this. You could add the dependent_argument decorator for consistency and to allow functions for alpha that return a single scalar value. However, I expect an implementation varying alpha for each galaxy would be non-trivial.

philipp128 commented 2 years ago

@rrjbca true I remember our discussion now. I think we should then at least change the requirement of alpha in the docs of schechter_lf and schechter_smf to alpha being a scalar. Or that we enable a callable that returns a scalar value. I prefer the first.

What do you think?

rrjbca commented 2 years ago

I would suggest adding the @dependent_argument decorator to make it consistent with schechter_lf_magnitude

philipp128 commented 2 years ago

Ok as we discussed it is intended so I close this issue.