def getswigrow(self, glue_row): """Translates glue row from the table to libmetaio row""" import lalmetaio as lmt swigrow = lmt.SimInspiralTable() for simattr in lsctables.SimInspiralTable.validcolumns.keys(): if simattr in ["waveform", "source", "numrel_data", "taper"]: setattr(swigrow, simattr, str(getattr(glue_row, simattr))) else: setattr(swigrow, simattr, getattr(glue_row, simattr)) swigrow.geocent_end_time.gpsNanoSeconds = glue_row.geocent_end_time_ns return swigrow
def get_eff_dist(detector, ra, dec, inclination, polarization, epoch, gmst): sim_inspiral = lalmetaio.SimInspiralTable() sim_inspiral.distance = 1 sim_inspiral.longitude = ra sim_inspiral.latitude = dec sim_inspiral.inclination = inclination sim_inspiral.polarization = polarization sim_inspiral.geocent_end_time = epoch sim_inspiral.end_time_gmst = gmst _ = lal.LIGOTimeGPS() _, eff_dist = lalinspiral.InspiralSiteTimeAndDist(sim_inspiral, detector, _) return eff_dist
def _get_waveform_from_inspiral(**p): import lalmetaio # prefix with 'Inspiral-' name = p['approximant'][9:] if name.startswith('EOB'): p['phase_order'] = -8 params = lalmetaio.SimInspiralTable() params.waveform = name + string_from_order[p['phase_order']] params.mass1 = p['mass1'] params.mass2 = p['mass2'] params.f_lower = p['f_lower'] params.spin1x = p['spin1x'] params.spin1y = p['spin1y'] params.spin1z = p['spin1z'] params.spin2x = p['spin2x'] params.spin2y = p['spin2y'] params.spin2z = p['spin2z'] params.inclination = p['inclination'] params.distance = p['distance'] params.coa_phase = p['coa_phase'] guess_length = lalinspiral.FindChirpChirpTime(params.mass1, params.mass2, params.f_lower, 7) guess_length = max(guess_length, 3) params.geocent_end_time = guess_length * 1.5 params.taper = 'TAPER_NONE' #FIXME - either explain or don't hardcode this bufferl = guess_length * 2 dt = p['delta_t'] df = 1.0 / bufferl sample_rate = int(1.0 / dt) epoch = lal.LIGOTimeGPS(0, 0) N = bufferl * sample_rate n = N / 2 + 1 resp = FrequencySeries(zeros(n), delta_f=df, epoch=epoch, dtype=complex64) + 1 out = TimeSeries(zeros(N), delta_t=dt, epoch=epoch, dtype=float32) outl = out.lal() outl.sampleUnits = lal.ADCCountUnit out2 = TimeSeries(zeros(N), delta_t=dt, epoch=epoch, dtype=float32) outl2 = out.lal() outl2.sampleUnits = lal.ADCCountUnit respl = resp.lal() respl.sampleUnits = lal.DimensionlessUnit lalinspiral.FindChirpInjectSignals(outl, params, respl) params.coa_phase -= lal.PI / 4 lalinspiral.FindChirpInjectSignals(outl2, params, respl) seriesp = TimeSeries(outl.data.data, delta_t=dt, epoch=epoch - params.geocent_end_time) seriesc = TimeSeries(outl2.data.data, delta_t=dt, epoch=epoch - params.geocent_end_time) return seriesp, seriesc