This is a jupyter notebook to demonstrate the functionality of the heron-BBH binary black hole surrogate model. The surrogate model is conditioned on numerical relativity data produced by the Georgia Tech group.
In [1]:
import heron
from heron import waveform
from george import kernels
import numpy as np
In [2]:
import matplotlib.pyplot as plt
%matplotlib inline
plt.style.use("/home/daniel/thesis-style.mpl")
In [3]:
import elk.catalogue
In [4]:
total_mass = 60
In [5]:
catalogue = elk.catalogue.NRCatalogue(origin="GeorgiaTech")

imr_cat = elk.catalogue.PPCatalogue("IMRPhenomPv2", 
                                    total_mass=total_mass, 
                                    fmin=95)
seo_cat = elk.catalogue.PPCatalogue("SEOBNRv4_ROM", 
                                    total_mass=total_mass, 
                                    fmin=95)
In [6]:
problem_dims = 8
c_ind = catalogue.c_ind
time_covariance = kernels.RationalQuadraticKernel(.05, 400,
                                           ndim=problem_dims,
                                           axes=c_ind['time'],)
mass_covariance = kernels.ExpSquaredKernel(0.005, #0.09
                                           ndim=problem_dims,
                                           axes=c_ind['mass ratio'])
spin_covariance = kernels.ExpSquaredKernel([0.005, 0.005, 0.005, 
                                            0.005, 0.005, 0.005], 
                                           ndim=problem_dims, 
                                           axes=[2,3,4,5,6,7])

covariance =  1e1 * mass_covariance * time_covariance * spin_covariance

gp = gp_cat = waveform.GPCatalogue(catalogue, covariance,
                                   total_mass=total_mass, fsample=1024,
                                   mean=0.0,
                                   white_noise=1e-8,
                                   fmin=95,)
There was an error producing a waveform for GT0392
In [7]:
# After 2000 training iterations with ADAM
gp_cat.gp.set_parameter_vector(np.log([1.96628473e+00,
                                       3.33975754e-04,
                                       1.64245209e+00, 3.29722921e+02,
                                       8.78725810e-04, 7.28872939e-04, 6.98418530e-04,
                                       8.91739716e-04, 7.28836193e-04, 7.05170046e-04]))
In [8]:
def sample_plot(p, surrogates=True):
    """
    Make a plot to compare sample draws from the GPR to SEOBNRv4 and 
    IMRPhenomPv2.
    """
    samples = gp_cat.waveform_samples(p=p,
                                  time_range=[-150, 100, 1024], samples=100)
    
    if surrogates:
        imr = imr_cat.waveform(p=p,
                            time_range=[-150., 100., 1024])
        seo = seo_cat.waveform(p=p,
                        time_range=[-150., 100., 1024])
        
    f, ax = plt.subplots(1,1, figsize=(10,5));

    for sample in samples:
        ax.plot(sample.times, sample.data/1e19, alpha=0.05, color='k');
        
    if surrogates:
        ax.plot(imr[0].times*1e4, imr[0].data, label="IMRPhenomPv2");
        ax.plot(seo[0].times*1e4, seo[0].data, label="SEOBNRv4");
        
    ax.set_xlabel("Times [msec] from merger");
    ax.set_ylabel("Strain (h+)");

    ax.legend();
    
    return f
# Sample Waveforms
## Non-spinning waveforms
In [9]:
for mass_ratio in np.linspace(0.1,1,10):
    print("Mass ratio: {}".format(mass_ratio))
    sample_plot({"mass ratio": mass_ratio,
                 "spin 1x": 0, "spin 1y": 0, "spin 1z": 0,
                 "spin 2x": 0, "spin 2y": 0, "spin 2z": 0,},)
Mass ratio: 0.1
Mass ratio: 0.2


/home/daniel/.virtualenvs/aries/heron-2714stable/lib/python2.7/site-packages/george-0.3.1-py2.7-linux-x86_64.egg/george/utils.py:30: RuntimeWarning: covariance is not positive-semidefinite.


Mass ratio: 0.3
Mass ratio: 0.4
Mass ratio: 0.5
Mass ratio: 0.6
Mass ratio: 0.7
Mass ratio: 0.8
Mass ratio: 0.9
Mass ratio: 1.0


/home/daniel/.virtualenvs/aries/heron-2714stable/lib/python2.7/site-packages/matplotlib-2.2.2-py2.7-linux-x86_64.egg/matplotlib/font_manager.py:1328: UserWarning: findfont: Font family [u"'URW Bookman L'"] not found. Falling back to DejaVu Sans
  (prop.get_family(), self.defaultFamily[fontext]))
 
png
 
png
 
png
 
png
 
png
 
png
 
png
 
png
 
png
 
png
## Anti-aligned spin waveform
In [10]:
sample_plot({"mass ratio": 1,
                 "spin 1x": 0, "spin 1y": 0, "spin 1z": 0.6,
                 "spin 2x": 0, "spin 2y": 0, "spin 2z": -0.6,},);
 
png
## Aligned spin waveforms
In [11]:
sample_plot({"mass ratio": 1,
                 "spin 1x": 0, "spin 1y": 0, "spin 1z": 0.3,
                 "spin 2x": 0, "spin 2y": 0, "spin 2z": 0.3,},);
 
png
In [12]:
sample_plot({"mass ratio": 1,
                 "spin 1x": 0.1, "spin 1y": 0, "spin 1z": 0.3,
                 "spin 2x": 0, "spin 2y": 0, "spin 2z": 0.3,},
           surrogates=False)
 
 
png