cogwheel.likelihood.marginalization.base.MarginalizationInfo

class cogwheel.likelihood.marginalization.base.MarginalizationInfo(qmc_sequence_id: int, ln_numerators: ndarray, q_inds: ndarray, sky_inds: ndarray, t_first_det: ndarray, d_h: ndarray, h_h: ndarray, tdet_inds: ndarray, proposals_n_qmc: list, proposals: list)

Bases: object

Contains likelihood marginalized over extrinsic parameters, and intermediate products that can be used to generate extrinsic parameter samples or compute other auxiliary quantities like partial marginalizations.

Below we refer to samples with sufficiently high maximum likelihood over distance to be included in the integral as “important” samples.

Attributes:
qmc_sequence_idint

Index to coherent_score._qmc_sequences

ln_numeratorsfloat array of length n_important

Natural log of the numerator of the weights of the QMC samples, including the likelihood and and prior and excluding the importance-sampling correction. The multiple importance sampling formula with the balance heuristic is:

∫ f(x) p(x) dx ≈ Σ_x [p(x) f(x) / (Σ_j n_j q_j(x))]

where {x} is a mixture of n_j samples from each proposal distribution q_j; this attribute contains the (log) numerators. In the present case x represents the times of arrival at each detector.

q_indsint array of length n_important

Indices to the QMC sequence.

sky_indsint array of length n_important

Indices to sky_dict.sky_samples.

t_first_detfloat array of length n_important

Time of arrival at the first detector.

d_hcomplex array of length n_important

Inner product ⟨d|h⟩, where h is the waveform at a reference distance.

h_hfloat array of length n_important

Real inner product ⟨h|h⟩.

tdet_indsint array of shape (n_det, n_important)

The i-th row contains indices to times (used by the coherent score instance) that correspond to the discretized time of arrival at the i-th detector.

proposals_n_qmclist of length n_proposals containing ints

Lengths of the QMC sequences used in multiple importance sampling.

proposalslist

List of length n_proposals containing float arrays of shape (n_det, n_times), the proposal distributions for detector times of arrival, normalized to sum to 1 along the time axis. These are combined using multiple importance sampling.

weightsfloat array of length n_important

Weights of the QMC samples normalized to have unit sum.

weights_qfloat array of the same length as unique(q_inds)

Weights of the QMC samples, normalized to have unit sum, differs from weights for higher-mode waveforms, that perform a quadrature over orbital phase (thus, many samples can have the same q_ind). Used for computing n_effective.

n_qmcint

Total number of QMC samples used in the integral, including unphysical and unimportant ones.

n_effectivefloat

Effective number of samples achieved for the marginalization integral.

lnl_marginalizedfloat

log of the marginalized likelihood over extrinsic parameters excluding inclination (i.e.: time of arrival, sky location, polarization, distance, orbital phase).

Methods

update

Update entries of this instance of MarginalizationInfo to include information from another instance.

Attributes

qmc_sequence_id

ln_numerators

q_inds

sky_inds

t_first_det

d_h

h_h

tdet_inds

proposals_n_qmc

proposals

weights

weights_q

n_qmc

n_effective

lnl_marginalized

update(other)

Update entries of this instance of MarginalizationInfo to include information from another instance. The intended use is to extend the QMC sequence if it has too low .n_effective.

Parameters:
otherMarginalizationInfo

Typically self will be the first half of the extended QMC sequence and other would be the second half.