def get_param(par, args, m1, m2, s1z, s2z): """ Helper function Parameters ---------- par : string Name of parameter to calculate args : Namespace object returned from ArgumentParser instance Calling code command line options, used for f_lower value m1 : float or array of floats First binary component mass (etc.) Returns ------- parvals : float or array of floats Calculated parameter values """ if par == 'mchirp': parvals, _ = pnutils.mass1_mass2_to_mchirp_eta(m1, m2) elif par == 'mtotal': parvals = m1 + m2 elif par == 'template_duration': # default to SEOBNRv4 duration function parvals = pnutils.get_imr_duration(m1, m2, s1z, s2z, args.f_lower, args.approximant or "SEOBNRv4") if args.min_duration: parvals += args.min_duration elif par in pnutils.named_frequency_cutoffs.keys(): parvals = pnutils.frequency_cutoff_from_name(par, m1, m2, s1z, s2z) else: # try asking for a LALSimulation frequency function parvals = pnutils.get_freq(par, m1, m2, s1z, s2z) return parvals
def get_param(par, args, m1, m2, s1z, s2z): """ Helper function Parameters ---------- par : string Name of parameter to calculate args : Namespace object returned from ArgumentParser instance Calling code command line options, used for f_lower value m1 : float or array of floats First binary component mass (etc.) Returns ------- parvals : float or array of floats Calculated parameter values """ if par == 'mchirp': parvals = conversions.mchirp_from_mass1_mass2(m1, m2) elif par == 'mtotal': parvals = m1 + m2 elif par == 'eta': parvals = conversions.eta_from_mass1_mass2(m1, m2) elif par in ['chi_eff', 'effective_spin']: parvals = conversions.chi_eff(m1, m2, s1z, s2z) elif par == 'template_duration': # default to SEOBNRv4 duration function if not hasattr(args, 'approximant') or args.approximant is None: args.approximant = "SEOBNRv4" parvals = pnutils.get_imr_duration(m1, m2, s1z, s2z, args.f_lower, args.approximant) if args.min_duration: parvals += args.min_duration elif par == 'tau0': parvals = conversions.tau0_from_mass1_mass2(m1, m2, args.f_lower) elif par == 'tau3': parvals = conversions.tau3_from_mass1_mass2(m1, m2, args.f_lower) elif par in pnutils.named_frequency_cutoffs.keys(): parvals = pnutils.frequency_cutoff_from_name(par, m1, m2, s1z, s2z) else: # try asking for a LALSimulation frequency function parvals = pnutils.get_freq(par, m1, m2, s1z, s2z) return parvals
def f_seobnrv4_peak(self): return pnutils.get_freq('fSEOBNRv4Peak', self.mass1, self.mass2, self.spin1z, self.spin2z)
def f_seobnrv2_peak(self): return pnutils.get_freq("fSEOBNRv2Peak", self.mass1, self.mass2, self.spin1z, self.spin2z)
""" xmldoc = ligolw.Document() xmldoc.appendChild(ligolw.LIGO_LW()) for table in tables: xmldoc.childNodes[0].appendChild(table) return xmldoc input_bank = 'H1L1-UBERBANK_MAXM100_NS0p05_ER8HMPSD-1126033217-223200.xml.gz' output_bank = 'H1L1-EDGEBIN_FROM_UBERBANK_ER8HMPSD-1126033217-223200.xml.gz' xmldoc = utils.load_filename(input_bank, contenthandler=LIGOLWContentHandler, gz=True) all_templates = table.get_table(xmldoc, 'sngl_inspiral') # get the other tables that are in the document other_table_names = [y.Name for y in xmldoc.childNodes[0].getElements( lambda x: x.tagName == ligolw.Table.tagName) if y.Name != u'sngl_inspiral'] other_tables = [table.get_table(xmldoc, x) for x in other_table_names] keep_templates = lsctables.New(lsctables.SnglInspiralTable) # only add templates that fall in the edge bin for tmplt in all_templates: mchirp = pnutils.mass1_mass2_to_mchirp_eta(tmplt.mass1, tmplt.mass2)[0] peakfreq = pnutils.get_freq('fSEOBNRv2Peak', tmplt.mass1, tmplt.mass2, tmplt.spin1z, tmplt.spin2z) if mchirp >= 1.74 and peakfreq < 220.: keep_templates.append(tmplt) outdoc = create_xmldoc(other_tables + [keep_templates]) utils.write_filename(outdoc, output_bank, gz=True)