Commit dafb85cb authored by Gregory Ashton's avatar Gregory Ashton

Merge branch 'master' of git.ligo.org:Monash/peyote

parents 2cc59af8 ec23d78c
Pipeline #15771 failed with stages
in 51 seconds
from __future__ import division, print_function
import numpy as np
import logging
import os
from scipy.interpolate import interp1d
import peyote
......@@ -146,16 +147,20 @@ class Interferometer:
:param from_power_spectral_density: flag, use IFO's PSD object to generate noise
:param frequency_domain_strain: frequency-domain strain, requires frequencies is also specified
"""
frequencies = []
if from_power_spectral_density is not None:
frequency_domain_strain, frequencies = self.power_spectral_density.get_noise_realisation(sampling_frequency,
duration)
if frequency_domain_strain is not None:
logging.info(
'Setting {} data using provided frequency_domain_strain'
.format(self.name))
frequencies = peyote.utils.create_fequency_series(sampling_frequency, duration)
elif frequency_domain_strain is None:
print("No method provided.")
return
elif from_power_spectral_density is not None:
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)
else:
raise ValueError("No method to set data provided.")
self.data = frequency_domain_strain
self.frequency_array = frequencies
......
......@@ -19,9 +19,8 @@ class Source:
self.time_duration = time_duration
self.time_array = peyote.utils.create_time_series(
sampling_frequency, time_duration)
self.nsamples = len(self.time_array)
self.frequency_array = np.fft.rfftfreq(
self.nsamples, 1/self.sampling_frequency)
self.frequency_array = peyote.utils.create_fequency_series(
sampling_frequency, time_duration)
class SimpleSinusoidSource(Source):
......
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