chippr currently enables estimation of the redshift density function.
The log_z_dens Class¶
-
class
log_z_dens.log_z_dens(catalog, hyperprior, truth=None, vb=True)[source]¶ -
log_hyper_posterior(log_nz)[source]¶ Function to evaluate log hyperposterior
Parameters: log_nz (numpy.ndarray, float) – vector of logged redshift density bin values at which to evaluate the full posterior Returns: log_prob – log posterior probability associated with parameters in log_nz Return type: float
-
mexp()[source]¶ Calculates the marginalized expected value estimator of the redshift density function
Returns: mexp_dens – array of redshift density function bin values Return type: ndarray
-
mmap()[source]¶ Calculates the marginalized maximum a posteriori estimator of the redshift density function
Returns: mmap_dens – array of redshift density function bin values Return type: ndarray
-
optimize(start, vb=True)[source]¶ Calculates the marginalized maximum likelihood estimator of the redshift density function
Parameters: - start (numpy.ndarray) – array of log redshift density function bin values at which to begin optimization
- vb (boolean, optional) – True to print progress messages to stdout, False to suppress
Returns: mmle_dens – array of redshift density function bin values
Return type: numpy.ndarray
-
sample(n_samps, vb=True)[source]¶ Calculates samples estimating the redshift density function
Parameters: - n_samps (int) – number of samples to accept before stopping
- vb (boolean, optional) – True to print progress messages to stdout, False to suppress
Returns: samp_dens – array of sampled redshift density function bin values
Return type: ndarray
-
Plotting Utilities¶
-
plot_utils.plot_h(sub_plot, bin_ends, plot, s='--', c='k', a=1, w=1, d=[(0, (1, 0.0001))], l=None, r=False)[source]¶ Helper function to plot horizontal lines of a step function
Parameters: - sub_plot (matplotlib.pyplot subplot object) – subplot into which step function is drawn
- bin_ends (list or ndarray) – list or array of endpoints of bins
- plot (list or ndarray) – list or array of values within each bin
- s (string, optional) – matplotlib.pyplot linestyle
- c (string, optional) – matplotlib.pyplot color
- a (int or float, [0., 1.], optional) – matplotlib.pyplot alpha (transparency)
- w (int or float, optional) – matplotlib.pyplot linewidth
- d (list of tuple, optional) – matplotlib.pyplot dash style, of form [(start_point, (points_on, points_off, ...))]
- l (string, optional) – label for function
- r (boolean, optional) – True for rasterized, False for vectorized
-
plot_utils.plot_step(sub_plot, bin_ends, plot, s='--', c='k', a=1, w=1, d=[(0, (1, 0.0001))], l=None, r=False)[source]¶ Plots a step function
Parameters: - sub_plot (matplotlib.pyplot subplot object) – subplot into which step function is drawn
- bin_ends (list or ndarray) – list or array of endpoints of bins
- plot (list or ndarray) – list or array of values within each bin
- s (string, optional) – matplotlib.pyplot linestyle
- c (string, optional) – matplotlib.pyplot color
- a (int or float, [0., 1.], optional) – matplotlib.pyplot alpha (transparency)
- w (int or float, optional) – matplotlib.pyplot linewidth
- d (list of tuple, optional) – matplotlib.pyplot dash style, of form [(start_point, (points_on, points_off, ...))]
- l (string, optional) – label for function
- r (boolean, optional) – True for rasterized, False for vectorized
-
plot_utils.plot_v(sub_plot, bin_ends, plot, s='--', c='k', a=1, w=1, d=[(0, (1, 0.0001))], r=False)[source]¶ Helper function to plot vertical lines of a step function
Parameters: - sub_plot (matplotlib.pyplot subplot object) – subplot into which step function is drawn
- bin_ends (list or ndarray) – list or array of endpoints of bins
- plot (list or ndarray) – list or array of values within each bin
- s (string, optional) – matplotlib.pyplot linestyle
- c (string, optional) – matplotlib.pyplot color
- a (int or float, [0., 1.], optional) – matplotlib.pyplot alpha (transparency)
- w (int or float, optional) – matplotlib.pyplot linewidth
- d (list of tuple, optional) – matplotlib.pyplot dash style, of form [(start_point, (points_on, points_off, ...))]
- r (boolean, optional) – True for rasterized, False for vectorized