cogwheel.likelihood.marginalization.base.BaseCoherentScore

class cogwheel.likelihood.marginalization.base.BaseCoherentScore(*, sky_dict, lookup_table=None, log2n_qmc: int = 11, seed=0, n_qmc_sequences=128, min_n_effective=50, max_log2n_qmc: int = 15, **kwargs)

Bases: JSONMixin, ABC

Base class for computing coherent scores (i.e., marginalized likelihoods over extrinsic parameters) from matched-filtering timeseries.

Meant to be subclassed differently depending on the waveform physics (precession and/or higher modes) that may require different algorithms. This class provides methods to initialize and perform some of the generic steps that the coherent score computation normally requires.

Parameters:
sky_dict.skydict.SkyDictionary
lookup_tablelookup_table.LookupTable, dict or None

Interpolation table for distance marginalization. If a dict is passed, it is interpreted as keyword arguments to create a new lookup table. None creates one with default arguments.

log2n_qmcint

Base-2 logarithm of the number of requested extrinsic parameter samples.

seed{int, None, np.random.RandomState}

For reproducibility of the extrinsic parameter samples.

n_qmc_sequencesint

The coherent score instance will generate n_qmc_sequences QMC sequences and cycle through them in subsequent calls. This alleviates the problem of repeated extrinsic parameter samples, without increasing the computational cost. It can also be used to estimate the uncertainty of the marginalized likelihood computation.

min_n_effectiveint

Minimum effective sample size to use as convergence criterion. The program will try adapting the proposal distribution, increasing the number of samples until the effective sample size reaches min_n_effective or the number of extrinsic samples reaches 2**max_log2n_qmc.

max_log2n_qmcint

Base-2 logarithm of the maximum number of extrinsic parameter samples to request. The program will try adapting the proposal distribution, increasing the number of samples until the effective sample size reaches min_n_effective or the number of extrinsic samples reaches 2^max_log2n_qmc.

Methods

get_init_dict

Return dictionary with keyword arguments to __init__.

get_module_name

Name of the module that defines the instance's class.

reinstantiate

Return a new instance of the class, possibly updating init_kwargs.

to_json

Write class instance to json file.

Attributes

n_qmc_sequences

Number of QMC sequences to alternate between.

subclass_registry

get_init_dict(**kwargs)

Return dictionary with keyword arguments to __init__.

Only works if the class stores its init parameters as attributes with the same names. Otherwise, the subclass should override this method.

Parameters:
**kwargs

Allows to manually override some keys. The remaining ones will be read from the instance’s attributes. All keywords must be in the __init__ signature. It’s mostly here to facilitate overriding by subclasses.

get_module_name()

Name of the module that defines the instance’s class.

property n_qmc_sequences

Number of QMC sequences to alternate between.

reinstantiate(**new_init_kwargs)

Return a new instance of the class, possibly updating init_kwargs.

Values not passed will be taken from the current instance.

to_json(dirname, basename=None, *, dir_permissions=493, file_permissions=420, overwrite=False)

Write class instance to json file.

It can then be loaded with read_json.