示例#1
0
def sim_to_distance_effective_spin_parameter_bins_function(sim):
    """
	Map a sim_inspiral row to a distance, "chi" spin parameter
	bin. For IMR waveforms, "chi" refers to the effective spin,

	   chi = (m1*s1z + m2*s2z)/(m1 + m2)

	where s1z, s2z are the components of the spins along the
	direction of the total angular momentum. For inspiral
	waveforms, "chi" refers to the reduced spin,

	   chi_red = chi_s + delta*chi_a - 76.*eta/113*chi_s,

	where chi_s and chi_a are the symmetric and anti-symmetric
	combinations of the spins, and delta=(m1-m2)/(m1+m2). Some
	waveforms, e.g., SpinTaylorT4, use different coordinate
	conventions and require a coordinate transformation before
	applying these definitions.
	"""

    if sim.waveform.startswith("SpinTaylorT4"):
        chi1 = sim.spin1x * math.sin(sim.inclination) + sim.spin1z * math.cos(
            sim.inclination)
        chi2 = sim.spin2x * math.sin(sim.inclination) + sim.spin2z * math.cos(
            sim.inclination)
        chi = SimInspiralTaylorF2ReducedSpinComputeChi(sim.mass1, sim.mass2,
                                                       chi1, chi2)

    elif sim.waveform.startswith("SpinTaylorT5"):
        chi1 = sim.spin1z
        chi2 = sim.spin2z
        chi = SimInspiralTaylorF2ReducedSpinComputeChi(sim.mass1, sim.mass2,
                                                       chi1, chi2)

    elif sim.waveform.startswith("IMRPhenomB") or sim.waveform.startswith(
            "IMRPhenomC") or sim.waveform.startswith("SEOBNR"):
        chi = SimIMRPhenomBComputeChi(sim.mass1, sim.mass2, sim.spin1z,
                                      sim.spin2z)

    else:
        raise ValueError(sim.waveform)

    return (sim.distance, chi)
示例#2
0
tmplt_eta = tmplt_arr["mass1"] * tmplt_arr["mass2"] / (tmplt_arr["mass1"] +
                                                       tmplt_arr["mass2"])**2
inj_tau0, inj_tau3 = m1m2_to_tau0tau3(inj_arr["mass1"], inj_arr["mass2"], flow)
tmplt_tau0, tmplt_tau3 = m1m2_to_tau0tau3(tmplt_arr["mass1"],
                                          tmplt_arr["mass2"], flow)
tmplt_mchirp = compute_mchirp(tmplt_arr["mass1"], tmplt_arr["mass2"])
inj_mchirp = compute_mchirp(inj_arr["mass1"], inj_arr["mass2"])

#
# compute effective/reduced spin parameter for templates
#
if tmplt_approx == "TaylorF2RedSpin":
    tmplt_chi_label = "\chi_\mathrm{red}"
    tmplt_chi = [
        SimInspiralTaylorF2ReducedSpinComputeChi(float(row["mass1"]),
                                                 float(row["mass2"]),
                                                 float(row["spin1z"]),
                                                 float(row["spin2z"]))
        for row in tmplt_arr
    ]
else:  # default to effective spin
    tmplt_chi_label = "\chi_\mathrm{eff}"
    tmplt_chi = [
        SimIMRPhenomBComputeChi(float(row["mass1"]), float(row["mass2"]),
                                float(row["spin1z"]), float(row["spin2z"]))
        for row in tmplt_arr
    ]

#
# compute effective/reduced spin parameter for injections
#
if inj_approx == "TaylorF2RedSpin" or "SpinTaylorT5" in inj_approx:  # reduced spin
min_match = match[int(floor(len(match)*0.9))]
inj_M = inj_arr["mass1"] + inj_arr["mass2"] #total mass
inj_eta = inj_arr["mass1"] * inj_arr["mass2"] / (inj_arr["mass1"] + inj_arr["mass2"])**2
tmplt_M = tmplt_arr["mass1"] + tmplt_arr["mass2"]
tmplt_eta = tmplt_arr["mass1"] * tmplt_arr["mass2"] / (tmplt_arr["mass1"] + tmplt_arr["mass2"])**2
inj_tau0, inj_tau3 = m1m2_to_tau0tau3(inj_arr["mass1"], inj_arr["mass2"], flow)
tmplt_tau0, tmplt_tau3 = m1m2_to_tau0tau3(tmplt_arr["mass1"], tmplt_arr["mass2"], flow)
tmplt_mchirp = compute_mchirp(tmplt_arr["mass1"], tmplt_arr["mass2"])
inj_mchirp = compute_mchirp(inj_arr["mass1"], inj_arr["mass2"])

#
# compute effective/reduced spin parameter for templates
#
if tmplt_approx == "TaylorF2RedSpin":
    tmplt_chi_label = "\chi_\mathrm{red}"
    tmplt_chi = [SimInspiralTaylorF2ReducedSpinComputeChi(float(row["mass1"]), float(row["mass2"]), float(row["spin1z"]), float(row["spin2z"])) for row in tmplt_arr]
else: # default to effective spin
    tmplt_chi_label = "\chi_\mathrm{eff}"
    tmplt_chi = [SimIMRPhenomBComputeChi(float(row["mass1"]), float(row["mass2"]), float(row["spin1z"]), float(row["spin2z"])) for row in tmplt_arr]

# FIXME hack
inj_dur = [SimIMRSEOBNRv4ROMTimeOfFrequency(flow, float(row["mass1"]) * MSUN_SI, float(row["mass2"]) * MSUN_SI, float(row["spin1z"]), float(row["spin2z"])) for row in inj_arr]


#
# compute effective/reduced spin parameter for injections
#
if inj_approx == "TaylorF2RedSpin" or "SpinTaylorT5" in inj_approx: # reduced spin
    inj_chi_label = "\chi_\mathrm{red}"
    inj_chi = [SimInspiralTaylorF2ReducedSpinComputeChi(float(row["mass1"]), float(row["mass2"]), float(row["spin1z"]), float(row["spin2z"])) for row in inj_arr]
elif "SpinTaylorT4" in inj_approx: # reduced spin (requires coordinate transformation)