def get_nrsur_modes(**params): """Generates NRSurrogate waveform mode-by-mode. All waveform parameters should be provided as keyword arguments. Recognized parameters are listed below. Unrecognized arguments are ignored. Parameters ---------- template: object An object that has attached properties. This can be used to substitute for keyword arguments. A common example would be a row in an xml table. approximant : str The approximant to generate. Must be one of the ``NRSur*`` models. {delta_t} {mass1} {mass2} {spin1x} {spin1y} {spin1z} {spin2x} {spin2y} {spin2z} {f_lower} {f_ref} {distance} {mode_array} Returns ------- dict : Dictionary of ``(l, m)`` -> ``(h_+, -h_x)`` ``TimeSeries``. """ laldict = _check_lal_pars(params) ret = lalsimulation.SimInspiralPrecessingNRSurModes( params['delta_t'], params['mass1']*lal.MSUN_SI, params['mass2']*lal.MSUN_SI, params['spin1x'], params['spin1y'], params['spin1z'], params['spin2x'], params['spin2y'], params['spin2z'], params['f_lower'], params['f_ref'], params['distance']*1e6*lal.PC_SI, laldict, getattr(lalsimulation, params['approximant']) ) hlms = {} while ret: hlm = TimeSeries(ret.mode.data.data, delta_t=ret.mode.deltaT, epoch=ret.mode.epoch) hlms[ret.l, ret.m] = (hlm.real(), hlm.imag()) ret = ret.next return hlms
def test_waveform(**args): flow = args['f_lower'] # Required parameter dt = args['delta_t'] # Required parameter fpeak = args['fpeak'] # A new parameter for my model t = numpy.arange(0, 10, dt) f = t / t.max() * (fpeak - flow) + flow a = t wf = numpy.exp(2.0j * numpy.pi * f * t) * a # Return product should be a pycbc time series in this case for # each GW polarization # # # Note that by convention, the time at 0 is a fiducial reference. # For CBC waveforms, this would be set to where the merger occurs offset = -len(t) * dt wf = TimeSeries(wf, delta_t=dt, epoch=offset) return wf.real(), wf.imag()