Commit 4c6def32 authored by Colm Talbot's avatar Colm Talbot
Browse files

Rework ci

parent 0aff55b9
......@@ -13,8 +13,21 @@ stages:
- test
- deploy
# test example on Debian 8 "jessie"
exitcode-jessie:
# test example on python 2
python-2:
stage: test
image: continuumio/anaconda
before_script:
- apt install -y libgl1-mesa-glx
- pip install -r requirements.txt
- pip install lalsuite enum gwpy
script:
- python setup.py install
# Run tests without finding coverage
- for test in test/*tests.py; do python $test; done
# test example on python 3
python-3:
stage: test
image: continuumio/anaconda3
before_script:
......@@ -57,7 +70,8 @@ exitcode-jessie:
pages:
stage: deploy
dependencies:
- exitcode-jessie
- python-3
- python-2
script:
- mkdir public/
- mv htmlcov/ public/
......
......@@ -44,7 +44,8 @@ for key in ['a_1', 'a_2', 'tilt_1', 'tilt_2', 'phi_12', 'phi_jl', 'phase', 'iota
# This is still under development so care should be taken with the marginalised likelihood.
likelihood = tupak.gw.GravitationalWaveTransient(
interferometers=IFOs, waveform_generator=waveform_generator, prior=priors,
distance_marginalization=True, phase_marginalization=False)
distance_marginalization=False, phase_marginalization=True,
time_marginalization=False)
# Run sampler
result = tupak.run_sampler(likelihood=likelihood, priors=priors, sampler='dynesty',
......
......@@ -32,16 +32,17 @@ simulation_parameters = dict(
psi=2.659
)
waveform_generator = WaveformGenerator(time_duration=time_duration, sampling_frequency=sampling_frequency,
frequency_domain_source_model=tupak.gw.source.lal_binary_black_hole,
parameters=simulation_parameters)
waveform_generator = WaveformGenerator(
duration=time_duration, sampling_frequency=sampling_frequency,
frequency_domain_source_model=tupak.gw.source.lal_binary_black_hole,
parameters=simulation_parameters)
signal = waveform_generator.frequency_domain_strain()
IFO = tupak.gw.detector.get_interferometer_with_fake_noise_and_injection(name='H1', injection_polarizations=signal,
injection_parameters=simulation_parameters,
time_duration=time_duration, plot=False,
sampling_frequency=sampling_frequency)
IFO = tupak.gw.detector.get_interferometer_with_fake_noise_and_injection(
name='H1', injection_polarizations=signal,
injection_parameters=simulation_parameters, duration=time_duration,
plot=False, sampling_frequency=sampling_frequency)
hf_signal_and_noise = IFO.strain_data.frequency_domain_strain
frequencies = tupak.core.utils.create_frequency_series(
......
......@@ -44,8 +44,11 @@ class Test(unittest.TestCase):
self.dir_path + '/test/standard_data.txt').T
hf_signal_and_noise_saved = hf_real_saved + 1j * hf_imag_saved
self.assertTrue(np.array_equal(self.msd['frequencies'], frequencies_saved))
self.assertAlmostEqual(all(self.msd['hf_signal_and_noise'] - hf_signal_and_noise_saved), 0.00000000, 5)
self.assertTrue(np.array_equal(
self.msd['frequencies'], frequencies_saved))
self.assertAlmostEqual(all(
self.msd['hf_signal_and_noise'] - hf_signal_and_noise_saved),
0.00000000, 5)
def test_recover_luminosity_distance(self):
likelihood = tupak.gw.likelihood.GravitationalWaveTransient(
......@@ -61,8 +64,9 @@ class Test(unittest.TestCase):
result = tupak.core.sampler.run_sampler(
likelihood, priors, sampler='dynesty', verbose=False, npoints=100)
self.assertAlmostEqual(np.mean(result.samples), dL,
delta=3*np.std(result.samples))
self.assertAlmostEqual(
np.mean(result.posterior.luminosity_distance), dL,
delta=3*np.std(result.posterior.luminosity_distance))
if __name__ == '__main__':
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment