Skip to content
Snippets Groups Projects
Commit 8e9a3047 authored by Gregory Ashton's avatar Gregory Ashton
Browse files

Adds the sampling frequency and duration as interferometer attributes

- This simplifies the way things are passed around
- Also fixes the spelling mistake of "interferometer" (my bad)
parent 43e401d2
No related branches found
No related tags found
1 merge request!29Adds the sampling frequency and duration as interferometer attributes
Pipeline #
......@@ -49,6 +49,8 @@ class Interferometer(object):
self.power_spectral_density = power_spectral_density
self.data = np.array([])
self.frequency_array = []
self.sampling_frequency = None
self.duration = None
@property
def latitude(self):
......@@ -292,11 +294,14 @@ class Interferometer(object):
logging.info(
'Setting {} data using noise realization from provided'
'power_spectal_density'.format(self.name))
frequency_domain_strain, frequencies = self.power_spectral_density.get_noise_realisation(sampling_frequency,
duration)
frequency_domain_strain, frequencies = \
self.power_spectral_density.get_noise_realisation(
sampling_frequency, duration)
else:
raise ValueError("No method to set data provided.")
self.sampling_frequency = sampling_frequency
self.duration = duration
self.data = frequency_domain_strain
self.frequency_array = frequencies
......@@ -474,7 +479,7 @@ V1 = get_empty_interferometer('V1')
GEO600 = get_empty_interferometer('GEO600')
def get_inteferometer(
def get_interferometer(
name, center_time, T=4, alpha=0.25, psd_offset=-1024, psd_duration=100,
cache=True, outdir='outdir', plot=True, filter_freq=1024,
raw_data_file=None, **kwargs):
......@@ -572,10 +577,10 @@ def get_inteferometer(
ax.legend(loc='best')
fig.savefig('{}/{}_frequency_domain_data.png'.format(outdir, name))
return interferometer, sampling_frequency, time_duration
return interferometer
def get_inteferometer_with_fake_noise_and_injection(
def get_interferometer_with_fake_noise_and_injection(
name, injection_polarizations, injection_parameters, sampling_frequency=4096, time_duration=4,
outdir='outdir', plot=True, save=True):
"""
......
......@@ -29,7 +29,7 @@ waveform_generator = tupak.waveform_generator.WaveformGenerator(
hf_signal = waveform_generator.frequency_domain_strain()
# Set up interferometers.
IFOs = [tupak.detector.get_inteferometer_with_fake_noise_and_injection(
IFOs = [tupak.detector.get_interferometer_with_fake_noise_and_injection(
name, injection_polarizations=hf_signal, injection_parameters=injection_parameters, time_duration=time_duration,
sampling_frequency=sampling_frequency, outdir=outdir) for name in ['H1', 'L1', 'V1']]
......
......@@ -14,8 +14,8 @@ outdir = 'outdir'
label = 'GW150914'
time_of_event = 1126259462.422
H1, sampling_frequency, time_duration = tupak.detector.get_inteferometer('H1', time_of_event, version=1, outdir=outdir)
L1, _, _ = tupak.detector.get_inteferometer('L1', time_of_event, version=1, outdir=outdir)
H1 = tupak.detector.get_interferometer('H1', time_of_event, version=1, outdir=outdir)
L1 = tupak.detector.get_interferometer('L1', time_of_event, version=1, outdir=outdir)
interferometers = [H1, L1]
# Define the prior
......@@ -27,7 +27,7 @@ prior['luminosity_distance'] = tupak.prior.PowerLaw(alpha=2, minimum=100, maximu
# Create the waveform generator
waveform_generator = tupak.waveform_generator.WaveformGenerator(
tupak.source.lal_binary_black_hole, sampling_frequency, time_duration,
tupak.source.lal_binary_black_hole, H1.sampling_frequency, H1.duration,
parameters={'waveform_approximant': 'IMRPhenomPv2', 'reference_frequency': 50})
# Define a likelihood
......
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