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, loc='.', prepend='', vb=True)[source]¶ -
calculate_mexp(vb=True)[source]¶ Calculates the marginalized expected value estimator of the redshift density function
Parameters: vb (boolean, optional) – True to print progress messages to stdout, False to suppress Returns: log_exp_nz – array of logged redshift density function bin values Return type: ndarray, float
-
calculate_mmap(vb=True)[source]¶ Calculates the marginalized maximum a posteriori estimator of the redshift density function
Parameters: vb (boolean, optional) – True to print progress messages to stdout, False to suppress Returns: log_map_nz – array of logged redshift density function bin values Return type: ndarray, float
-
calculate_mmle(start, vb=True, no_data=0, no_prior=0)[source]¶ Calculates the marginalized maximum likelihood estimator of the redshift density function
Parameters: - start (numpy.ndarray, float) – 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
- no_data (boolean, optional) – True to exclude data contribution to hyperposterior
- no_prior (boolean, optional) – True to exclude prior contribution to hyperposterior
Returns: log_mle_nz – array of logged redshift density function bin values maximizing hyperposterior
Return type: numpy.ndarray, float
-
calculate_samples(ivals, n_accepted=3, n_burned=2, vb=True, n_procs=1, no_data=0, no_prior=0, gr_threshold=1.2)[source]¶ Calculates samples estimating the redshift density function
Parameters: - ivals (numpy.ndarray, float) – initial values of log n(z) for each walker
- n_accepted (int, optional) – log10 number of samples to accept per walker
- n_burned (int, optional) – log10 number of samples between tests of burn-in condition
- n_procs (int, optional) – number of processors to use, defaults to single-thread
- vb (boolean, optional) – True to print progress messages to stdout, False to suppress
- no_data (boolean, optional) – True to exclude data contribution to hyperposterior
- no_prior (boolean, optional) – True to exclude prior contribution to hyperposterior
Returns: log_samples_nz – array of sampled log redshift density function bin values
Return type: ndarray, float
-
calculate_stacked(vb=True)[source]¶ Calculates the stacked estimator of the redshift density function
Parameters: vb (boolean, optional) – True to print progress messages to stdout, False to suppress Returns: log_stk_nz – array of logged redshift density function bin values Return type: ndarray, float
-
compare(vb=True)[source]¶ Calculates all available goodness of fit measures
Parameters: vb (boolean, optional) – True to print progress messages to stdout, False to suppress Returns: out_info – dictionary of all available statistics Return type: dict
-
evaluate_log_hyper_likelihood(log_nz)[source]¶ Function to evaluate log hyperlikelihood
Parameters: log_nz (numpy.ndarray, float) – vector of logged redshift density bin values at which to evaluate the hyperlikelihood Returns: log_hyper_likelihood – log likelihood probability associated with parameters in log_nz Return type: float
-
evaluate_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_hyper_posterior – log hyperposterior probability associated with parameters in log_nz Return type: float
-
evaluate_log_hyper_prior(log_nz)[source]¶ Function to evaluate log hyperprior
Parameters: log_nz (numpy.ndarray, float) – vector of logged redshift density bin values at which to evaluate the hyperprior Returns: log_hyper_prior – log prior probability associated with parameters in log_nz Return type: float
-
optimize(start, no_data, no_prior, vb=True)[source]¶ Maximizes the hyperposterior of the redshift density
Parameters: - start (numpy.ndarray, float) – array of log redshift density function bin values at which to begin optimization
- no_data (boolean) – True to exclude data contribution to hyperposterior
- no_prior (boolean) – True to exclude prior contribution to hyperposterior
- vb (boolean, optional) – True to print progress messages to stdout, False to suppress
Returns: res.x – array of logged redshift density function bin values maximizing hyperposterior
Return type: numpy.ndarray, float
-
plot_estimators(log=True, mini=True)[source]¶ Plots all available estimators of the redshift density function.
-
read(read_loc, style='pickle', vb=True)[source]¶ Function to load inferred quantities from files.
Parameters: - read_loc (string) – filepath where inferred redshift density function is stored
- style (string, optional) – keyword for file format, currently only ‘pickle’ supported
- vb (boolean, optional) – True to print progress messages to stdout, False to suppress
Returns: self.info – returns the log_z_dens information dictionary object
Return type: dict
-
sample(ivals, n_samps, vb=True)[source]¶ Samples the redshift density hyperposterior
Parameters: - ivals (numpy.ndarray, float) – initial values of the walkers
- n_samps (int) – number of samples to accept before stopping
- vb (boolean, optional) – True to print progress messages to stdout, False to suppress
Returns: mcmc_outputs – dictionary containing array of sampled redshift density function bin values as well as posterior probabilities, acceptance fractions, and autocorrelation times
Return type: dict
-
write(write_loc, style='pickle', vb=True)[source]¶ Function to write results of inference to files.
Parameters: - write_loc (string) – filepath where results of inference should be saved.
- style (string, optional) – keyword for file format, currently only ‘pickle’ supported
- vb (boolean, optional) – True to print progress messages to stdout, False to suppress
-