bilby.gw.likelihood.multiband.MBGravitationalWaveTransient

class bilby.gw.likelihood.multiband.MBGravitationalWaveTransient(interferometers, waveform_generator, reference_chirp_mass=None, highest_mode=2, linear_interpolation=True, accuracy_factor=5, time_offset=None, delta_f_end=None, maximum_banding_frequency=None, minimum_banding_duration=0.0, weights=None, distance_marginalization=False, phase_marginalization=False, priors=None, distance_marginalization_lookup_table=None, reference_frame='sky', time_reference='geocenter')[source]

Bases: GravitationalWaveTransient

A multi-banded likelihood object

This uses the method described in S. Morisaki, 2021, arXiv: 2104.07813.

Parameters:
interferometers: list, bilby.gw.detector.InterferometerList

A list of bilby.detector.Interferometer instances - contains the detector data and power spectral densities

waveform_generator: `bilby.waveform_generator.WaveformGenerator`

An object which computes the frequency-domain strain of the signal, given some set of parameters

reference_chirp_mass: float, optional

A reference chirp mass for determining the frequency banding. This is set to prior minimum of chirp mass if not specified. Hence a CBCPriorDict object needs to be passed to priors when this parameter is not specified.

highest_mode: int, optional

The maximum magnetic number of gravitational-wave moments. Default is 2

linear_interpolation: bool, optional

If True, the linear-interpolation method is used for the computation of (h, h). If False, the IFFT-FFT method is used. Default is True.

accuracy_factor: float, optional

A parameter to determine the accuracy of multi-banding. The larger this factor is, the more accurate the approximation is. This corresponds to L in the paper. Default is 5.

time_offset: float, optional

(end time of data) - (maximum arrival time). If None, it is inferred from the prior of geocent time.

delta_f_end: float, optional

The frequency scale with which waveforms at the high-frequency end are smoothed. If None, it is determined from the prior of geocent time.

maximum_banding_frequency: float, optional

A maximum frequency for multi-banding. If specified, the low-frequency limit of a band does not exceed it.

minimum_banding_duration: float, optional

A minimum duration for multi-banding. If specified, the duration of a band is not smaller than it.

weights: str or dict, optional

Pre-computed multiband weights for calculating inner products.

distance_marginalization: bool, optional

If true, marginalize over distance in the likelihood. This uses a look up table calculated at run time. The distance prior is set to be a delta function at the minimum distance allowed in the prior being marginalised over.

phase_marginalization: bool, optional

If true, marginalize over phase in the likelihood. This is done analytically using a Bessel function. The phase prior is set to be a delta function at phase=0.

priors: dict, bilby.prior.PriorDict

A dictionary of priors containing at least the geocent_time prior

distance_marginalization_lookup_table: (dict, str), optional

If a dict, dictionary containing the lookup_table, distance_array, (distance) prior_array, and reference_distance used to construct the table. If a string the name of a file containing these quantities. The lookup table is stored after construction in either the provided string or a default location: ‘.distance_marginalization_lookup_dmin{}_dmax{}_n{}.npz’

reference_frame: (str, bilby.gw.detector.InterferometerList, list), optional

Definition of the reference frame for the sky location. - “sky”: sample in RA/dec, this is the default - e.g., “H1L1”, [“H1”, “L1”], InterferometerList([“H1”, “L1”]):

sample in azimuth and zenith, azimuth and zenith defined in the frame where the z-axis is aligned the the vector connecting H1 and L1.

time_reference: str, optional

Name of the reference for the sampled time parameter. - “geocent”/”geocenter”: sample in the time at the Earth’s center, this is the default - e.g., “H1”: sample in the time of arrival at H1

Returns:
Likelihood: bilby.core.likelihood.Likelihood

A likelihood object, able to compute the likelihood of the data given some model parameters

__init__(interferometers, waveform_generator, reference_chirp_mass=None, highest_mode=2, linear_interpolation=True, accuracy_factor=5, time_offset=None, delta_f_end=None, maximum_banding_frequency=None, minimum_banding_duration=0.0, weights=None, distance_marginalization=False, phase_marginalization=False, priors=None, distance_marginalization_lookup_table=None, reference_frame='sky', time_reference='geocenter')[source]

Empty likelihood class to be subclassed by other likelihoods

Parameters:
parameters: dict

A dictionary of the parameter names and associated values

__call__(*args, **kwargs)

Call self as a function.

Methods

__init__(interferometers, waveform_generator)

Empty likelihood class to be subclassed by other likelihoods

cache_lookup_table()

calculate_snrs(waveform_polarizations, ...)

Compute the snrs

calibration_marginalized_likelihood(...)

compute_log_likelihood_from_snrs(total_snrs)

compute_per_detector_log_likelihood()

distance_marginalized_likelihood(d_inner_h, ...)

generate_calibration_sample_from_marginalized_likelihood([...])

Generate a single sample from the posterior distribution for the set of calibration response curves when explicitly marginalizing over the calibration uncertainty.

generate_distance_sample_from_marginalized_likelihood([...])

Generate a single sample from the posterior distribution for luminosity distance when using a likelihood which explicitly marginalises over distance.

generate_phase_sample_from_marginalized_likelihood([...])

Generate a single sample from the posterior distribution for phase when using a likelihood which explicitly marginalises over phase.

generate_posterior_sample_from_marginalized_likelihood()

Reconstruct the distance posterior from a run which used a likelihood which explicitly marginalised over time/distance/phase.

generate_time_sample_from_marginalized_likelihood([...])

Generate a single sample from the posterior distribution for coalescence time when using a likelihood which explicitly marginalises over time.

get_calibration_log_likelihoods([...])

get_sky_frame_parameters([parameters])

Generate ra, dec, and geocenter time for parameters

load_lookup_table(filename)

log_likelihood()

Returns:

log_likelihood_ratio()

Difference between log likelihood and noise log likelihood

noise_log_likelihood()

Returns:

phase_marginalized_likelihood(d_inner_h, ...)

save_weights(filename)

Save multiband weights into a .hdf5 file.

setup_multibanding()

Set up frequency bands and coefficients needed for likelihood evaluations

setup_multibanding_from_weights(weights)

Set multiband weights from dictionary-like weights

time_marginalized_likelihood(...)

Attributes

accuracy_factor

cached_lookup_table_filename

delta_f_end

highest_mode

interferometers

lal_version

lalsimulation_version

linear_interpolation

marginalized_parameters

maximum_banding_frequency

maximum_frequency

meta_data

minimum_banding_duration

minimum_frequency

number_of_bands

priors

reference_chirp_mass

reference_chirp_mass_in_second

reference_frame

time_offset

weights

calculate_snrs(waveform_polarizations, interferometer, return_array=False)[source]

Compute the snrs

Parameters:
waveform_polarizations: dict

A dictionary of waveform polarizations and the corresponding array

interferometer: bilby.gw.detector.Interferometer

The bilby interferometer object

return_array: bool

If true, calculate and return internal array objects (d_inner_h_array and optimal_snr_squared_array), otherwise these are returned as None. This parameter is ignored for the multiband model as these arrays are never calculated.

Returns:
calculated_snrs: _CalculatedSNRs

An object containing the SNR quantities.

generate_calibration_sample_from_marginalized_likelihood(signal_polarizations=None)[source]

Generate a single sample from the posterior distribution for the set of calibration response curves when explicitly marginalizing over the calibration uncertainty.

Parameters:
signal_polarizations: dict, optional

Polarizations modes of the template.

Returns:
new_calibration: dict

Sample set from the calibration posterior

generate_distance_sample_from_marginalized_likelihood(signal_polarizations=None)[source]

Generate a single sample from the posterior distribution for luminosity distance when using a likelihood which explicitly marginalises over distance.

See Eq. (C29-C32) of https://arxiv.org/abs/1809.02293

Parameters:
signal_polarizations: dict, optional

Polarizations modes of the template. Note: These are rescaled in place after the distance sample is generated to allow further parameter reconstruction to occur.

Returns:
new_distance: float

Sample from the distance posterior.

generate_phase_sample_from_marginalized_likelihood(signal_polarizations=None)[source]

Generate a single sample from the posterior distribution for phase when using a likelihood which explicitly marginalises over phase.

See Eq. (C29-C32) of https://arxiv.org/abs/1809.02293

Parameters:
signal_polarizations: dict, optional

Polarizations modes of the template.

Returns:
new_phase: float

Sample from the phase posterior.

Notes

This is only valid when assumes that mu(phi) propto exp(-2i phi).

generate_posterior_sample_from_marginalized_likelihood()[source]

Reconstruct the distance posterior from a run which used a likelihood which explicitly marginalised over time/distance/phase.

See Eq. (C29-C32) of https://arxiv.org/abs/1809.02293

Returns:
sample: dict

Returns the parameters with new samples.

Notes

This involves a deepcopy of the signal to avoid issues with waveform caching, as the signal is overwritten in place.

generate_time_sample_from_marginalized_likelihood(signal_polarizations=None)[source]

Generate a single sample from the posterior distribution for coalescence time when using a likelihood which explicitly marginalises over time.

In order to resolve the posterior we artificially upsample to 16kHz.

See Eq. (C29-C32) of https://arxiv.org/abs/1809.02293

Parameters:
signal_polarizations: dict, optional

Polarizations modes of the template.

Returns:
new_time: float

Sample from the time posterior.

get_sky_frame_parameters(parameters=None)[source]

Generate ra, dec, and geocenter time for parameters

This method will attempt to convert from the reference time and sky parameters, but if they are not present it will fall back to ra and dec.

Parameters:
parameters: dict, optional

The parameters to be converted. If not specified self.parameters will be used.

Returns:
dict: dictionary containing ra, dec, and geocent_time
log_likelihood()[source]
Returns:
float
log_likelihood_ratio()[source]

Difference between log likelihood and noise log likelihood

Returns:
float
noise_log_likelihood()[source]
Returns:
float
save_weights(filename)[source]

Save multiband weights into a .hdf5 file.

Parameters:
filenamestr
setup_multibanding()[source]

Set up frequency bands and coefficients needed for likelihood evaluations

setup_multibanding_from_weights(weights)[source]

Set multiband weights from dictionary-like weights

Parameters:
weightsdict