[Question]How do I input my own power spectrum?
HoisW opened this issue · 2 comments
HoisW commented
For example, I have the power spectrum
def MyNewSpectrum(lnk, z, Omega_m, n = 0.9665, sigma_8 = 0.8102, NewParameter):
xxx
return power_spectrum
How do I input my own power spectrum? Can I use the following method
mf = MassFunction(transfer_model='xxx') ?
steven-murray commented
See this tutorial: https://hmf.readthedocs.io/en/latest/examples/plugins_and_extending.html.
In brief, define your new power spectrum as a subclass of the Transfer
class:
from hmf import Transfer
class MyTransfer(Transfer):
<class body>
Then you can use it in your mass function like so:
mf = MassFunction(transfer_model=MyTransfer, transfer_params={...})
The easiest way to get a template for the Transfer class would be to copy the EH
class that's in the code.
steven-murray commented
Closing as answered. Please re-open if this doesn't work for you!