if opts.verbose: print "generating white noise (in the freq domain)" (freqs, wFreqDom), (times, wTimeDom) = waveforms.whiteNoise( opts.duration, opts.sampling_rate ) # if opts.verbose: # print "generating white noise (in the time domain)" # timesT, wTimeDomT = waveforms.whiteNoiseT( opts.duration, opts.sampling_rate ) # wFreqDomT = np.fft.fftshift( np.fft.fft( wTimeDomT ) )/opts.sampling_rate #------------------------------------------------- to = max(opts.duration-3*opts.tau, opts.duration/2) if opts.verbose: print "generating injection with to=%.3f"%(to) hTimeDom = waveforms.chirpSineGaussianT( times, 1.0, opts.freq, opts.freqDot, opts.tau, to ) hFreqDom = waveforms.chirpSineGaussianF( freqs, 1.0, opts.freq, opts.freqDot, opts.tau, to ) #------------------------------------------------- if opts.verbose: print "computing optimal SNR and scaling injection" ### for white-gaussian noise with unit-variance in the frequency domain snr = ( 2 * np.sum( hFreqDom.real**2 + hFreqDom.imag**2 ) / opts.duration )**0.5 scaling = opts.SNR/snr hTimeDom *= scaling hFreqDom *= scaling #------------------------------------------------- if opts.verbose:
#------------------------------------------------- if opts.verbose: print "generating white noise (in the freq domain)" (freqs, wFreqDom1), (times, wTimeDom1) = waveforms.whiteNoise( opts.duration, opts.sampling_rate ) (freqs, wFreqDom2), (times, wTimeDom2) = waveforms.whiteNoise( opts.duration, opts.sampling_rate ) #------------------------------------------------- dt = opts.D_over_c * np.cos( opts.theta*np.pi/180 ) to = opts.duration/2 if opts.verbose: print "generating injection with to=%.3f"%(to) hTimeDom1 = waveforms.chirpSineGaussianT( times, 1.0, opts.freq, opts.freqDot, opts.tau, to+dt/2 ) hFreqDom1 = waveforms.chirpSineGaussianF( freqs, 1.0, opts.freq, opts.freqDot, opts.tau, to+dt/2 ) hTimeDom2 = waveforms.chirpSineGaussianT( times, 1.0, opts.freq, opts.freqDot, opts.tau, to-dt/2 ) hFreqDom2 = waveforms.chirpSineGaussianF( freqs, 1.0, opts.freq, opts.freqDot, opts.tau, to-dt/2 ) #------------------------------------------------- if opts.verbose: print "computing optimal SNR and scaling injection" ### for white-gaussian noise with unit-variance in the frequency domain snr = ( 2 * np.sum( hFreqDom1.real**2 + hFreqDom1.imag**2 + hFreqDom2.real**2 + hFreqDom2.imag**2 ) / opts.duration )**0.5 scaling = opts.SNR/snr hTimeDom1 *= scaling hFreqDom1 *= scaling hTimeDom2 *= scaling
wTimeDom) = waveforms.whiteNoise(opts.duration, opts.sampling_rate) # if opts.verbose: # print "generating white noise (in the time domain)" # timesT, wTimeDomT = waveforms.whiteNoiseT( opts.duration, opts.sampling_rate ) # wFreqDomT = np.fft.fftshift( np.fft.fft( wTimeDomT ) )/opts.sampling_rate #------------------------------------------------- to = max(opts.duration - 3 * opts.tau, opts.duration / 2) if opts.verbose: print "generating injection with to=%.3f" % (to) hTimeDom = waveforms.chirpSineGaussianT(times, 1.0, opts.freq, opts.freqDot, opts.tau, to) hFreqDom = waveforms.chirpSineGaussianF(freqs, 1.0, opts.freq, opts.freqDot, opts.tau, to) #------------------------------------------------- if opts.verbose: print "computing optimal SNR and scaling injection" ### for white-gaussian noise with unit-variance in the frequency domain snr = (2 * np.sum(hFreqDom.real**2 + hFreqDom.imag**2) / opts.duration)**0.5 scaling = opts.SNR / snr hTimeDom *= scaling hFreqDom *= scaling #------------------------------------------------- if opts.verbose:
wTimeDom1) = waveforms.whiteNoise(opts.duration, opts.sampling_rate) (freqs, wFreqDom2), (times, wTimeDom2) = waveforms.whiteNoise(opts.duration, opts.sampling_rate) #------------------------------------------------- dt = opts.D_over_c * np.cos(opts.theta * np.pi / 180) to = opts.duration / 2 if opts.verbose: print "generating injection with to=%.3f" % (to) hTimeDom1 = waveforms.chirpSineGaussianT(times, 1.0, opts.freq, opts.freqDot, opts.tau, to + dt / 2) hFreqDom1 = waveforms.chirpSineGaussianF(freqs, 1.0, opts.freq, opts.freqDot, opts.tau, to + dt / 2) hTimeDom2 = waveforms.chirpSineGaussianT(times, 1.0, opts.freq, opts.freqDot, opts.tau, to - dt / 2) hFreqDom2 = waveforms.chirpSineGaussianF(freqs, 1.0, opts.freq, opts.freqDot, opts.tau, to - dt / 2) #------------------------------------------------- if opts.verbose: print "computing optimal SNR and scaling injection" ### for white-gaussian noise with unit-variance in the frequency domain snr = (2 * np.sum(hFreqDom1.real**2 + hFreqDom1.imag**2 + hFreqDom2.real**2 + hFreqDom2.imag**2) / opts.duration)**0.5 scaling = opts.SNR / snr