cogwheel.likelihood.marginalization.lookup_table.LookupTableMarginalizedPhase22

class cogwheel.likelihood.marginalization.lookup_table.LookupTableMarginalizedPhase22(d_luminosity_prior_name: str = 'euclidean', d_luminosity_max=15000.0, shape=(256, 128))

Bases: LookupTable

Similar to LookupTable except the likelihood is marginalized over both distance and phase, assuming quadrupolar radiation (actually, just |m|=2 is required, no restriction on l).

d_h is now assumed to be the absolute value of the complex (d|h) throughout, except in sample_phase it is the complex (d|h).

Construct the interpolation table.

If a table with the same settings is found in the file in LOOKUP_TABLES_FNAME, it will be loaded for faster instantiation. If not, the table will be computed and saved.

Parameters:
d_luminosity_priorstring

Key in d_luminosity_priors.

d_luminosity_maxfloat

Maximum luminosity distance (Mpc).

shape(int, int)

Number of interpolating points in x and y.

Methods

get_init_dict

Return dictionary with keyword arguments to __init__.

get_module_name

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

lnlike_marginalized

reinstantiate

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

sample_distance

Return samples from the luminosity distance distribution given the inner products (d|h), (h|h) of a waveform at distance .REFERENCE_DISTANCE.

to_json

Write class instance to json file.

Attributes

REFERENCE_DISTANCE

marginalized_params

subclass_registry

__call__(d_h, h_h)

Return log(evidence) - d_h**2 / h_h / 2, where``evidence`` is the value of the likelihood marginalized over distance.

This uses interpolation from a precomputed table.

Parameters:
d_h, h_hfloat

Inner products (d|h), (h|h) where d is data and h is the model strain at a fiducial distance REFERENCE_DISTANCE. These are scalars (detectors are summed over). A real part is taken in (d|h), not an absolute value (phase is not marginalized over so the computation is robust to higher modes).

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.

lnlike_marginalized(d_h, h_h)
Parameters:
d_h, h_hfloat

Inner products (d|h), (h|h) where d is data and h is the model strain at a fiducial distance .REFERENCE_DISTANCE. These are scalars (detectors are summed over).

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.

sample_distance(d_h, h_h, num=None, resolution=256)

Return samples from the luminosity distance distribution given the inner products (d|h), (h|h) of a waveform at distance .REFERENCE_DISTANCE.

Parameters:
d_hfloat

Inner product (summed over detectors) between data and waveform at self.REFERENCE_DISTANCE.

h_hfloat

Inner product (summed over detectors) of waveform at self.REFERENCE_DISTANCE with itself.

numint or None

How many samples to generate. None (default) generates a single (scalar) sample.

resolutionint

How finely to interpolate the distance distribution when generating samples.

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.