Skip to content
Snippets Groups Projects
Commit e2601cbc authored by Colm Talbot's avatar Colm Talbot
Browse files

flake examples

parent de0704cf
No related branches found
No related tags found
1 merge request!228Update examples
Pipeline #33244 failed
......@@ -31,7 +31,7 @@ sigma = 1
# contents of the injection_parameters when calling the model function.
sampling_frequency = 10
time_duration = 10
time = np.arange(0, time_duration, 1/sampling_frequency)
time = np.arange(0, time_duration, 1 / sampling_frequency)
N = len(time)
data = model(time, **injection_parameters) + np.random.normal(0, sigma, N)
......
......@@ -84,8 +84,8 @@ class Polynomial(bilby.Likelihood):
def log_likelihood(self):
res = self.y - self.polynomial(self.x, self.parameters)
return -0.5 * (np.sum((res / self.sigma)**2)
+ self.N*np.log(2*np.pi*self.sigma**2))
return -0.5 * (np.sum((res / self.sigma)**2) +
self.N * np.log(2 * np.pi * self.sigma**2))
def fit(n):
......
......@@ -45,8 +45,8 @@ def decay_rate(delta_t, halflife, n_init):
n_atoms = n_init * atto * n_avogadro
rates = (np.exp(-np.log(2) * (times[:-1] / halflife))
- np.exp(- np.log(2) * (times[1:] / halflife))) * n_atoms / delta_t
rates = (np.exp(-np.log(2) * (times[:-1] / halflife)) -
np.exp(- np.log(2) * (times[1:] / halflife))) * n_atoms / delta_t
return rates
......
......@@ -45,7 +45,7 @@ waveform_generator = bilby.gw.waveform_generator.WaveformGenerator(
ifos = bilby.gw.detector.InterferometerList(['H1', 'L1'])
ifos.set_strain_data_from_power_spectral_densities(
sampling_frequency=sampling_frequency, duration=duration,
start_time=injection_parameters['geocent_time']-3)
start_time=injection_parameters['geocent_time'] - 3)
ifos.inject_signal(waveform_generator=waveform_generator,
parameters=injection_parameters)
......
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