cogwheel.likelihood.marginalization.coherent_score_hm.CoherentScoreHM

class cogwheel.likelihood.marginalization.coherent_score_hm.CoherentScoreHM(sky_dict, m_arr, lookup_table=None, log2n_qmc: int = 11, nphi=128, seed=0, n_qmc_sequences=128, min_n_effective=50, max_log2n_qmc: int = 15, beta_temperature=0.5, learning_rate=0.01)

Bases: ProposingCoherentScore, BaseCoherentScoreHM

Class that, given a matched-filtering timeseries, computes the likelihood marginalized over extrinsic parameters (get_marginalization_info()).

Extrinsic parameters samples can be generated as well (gen_samples_from_marg_info()).

Works for quasi-circular waveforms with generic spins and higher modes.

Parameters:
beta_temperaturefloat or float array of shape (n_detectors,)

Inverse temperature, tempers the arrival time probability at each detector.

learning_ratefloat

How aggressively to update the following guess for the time- of-arrival proposal.

Methods

gen_samples

Deprecated, use .gen_samples_from_marg_info

gen_samples_from_marg_info

Generate requested number of extrinsic parameter samples.

get_init_dict

Return dictionary with keyword arguments to __init__.

get_marginalization_info

Return a MarginalizationInfo object with extrinsic parameter integration results.

get_module_name

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

optimize_beta_temperature

Set .beta_temperature, an array of shape (n_det,) with per- detector inverse-temperature values (used to temper the proposal distribution) tuned so as to maximize the efficiency of importance sampling.

reinstantiate

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

to_json

Write class instance to json file.

Attributes

DLNL_THRESHOLD

n_qmc_sequences

Number of QMC sequences to alternate between.

nphi

Number of orbital phase values to integrate over using the trapezoid rule.

subclass_registry

gen_samples(dh_mptd, hh_mppd, times, num=(), lnl_marginalized_threshold=-inf)

Deprecated, use .gen_samples_from_marg_info

gen_samples_from_marg_info(marg_info, num=())

Generate requested number of extrinsic parameter samples.

Parameters:
marg_infoMarginalizationInfoHM or None

Normally, output of .get_marginalization_info. If None, assume that the sampled parameters were unphysical and return samples full of nans.

numint, optional

Number of samples to generate, None makes a single sample.

Returns:
samplesdict

Values are scalar if num is None, else numpy arrays. If marg_info correspond to an unphysical sample (i.e., a realization of matched-filtering timeseries in the detectors incompatible with a real signal) the values will be NaN.

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_marginalization_info(d_h_timeseries, h_h, times, lnl_marginalized_threshold=-inf)

Return a MarginalizationInfo object with extrinsic parameter integration results.

Adaptive importance sampling is performed, which requires an initial proposal. This method comes up with a proposal, half based on the d_h timeseries and half based on the adaptions from previous calls to this function. Thus, as a side effect ._t_arrival_prob is updated (if .learning_rate != 0).

get_module_name()

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

property n_qmc_sequences

Number of QMC sequences to alternate between.

property nphi

Number of orbital phase values to integrate over using the trapezoid rule. Setting this attribute also defines:

  • ._dh_phasor

  • ._hh_phasor

  • ._phi_ref

optimize_beta_temperature(dh_timeseries, h_h, times, beta_rng=(0.1, 1))

Set .beta_temperature, an array of shape (n_det,) with per- detector inverse-temperature values (used to temper the proposal distribution) tuned so as to maximize the efficiency of importance sampling.

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.