|
# Simulated data
|
|
# Simulated data
|
|
|
|
|
|
This documents the set of tests made on simulated data
|
|
To validate that `pbilby` produces results consistent with `bilby`, we run a specialised test in which both are run on the same set of input data. The data is generated using the advanced LIGO PSD stored within bilby. Below we list the required scripts to generate the data and run with bilby and with parallel bilby.
|
|
|
|
|
|
| test | notes | contact | reviewer | status | comment |
|
|
## Scripts
|
|
| ------ | ------ | ------ | ------ | ------ | ------ |
|
|
|
|
| [run 07](O3 review/simulated_data/run07) | SNR~20 IMRPhenomPv2 4s| @gregory.ashton | | :construction: | | |
|
### `common_vals.py`
|
|
\ No newline at end of file |
|
|
|
|
|
```python
|
|
|
|
import bilby
|
|
|
|
from bilby.gw.conversion import convert_to_lal_binary_black_hole_parameters
|
|
|
|
|
|
|
|
duration = 4.
|
|
|
|
sampling_frequency = 2**14.
|
|
|
|
minimum_frequency = 20
|
|
|
|
maximum_frequency = 2048
|
|
|
|
roll_off = 0.4
|
|
|
|
outdir = 'outdir'
|
|
|
|
bilby.core.utils.check_directory_exists_and_if_not_mkdir(outdir)
|
|
|
|
|
|
|
|
injection_parameters = dict(
|
|
|
|
chirp_mass=33., mass_ratio=1.0, a_1=0.3, a_2=0.4, tilt_1=1.2, tilt_2=0.9,
|
|
|
|
phi_12=0.25, phi_jl=0.9, luminosity_distance=2000, theta_jn=0.4, psi=2.659,
|
|
|
|
phase=1.3, geocent_time=0, ra=1.3, dec=0.7)
|
|
|
|
|
|
|
|
waveform_arguments = dict(waveform_approximant='IMRPhenomPv2',
|
|
|
|
reference_frequency=100.)
|
|
|
|
|
|
|
|
waveform_generator = bilby.gw.waveform_generator.WaveformGenerator(
|
|
|
|
sampling_frequency=sampling_frequency, duration=duration,
|
|
|
|
frequency_domain_source_model=bilby.gw.source.lal_binary_black_hole,
|
|
|
|
parameter_conversion=convert_to_lal_binary_black_hole_parameters,
|
|
|
|
waveform_arguments=waveform_arguments)
|
|
|
|
```
|
|
|
|
|
|
|
|
### `create_data.py`
|
|
|
|
```python
|
|
|
|
"""
|
|
|
|
Script to create the data
|
|
|
|
"""
|
|
|
|
import os
|
|
|
|
import bilby
|
|
|
|
import numpy as np
|
|
|
|
from gwpy.timeseries import TimeSeries
|
|
|
|
|
|
|
|
from common_vals import (waveform_generator, sampling_frequency,
|
|
|
|
injection_parameters, duration, outdir)
|
|
|
|
|
|
|
|
np.random.seed(151226)
|
|
|
|
|
|
|
|
detectors = ["H1", "L1"]
|
|
|
|
ifos = bilby.gw.detector.InterferometerList(detectors)
|
|
|
|
ifos.set_strain_data_from_power_spectral_densities(
|
|
|
|
sampling_frequency=sampling_frequency, duration=duration,
|
|
|
|
start_time=injection_parameters['geocent_time'] - 2)
|
|
|
|
ifos.inject_signal(waveform_generator=waveform_generator,
|
|
|
|
parameters=injection_parameters)
|
|
|
|
|
|
|
|
for ifo in ifos:
|
|
|
|
filename = f"{outdir}/{ifo.name}.txt"
|
|
|
|
if os.path.exists(filename) is False:
|
|
|
|
data = TimeSeries(
|
|
|
|
ifo.time_domain_strain, times=ifo.time_array)
|
|
|
|
data.write(filename)
|
|
|
|
```
|
|
|
|
|
|
|
|
### `prior.prior`
|
|
|
|
```python
|
|
|
|
chirp_mass = Uniform(25, 100, "chirp_mass")
|
|
|
|
mass_ratio = Uniform(0.125, 1, "mass_ratio")
|
|
|
|
geocent_time = Uniform(-0.1, 0.1, "geocent_time")
|
|
|
|
phase = Uniform(0, 2 * np.pi, "phase", boundary="periodic")
|
|
|
|
luminosity_distance = Uniform(50, 10000, "luminosity_distance")
|
|
|
|
dec = Cosine(name='dec')
|
|
|
|
ra = Uniform(name='ra', minimum=0, maximum=2 * np.pi, boundary='periodic')
|
|
|
|
theta_jn = Sine(name='theta_jn')
|
|
|
|
psi = Uniform(name='psi', minimum=0, maximum=np.pi, boundary='periodic')
|
|
|
|
phase = Uniform(name='phase', minimum=0, maximum=2 * np.pi, boundary='periodic')
|
|
|
|
a_1 = Uniform(name='a_1', minimum=0, maximum=0.99)
|
|
|
|
a_2 = Uniform(name='a_2', minimum=0, maximum=0.99)
|
|
|
|
tilt_1 = Sine(name='tilt_1')
|
|
|
|
tilt_2 = Sine(name='tilt_2')
|
|
|
|
phi_12 = Uniform(name='phi_12', minimum=0, maximum=2 * np.pi, boundary='periodic')
|
|
|
|
phi_jl = Uniform(name='phi_jl', minimum=0, maximum=2 * np.pi, boundary='periodic')
|
|
|
|
```
|
|
|
|
|
|
|
|
### `run_bilby.py`
|
|
|
|
```python
|
|
|
|
#!/usr/bin/env python
|
|
|
|
import bilby
|
|
|
|
from gwpy.timeseries import TimeSeries
|
|
|
|
import sys
|
|
|
|
|
|
|
|
from common_vals import (outdir, sampling_frequency, minimum_frequency,
|
|
|
|
maximum_frequency, roll_off, waveform_generator)
|
|
|
|
|
|
|
|
label = "using_bilby_" + sys.argv[1]
|
|
|
|
|
|
|
|
detectors = ["H1", "L1"]
|
|
|
|
read_ifos = bilby.gw.detector.InterferometerList([])
|
|
|
|
for det in detectors:
|
|
|
|
ifo = bilby.gw.detector.get_empty_interferometer(det)
|
|
|
|
filename = f"{outdir}/{det}.txt"
|
|
|
|
data = TimeSeries.read(filename)
|
|
|
|
|
|
|
|
data = data.resample(sampling_frequency)
|
|
|
|
print(f"Data for {det} from {data.times[0]} to {data.times[-1]}")
|
|
|
|
ifo.strain_data.minimum_frequency = minimum_frequency
|
|
|
|
ifo.strain_data.maximum_frequency = maximum_frequency
|
|
|
|
ifo.strain_data.roll_off = roll_off
|
|
|
|
ifo.strain_data.set_from_gwpy_timeseries(data)
|
|
|
|
read_ifos.append(ifo)
|
|
|
|
|
|
|
|
read_ifos.plot_data(outdir=outdir)
|
|
|
|
|
|
|
|
priors = bilby.prior.PriorDict("prior.prior")
|
|
|
|
|
|
|
|
likelihood = bilby.gw.likelihood.GravitationalWaveTransient(
|
|
|
|
interferometers=read_ifos, waveform_generator=waveform_generator,
|
|
|
|
time_marginalization=True, phase_marginalization=True,
|
|
|
|
distance_marginalization=True, priors=priors, jitter_time=True)
|
|
|
|
|
|
|
|
result = bilby.core.sampler.run_sampler(
|
|
|
|
likelihood=likelihood, priors=priors, sampler='dynesty', outdir=outdir,
|
|
|
|
label=label,
|
|
|
|
conversion_function=bilby.gw.conversion.generate_all_bbh_parameters,
|
|
|
|
nlive=1000)
|
|
|
|
```
|
|
|
|
|
|
|
|
### `parallel.ini`
|
|
|
|
```
|
|
|
|
label = 09_parallel
|
|
|
|
outdir = outdir
|
|
|
|
|
|
|
|
trigger-time = 0
|
|
|
|
duration = 4
|
|
|
|
|
|
|
|
psd_dict = {H1=aLIGO_ZERO_DET_high_P_psd.txt, L1=aLIGO_ZERO_DET_high_P_psd.txt}
|
|
|
|
data_dict = {H1=outdir/H1.txt, L1=outdir/L1.txt}
|
|
|
|
prior-file = prior.prior
|
|
|
|
waveform_approximant = IMRPhenomPv2
|
|
|
|
sampling-frequency = 16384
|
|
|
|
minimum-frequency = 20
|
|
|
|
maximum-frequency = 2048
|
|
|
|
reference-frequency = 100
|
|
|
|
|
|
|
|
time-marginalization = True
|
|
|
|
phase-marginalization = True
|
|
|
|
distance-marginalization = True
|
|
|
|
```
|
|
|
|
|
|
|
|
## Running the scripts
|
|
|
|
|
|
|
|
* First run the `create_data.py` script to generate the data
|
|
|
|
* To run `bilby`, run `run_bilby.py`
|
|
|
|
* To run `pbilby`, we first run `parallel_bilby_generation parallel.ini` and then submit the job in the usual way
|
|
|
|
|
|
|
|
## Summary Pages
|
|
|
|
* [PESummary page comparison](https://ldas-jobs.ligo.caltech.edu/~gregory.ashton/parallel_bilby/bilby_comparison/bilby_comparison_10/comparison/home.html)
|
|
|
|
* [PESummary page: all plots in one](https://ldas-jobs.ligo.caltech.edu/~gregory.ashton/parallel_bilby/bilby_comparison/bilby_comparison_10/comparison/plots)
|
|
|
|
|
|
|
|
## Selected comparisons
|
|
|
|
|
|
|
|
### Masses
|
|
|
|

|
|
|
|
|
|
|
|
### Spins
|
|
|
|

|
|
|
|
|
|
|
|
### Others
|
|
|
|

|
|
|
|
|
|
|
|
### SNRs
|
|
|
|
 |
|
|
|
\ No newline at end of file |