CosmoFit.define_model¶
- CosmoFit.define_model(name, E, *, extra_params=None, label=None, w=None, dEdz=None, Omega_de=None, mu=None)[source]¶
Build a new
Cosmologysubclass from a plainE(z)function.- Parameters:
name (str) – Model name (
model.MODEL_NAMEand the generated class’s__name__).E (callable(params: dict, z: ndarray) -> ndarray) – Dimensionless Hubble parameter. Required – this alone is enough to fit the model against every CosmoFit dataset and produce every plot except
w_of_z()/deceleration().extra_params (dict[str, dict], optional) – New parameters this model needs beyond the standard set (
H0,Omega_m,Omega_k,w0,wa,rd,MB,Omega_b,A_s,alpha). Maps name -> spec dict with keys"default"(float, default 0.0),"bounds"((lower, upper), needed only if the parameter will be fit rather than fixed, unless bounds are instead passed toFitter(bounds=...)), and"label"(str, optional, LaTeX label for corner plots). Names must not collide with the standard set.label (str, optional) – How the model’s name should appear in figure legends and titles (
model.MODEL_LABEL), whennameis really a set of symbols spelled out as an identifier – e.g.name="MyQuintessence", label=r"$\phi$CDM". Matplotlib renders the$...$spans with mathtext. Defaults tonameused verbatim, which is right for an acronym.w (callable(params, z) -> ndarray, optional) – Dark-energy equation of state, for
w_of_z(). Not required for fitting.dEdz (callable(params, z) -> ndarray, optional) – Derivative of
E(z), fordeceleration()/background.q(). Defaults to a numerical (central finite-difference) approximation ofEif omitted.Omega_de (callable(params, z) -> ndarray, optional) – Dark-energy density parameter, for
background.Omega_de().mu (callable(params: dict, a: ndarray, k: float or None) -> ndarray, optional) – Effective-to-Newtonian gravitational coupling G_eff(a,k)/G_N, for growth-of-structure predictions (
background.{growth_rate,sigma8,fsigma8}, the"fsigma8"/"s8"datasets) – seemu().ais the scale factor (anndarray, evaluated on a whole grid at once, same convention asE);kis a single wavenumber [h/Mpc] (orNone, for a scale-independentmuthat never reads it). Defaults to 1 everywhere (standard GR growth) if omitted – correct for any model that reparametrizes dark energy without touching gravity itself; only give this for a genuinely modified-gravity model, exactly asFQExponential/FRTLinear/FRHuSawickido internally.
- Returns:
type – A new
Cosmologysubclass, usable directly asFitter(model=..., ...).- Return type: