Example #1
0
def transform_m1m2_mceta(m1, m2):
    return lalsimutils.Mceta(m1, m2)
Example #2
0
required_params = ("mass1", "mass2", "spin1x", "spin1y", "spin1z", "spin2x",
                   "spin2y", "spin2z")
# lalapps_tmpltbank assigns 0 ID to all events, so we remap
# FIXME: Check for tmplt_bank: All others do assign IDs
for tmplt in tmplt_bank:
    if not args.no_overwrite_id:
        try:
            tmplt.event_id = tmplt_bank.get_next_id()
        except AttributeError:
            tmplt.simulation_id = tmplt_bank.get_next_id()
    for p in required_params:
        if not hasattr(tmplt, p):
            setattr(tmplt, p, 0.0)
    if not hasattr(tmplt, "mchirp"):
        tmplt.mchirp, tmplt.eta = lalsimutils.Mceta(tmplt.mass1, tmplt.mass2)

# FIXME: Unhardcode
wtype = "%s_%s" % (args.approximant1, args.approximant2)
toc = {"types": {wtype: []}}
bdir = "%s/" % wtype
if not os.path.exists(bdir):
    os.mkdir(bdir)

# FIXME: This code should probably be libized
# FIXME: Unhardcode
intr_prms = ("mass1", "mass2", "spin1z", "spin2z")
pts = numpy.array(
    [tuple(getattr(t, a) for a in intr_prms) for t in tmplt_bank])

# Dump full m1/m2 bank to JSON