def __init__(self, m1, m2, spin1x, spin1y, spin1z, spin2x, spin2y, spin2z, theta, phi, iota, psi, orb_phase, bank, flow=None, duration=None):

        AlignedSpinTemplate.__init__(self, m1, m2, spin1z, spin2z, bank,
                                     flow=flow, duration=duration)
        self.spin1x = float(spin1x)
        self.spin1y = float(spin1y)
        self.spin2x = float(spin2x)
        self.spin2y = float(spin2y)

        self.theta = float(theta)
        self.phi = float(phi)
        self.iota = float(iota)
        self.psi = float(psi)
        self.orb_phase = float(orb_phase)

        self.chieff, self.chipre = lalsim.SimIMRPhenomPCalculateModelParametersFromSourceFrame(self.m1, self.m2, self.flow, self.orb_phase, self.iota, self.spin1x, self.spin1y, self.spin1z, self.spin2x, self.spin2y, self.spin2z, lalsim.IMRPhenomPv2_V)[:2]

        self._wf = {}
        self._metric = None
        self.sigmasq = 0.
        self._wf_hp = {}
        self._wf_hc = {}
        self._hpsigmasq = {}
        self._hcsigmasq = {}
        self._hphccorr = {}
    def test_chip_compare_lalsuite(self):
        """Compares effective precession parameter bewteen
        the pycbc implementation and the lalsuite implementation.
        """
        import lal
        import lalsimulation as lalsim

        msg = '{} does not recover same {}; max difference: {}; inputs: {}'

        f_ref = self.f_lower
        chip_lal = []
        for i in range(len(self.m1)):
            _, _, tmp, _, _, _, _ = lalsim.SimIMRPhenomPCalculateModelParametersFromSourceFrame(
                self.m1[i] * lal.MSUN_SI, self.m2[i] * lal.MSUN_SI, f_ref, 0.,
                0., self.spin1x[i], self.spin1y[i], self.spin1z[i],
                self.spin2x[i], self.spin2y[i], self.spin2z[i],
                lalsim.IMRPhenomPv2_V)
            chip_lal.append(tmp)

        chip_pycbc = conversions.chi_p(self.m1, self.m2, self.spin1x,
                                       self.spin1y, self.spin2x, self.spin2y)

        passed, maxdiff, maxidx = almost_equal(chip_lal, chip_pycbc,
                                               self.precision)
        failinputs = (self.m1[maxidx], self.m2[maxidx], self.spin1x[maxidx],
                      self.spin1y[maxidx], self.spin2x[maxidx],
                      self.spin2y[maxidx])
        self.assertTrue(
            passed,
            msg.format("conversions.chi_p", "chi_p", maxdiff, failinputs))
Exemple #3
0
def lalsim_SimIMRPhenomPCalculateModelParametersFromSourceFrame(
        mass_1, mass_2, reference_frequency, phase, iota, spin_1x, spin_1y,
        spin_1z, spin_2x, spin_2y, spin_2z, version):
    [
        mass_1, mass_2, reference_frequency, phase, iota, spin_1x, spin_1y,
        spin_1z, spin_2x, spin_2y, spin_2z
    ] = convert_args_list_to_float(mass_1, mass_2, reference_frequency, phase,
                                   iota, spin_1x, spin_1y, spin_1z, spin_2x,
                                   spin_2y, spin_2z)
    return lalsim.SimIMRPhenomPCalculateModelParametersFromSourceFrame(
        mass_1, mass_2, reference_frequency, phase, iota, spin_1x, spin_1y,
        spin_1z, spin_2x, spin_2y, spin_2z, version)