Skip to content
Snippets Groups Projects
Commit 57090900 authored by Gregory Ashton's avatar Gregory Ashton Committed by Colm Talbot
Browse files

Adds more example tests to the CI

parent 502cc09c
No related branches found
No related tags found
No related merge requests found
......@@ -20,6 +20,7 @@ python-2:
before_script:
- apt install -y libgl1-mesa-glx
- pip install -r requirements.txt
- pip install -r optional_requirements.txt
- pip install lalsuite enum gwpy
script:
- python setup.py install
......@@ -34,6 +35,7 @@ python-3:
- sed -i '/lalsuite/d' requirements.txt
- apt install -y libgl1-mesa-glx
- pip install -r requirements.txt
- pip install -r optional_requirements.txt
- pip install 'coverage>=4.5'
- pip install coverage-badge
script:
......@@ -53,6 +55,7 @@ python-3:
- coverage-badge -o coverage_badge.svg -f
# Run all other tests (no coverage data collected)
- python test/example_tests.py
- python test/gw_example_tests.py
- python test/noise_realisation_tests.py
# Make the documentation
......
......@@ -42,11 +42,16 @@ waveform_generator = tupak.gw.WaveformGenerator(
parameters=injection_parameters, waveform_arguments=waveform_arguments)
hf_signal = waveform_generator.frequency_domain_strain()
# Set up interferometers. In this case we'll use three interferometers (LIGO-Hanford (H1), LIGO-Livingston (L1),
# and Virgo (V1)). These default to their design sensitivity
IFOs = [tupak.gw.detector.get_interferometer_with_fake_noise_and_injection(
name, injection_polarizations=hf_signal, injection_parameters=injection_parameters, duration=duration,
sampling_frequency=sampling_frequency, outdir=outdir) for name in ['H1', 'L1']]
# Set up interferometers. In this case we'll use two interferometers
# (LIGO-Hanford (H1), LIGO-Livingston (L1). These default to their design
# sensitivity
IFOs = []
for name in ["H1", "L1"]:
IFOs.append(
tupak.gw.detector.get_interferometer_with_fake_noise_and_injection(
name, injection_polarizations=hf_signal,
injection_parameters=injection_parameters, duration=duration,
sampling_frequency=sampling_frequency, outdir=outdir))
# Set up prior, which is a dictionary
# By default we will sample all terms in the signal models. However, this will take a long time for the calculation,
......@@ -63,7 +68,7 @@ for key in ['a_1', 'a_2', 'tilt_1', 'tilt_2', 'phi_12', 'phi_jl', 'psi', 'ra', '
priors[key] = injection_parameters[key]
# Initialise the likelihood by passing in the interferometer data (IFOs) and the waveoform generator
likelihood = tupak.GravitationalWaveTransient(interferometers=IFOs, waveform_generator=waveform_generator,
likelihood = tupak.gw.GravitationalWaveTransient(interferometers=IFOs, waveform_generator=waveform_generator,
time_marginalization=False, phase_marginalization=False,
distance_marginalization=False, prior=priors)
......
......@@ -29,9 +29,13 @@ waveform_generator = tupak.gw.WaveformGenerator(
hf_signal = waveform_generator.frequency_domain_strain()
# Set up interferometers.
IFOs = [tupak.gw.detector.get_interferometer_with_fake_noise_and_injection(
name, injection_polarizations=hf_signal, injection_parameters=injection_parameters, duration=duration,
sampling_frequency=sampling_frequency, outdir=outdir) for name in ['H1', 'L1', 'V1']]
IFOs = []
for name in ["H1", "L1", "V1"]:
IFOs.append(
tupak.gw.detector.get_interferometer_with_fake_noise_and_injection(
name, injection_polarizations=hf_signal,
injection_parameters=injection_parameters, duration=duration,
sampling_frequency=sampling_frequency, outdir=outdir))
# Set up prior
priors = tupak.gw.prior.BBHPriorSet()
......
......@@ -44,6 +44,7 @@ class Test(unittest.TestCase):
def test_examples(self):
""" Loop over examples to check they run """
examples = ['examples/other_examples/linear_regression.py',
'examples/other_examples/linear_regression_unknown_noise.py',
]
for filename in examples:
print("Testing {}".format(filename))
......
......@@ -43,10 +43,9 @@ class Test(unittest.TestCase):
def test_examples(self):
""" Loop over examples to check they run """
examples = ['examples/injection_examples/change_sampled_parameters.py',
examples = ['examples/injection_examples/basic_tutorial.py',
'examples/injection_examples/marginalized_likelihood.py',
'examples/injection_examples/create_your_own_time_domain_source_model.py',
'examples/other_examples/linear_regression.py',
'examples/open_data_examples/GW150914.py',
]
for filename in examples:
print("Testing {}".format(filename))
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment