diff --git a/examples/injection_examples/create_your_own_time_domain_source_model.py b/examples/injection_examples/create_your_own_time_domain_source_model.py index f8ebcd12b1f53fc0e0da071f0c2a2207d01a5649..11290fde30e52f9d1851654d3ffa4349f697fbe8 100644 --- a/examples/injection_examples/create_your_own_time_domain_source_model.py +++ b/examples/injection_examples/create_your_own_time_domain_source_model.py @@ -12,36 +12,39 @@ import bilby # define the time-domain model def time_domain_damped_sinusoid( - time, amplitude, damping_time, frequency, phase): + time, amplitude, damping_time, frequency, phase, t0): """ This example only creates a linearly polarised signal with only plus polarisation. """ - plus = amplitude * np.exp(-time / damping_time) *\ - np.sin(2 * np.pi * frequency * time + phase) + plus = np.zeros(len(time)) + tidx = time >= t0 + plus[tidx] = amplitude * np.exp(-(time[tidx] - t0) / damping_time) *\ + np.sin(2 * np.pi * frequency * (time[tidx] - t0) + phase) cross = np.zeros(len(time)) return {'plus': plus, 'cross': cross} # define parameters to inject. injection_parameters = dict(amplitude=5e-22, damping_time=0.1, frequency=50, - phase=0, ra=0, dec=0, psi=0, geocent_time=0.) + phase=0, ra=0, dec=0, psi=0, t0=0., geocent_time=0.) -duration = 0.5 -sampling_frequency = 2048 +duration = 1.0 +sampling_frequency = 1024 outdir = 'outdir' label = 'time_domain_source_model' # call the waveform_generator to create our waveform model. waveform = bilby.gw.waveform_generator.WaveformGenerator( duration=duration, sampling_frequency=sampling_frequency, - time_domain_source_model=time_domain_damped_sinusoid) + time_domain_source_model=time_domain_damped_sinusoid, + start_time=injection_parameters['geocent_time'] - 0.5) # inject the signal into three interferometers 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'] - 0.5) ifos.inject_signal(waveform_generator=waveform, parameters=injection_parameters)