Configuring the Theory¶
Even if the user chooses to use the default theory parameters returned
by GalaxySpectrum.default_params()
, there are several areas where the user
should customize the parameters for the specific data set being fit. We will
described these customizations in this section.
Changing the Parametrization¶
The recommended way to make changes to the model parametrization is by
adjusting the parameters in the default
pyRSD.rsdfit.theory.parameters.ParameterSet
object. The user
should get the default parameters from the default_params()
function
and then make the desired changes, before writing the parameters to a file.
For example, to fix the satellite fraction and only use 12 free parameters in the fitting procedure, one can simply do
In [1]: from pyRSD.rsd import GalaxySpectrum
In [2]: model = GalaxySpectrum()
# default params
In [3]: params = model.default_params()
---------------------------------------------------------------------------
AttributeError Traceback (most recent call last)
<ipython-input-3-20168f551e3a> in <module>()
----> 1 params = model.default_params()
~/checkouts/readthedocs.org/user_builds/pyrsd/conda/latest/lib/python3.6/site-packages/pyRSD/rsd/power/gal/power_gal.py in default_params(self)
128 """
129 from pyRSD.rsdfit.theory import GalaxyPowerParameters
--> 130 return GalaxyPowerParameters.from_defaults(model=self)
131
132 #---------------------------------------------------------------------------
~/checkouts/readthedocs.org/user_builds/pyrsd/conda/latest/lib/python3.6/site-packages/pyRSD/rsdfit/theory/base.py in from_defaults(cls, model, extra_params)
155 """
156 # initialize an empty class
--> 157 params = cls()
158
159 # add extra parameters
~/checkouts/readthedocs.org/user_builds/pyrsd/conda/latest/lib/python3.6/site-packages/pyRSD/rsdfit/parameters/parameterset.py in __init__(self, *args, **kwargs)
35 def __init__(self, *args, **kwargs):
36
---> 37 kwargs['asteval'] = lmfit.asteval.Interpreter(symtable=SmartSymTable(self))
38 super(ParameterSet, self).__init__(*args, **kwargs)
39 self._prepared = False
AttributeError: module 'lmfit' has no attribute 'asteval'
# fix the satellite fraction
In [4]: params['fs'].vary = False