heron.models package

Submodules

heron.models.georgebased module

Models utilising the george GPR library in Python and C++.

class heron.models.georgebased.Heron2dHodlr[source]

Bases: heron.models.georgebased.HodlrGPR, heron.models.gw.BBHNonSpinSurrogate, heron.models.gw.HofTSurrogate

Produce a BBH waveform generator using the Hodlr method.

Methods

bilby(self, times, mass_1, mass_2, …)

Return a waveform from the GPR in a format expected by the Bilby ecosystem

build(self[, mean, white_noise, tol])

Construct the GP object

distribution(self, p, times[, samples, …])

Return the mean waveform and the variance at a given location in the BBH parameter space.

eval(self)

Prepare the model to be evaluated.

log_evidence(self, k, n)

Evaluate the log-evidence of the model at a hyperparameter location k.

mean(self, p, times)

Return the mean waveform at a given location in the BBH parameter space.

train(self)

Prepare the model to be trained.

class heron.models.georgebased.Heron2dHodlrIMR[source]

Bases: heron.models.georgebased.HodlrGPR, heron.models.gw.BBHNonSpinSurrogate, heron.models.gw.HofTSurrogate

Produce a BBH waveform generator using the Hodlr method with IMRPhenomPv2 training data.

Methods

bilby(self, times, mass_1, mass_2, …)

Return a waveform from the GPR in a format expected by the Bilby ecosystem

build(self[, mean, white_noise, tol])

Construct the GP object

distribution(self, p, times[, samples, …])

Return the mean waveform and the variance at a given location in the BBH parameter space.

eval(self)

Prepare the model to be evaluated.

log_evidence(self, k, n)

Evaluate the log-evidence of the model at a hyperparameter location k.

mean(self, p, times)

Return the mean waveform at a given location in the BBH parameter space.

train(self)

Prepare the model to be trained.

class heron.models.georgebased.HeronHodlr[source]

Bases: heron.models.georgebased.HodlrGPR, heron.models.gw.BBHSurrogate, heron.models.gw.HofTSurrogate

Produce a BBH waveform generator using the Hodlr method.

Methods

bilby(self, times, mass_1, mass_2, …)

Return a waveform from the GPR in a format expected by the Bilby ecosystem

build(self[, mean, white_noise, tol])

Construct the GP object

distribution(self, p, times[, samples, …])

Return the mean waveform and the variance at a given location in the BBH parameter space.

eval(self)

Prepare the model to be evaluated.

log_evidence(self, k, n)

Evaluate the log-evidence of the model at a hyperparameter location k.

mean(self, p, times)

Return the mean waveform at a given location in the BBH parameter space.

train(self)

Prepare the model to be trained.

class heron.models.georgebased.HodlrGPR[source]

Bases: heron.models.Model

A GPR model using the hierarchical matrix approximation.

Methods

build(self[, mean, white_noise, tol])

Construct the GP object

distribution(self, p, times[, samples, …])

Return the mean waveform and the variance at a given location in the BBH parameter space.

eval(self)

Prepare the model to be evaluated.

log_evidence(self, k, n)

Evaluate the log-evidence of the model at a hyperparameter location k.

mean(self, p, times)

Return the mean waveform at a given location in the BBH parameter space.

train(self)

Prepare the model to be trained.

build(self, mean=0.0, white_noise=0, tol=1e-06)[source]

Construct the GP object

distribution(self, p, times, samples=100, polarisation='h+')[source]

Return the mean waveform and the variance at a given location in the BBH parameter space.

Parameters
pdict

A dictionary of parameter locations.

timesarray-like

The timestamps at which the model should be evaluated.

samplesint

The number of samples to draw from the GP.

polarisationstr {“h+”, “hx”}

The polarisation which should be evaluated.

eval(self)[source]

Prepare the model to be evaluated.

log_evidence(self, k, n)[source]

Evaluate the log-evidence of the model at a hyperparameter location k.

Parameters
nint

The number of points to be used to calculate the log likelihood.

mean(self, p, times)[source]

Return the mean waveform at a given location in the BBH parameter space.

train(self)[source]

Prepare the model to be trained.

heron.models.georgebased.train(model, batch_size=100, algorithm='adam', max_iter=1000)[source]

Train a george-based Gaussian process model.

heron.models.gw module

This module contains objects which provide the specifically-GW parts of waveform surrogate models.

class heron.models.gw.BBHNonSpinSurrogate[source]

Bases: object

c_ind = {'h+': 8, 'hx': 9, 'mass ratio': 1, 'time': 0}
columns = {0: 'time', 1: 'mass ratio', 8: 'h+', 9: 'hx'}
problem_dims = 2
class heron.models.gw.BBHSurrogate[source]

Bases: object

c_ind = {'h+': 8, 'hx': 9, 'mass ratio': 1, 'spin 1x': 2, 'spin 1y': 3, 'spin 1z': 4, 'spin 2x': 5, 'spin 2y': 6, 'spin 2z': 7, 'time': 0}
columns = {0: 'time', 1: 'mass ratio', 2: 'spin 1x', 3: 'spin 1y', 4: 'spin 1z', 5: 'spin 2x', 6: 'spin 2y', 7: 'spin 2z', 8: 'h+', 9: 'hx'}
parameters = ('mass ratio', 'spin 1x', 'spin 1y', 'spin 1z', 'spin 2x', 'spin 2y', 'spin 2z')
problem_dims = 8
class heron.models.gw.HofTSurrogate[source]

Bases: object

Methods

bilby(self, times, mass_1, mass_2, …)

Return a waveform from the GPR in a format expected by the Bilby ecosystem

bilby(self, times, mass_1, mass_2, luminosity_distance)[source]

Return a waveform from the GPR in a format expected by the Bilby ecosystem

Module contents

class heron.models.Model[source]

Bases: object

This is the factory class for statistical models used for waveform generation.

A model class must expose the following methods: - distribution : produce a distribution of waveforms at a given point in the parameter space - mean : produce a mean waveform at a given point in the parameter space - train : provide an interface for training the model