gwpopulation_pipe.common_format.rejection_sample_population

rejection_sample_population(model, params, posterior, maximum_mass, minimum_mass, max_redshift, draws_per_hypersample=1, batch_size=10000, maxit=100)[source]

Rejection sampling for fair_population_draws in popsummary output.

Parameters:
model: bilby.hyper.model.Model

population model to draw from

params: list

names of the event-level parameters being modelled

posterior: pandas.DataFrame

data frame of hypersamples

maximum_mass: float

maximum mass to sample from

minimum_mass: float

minimum mass to sample from

max_redshift: float

maximum redshift to sample from

draws_per_hypersample: int

number of samples to draw per hypersample

batch_size: int

batch size to draw potential samples with

maxit: int

maximum number of iterations to attempt drawing batch_size samples in order to achieve draws_per_hypersample cumulative accepted samples

Returns:
population_draws: np.array

array of samples from the population model with shape (draws_per_hypersample, number_of_hypersamples, number_of_event_dimensions)