simple_host_model
- class zdm.optical.simple_host_model(OpticalState=None, verbose=False)[source]
Bases:
objectA class to hold information about the intrinsic properties of FRB host galaxies. This is a simple but generic model.
- Ingredients are:
- A model for describing the intrinsic distribution
of host galaxies. This model must be described by some set of parameters, and be able to return a prior as a function of intrinsic host galaxy magnitude. This model is initialised via opstate.AbsModelID. Here, it is just 10 parameters at different absolute magnitudes, with linear/spline interpolation
- A model for converting absolute to apparent host magnitudes.
This is by defult an apparent r-band magnitude, though in theory a user can work in whatever band they wish.
- Internally, this class initialises:
An array of absolute magnitudes, which get weighted according to the host model. Internal variables associated with this are prefaced “Model”
Note that while this class describes the intrinsic “magnitudes”, really magnitude here is a proxy for whatever parameter is used to intrinsically describe FRBs. However, only 1D descriptions are currently implemented. Future descriptions will include redshift evolution, and 2D descriptions (e.g. mass, SFR) at any given redshift.
Methods Summary
gauss(x[, mu, sigma])simple Gaussian smoothing function
get_args()function to return args as a vector in the form of init_args
get_pmr_gz(mrbins, z)Return the apparent magnitude probability distribution p(m_r | z).
Initialises internal array of absolute magnitudes This is a simple set of uniformly log-spaced bins in terms of absolute magnitude, which the absolute magnitude model gets projected onto.
Assigns a weight to each of the absolute magnitudes in the internal array (which generally is very large) in terms of the absolute magnitude parameterisation (generally, only a few parameters)
init_args(Args)Initialises prior on absolute magnitude of galaxies according to the method.
Initialises bins for the simple model of an absolute magnitude prior.
Methods Documentation
- get_pmr_gz(mrbins, z)[source]
Return the apparent magnitude probability distribution p(m_r | z).
Converts each apparent magnitude bin centre back to an absolute magnitude using
CalcAbsoluteMags, then linearly interpolates the absolute magnitude weight array (self.AbsMagWeights) to obtain a probability density at each bin.- Parameters:
- Returns:
pmr – Probability density at each apparent magnitude bin centre. Values at the edges of the absolute magnitude range are clamped to the nearest valid bin rather than extrapolated.
- Return type:
np.ndarray, length N
Notes
The returned values are NOT renormalised to sum to unity; the sum may be less than one if some absolute magnitudes lie outside the model range
[Absmin, Absmax]. This is intentional: the shortfall represents probability mass for hosts too faint or too bright to appear in the apparent magnitude range.
- init_abs_bins()[source]
Initialises internal array of absolute magnitudes This is a simple set of uniformly log-spaced bins in terms of absolute magnitude, which the absolute magnitude model gets projected onto.
- init_abs_mag_weights()[source]
Assigns a weight to each of the absolute magnitudes in the internal array (which generally is very large) in terms of the absolute magnitude parameterisation (generally, only a few parameters)
- init_args(Args)[source]
Initialises prior on absolute magnitude of galaxies according to the method.
- Parameters:
Args (-) – The prior on absolute magnitudes to set for this model IF AppModelID == 1, then interpret the first as the k-correction
- init_model_bins()[source]
Initialises bins for the simple model of an absolute magnitude prior. This is much sparser than the app or abs bins, since these model bins correspond to parameters which may get adjusted by e.g. an MCMC
The base unit here is assumed to be absolute r-band magnitude M, but in principle this works for whatever absolute unit is being used by the model.
- __init__(OpticalState=None, verbose=False)[source]
Initialise the simple host magnitude model.
- Parameters:
OpticalState (OpticalState, optional) – optical parameter state providing model configuration (magnitude ranges, number of bins, interpolation scheme, k-correction flag). A default
OpticalStateis created if not provided.verbose (bool, optional) – if True, print which sub-models are being initialised. Defaults to False.
- init_abs_bins()[source]
Initialises internal array of absolute magnitudes This is a simple set of uniformly log-spaced bins in terms of absolute magnitude, which the absolute magnitude model gets projected onto.
- init_args(Args)[source]
Initialises prior on absolute magnitude of galaxies according to the method.
- Parameters:
Args (-) – The prior on absolute magnitudes to set for this model IF AppModelID == 1, then interpret the first as the k-correction
- init_model_bins()[source]
Initialises bins for the simple model of an absolute magnitude prior. This is much sparser than the app or abs bins, since these model bins correspond to parameters which may get adjusted by e.g. an MCMC
The base unit here is assumed to be absolute r-band magnitude M, but in principle this works for whatever absolute unit is being used by the model.
- get_pmr_gz(mrbins, z)[source]
Return the apparent magnitude probability distribution p(m_r | z).
Converts each apparent magnitude bin centre back to an absolute magnitude using
CalcAbsoluteMags, then linearly interpolates the absolute magnitude weight array (self.AbsMagWeights) to obtain a probability density at each bin.- Parameters:
- Returns:
pmr – Probability density at each apparent magnitude bin centre. Values at the edges of the absolute magnitude range are clamped to the nearest valid bin rather than extrapolated.
- Return type:
np.ndarray, length N
Notes
The returned values are NOT renormalised to sum to unity; the sum may be less than one if some absolute magnitudes lie outside the model range
[Absmin, Absmax]. This is intentional: the shortfall represents probability mass for hosts too faint or too bright to appear in the apparent magnitude range.