def setUp(self, *args): self.numtests = 1000 self.precision = 1e-8 self.f_lower = 10. # create some component masses to work with self.m1 = numpy.random.uniform(1., 100., size=self.numtests) self.m2 = numpy.random.uniform(1., 100., size=self.numtests) # create some spins to work with spin_angledist = distributions.UniformSolidAngle() rvals = spin_angledist.rvs(size=self.numtests) self.spin1_polar = rvals['theta'] self.spin1_az = rvals['phi'] self.spin1_amp = numpy.random.uniform(0., 1., size=self.numtests) rvals = spin_angledist.rvs(size=self.numtests) self.spin2_polar = rvals['theta'] self.spin2_az = rvals['phi'] self.spin2_amp = numpy.random.uniform(0., 1., size=self.numtests) # calculate derived parameters from each self.mp = conversions.primary_mass(self.m1, self.m2) self.ms = conversions.secondary_mass(self.m1, self.m2) self.mtotal = conversions.mtotal_from_mass1_mass2(self.m1, self.m2) self.q = conversions.q_from_mass1_mass2(self.m1, self.m2) self.invq = conversions.invq_from_mass1_mass2(self.m1, self.m2) self.mchirp = conversions.mchirp_from_mass1_mass2(self.m1, self.m2) self.eta = conversions.eta_from_mass1_mass2(self.m1, self.m2) self.tau0 = conversions.tau0_from_mtotal_eta(self.mtotal, self.eta, self.f_lower) self.tau3 = conversions.tau3_from_mtotal_eta(self.mtotal, self.eta, self.f_lower) self.spin1x, self.spin1y, self.spin1z = \ coordinates.spherical_to_cartesian(self.spin1_amp, self.spin1_az, self.spin1_polar) self.spin2x, self.spin2y, self.spin2z = \ coordinates.spherical_to_cartesian(self.spin2_amp, self.spin2_az, self.spin2_polar) self.effective_spin = conversions.chi_eff(self.m1, self.m2, self.spin1z, self.spin2z) self.chi_p = conversions.chi_p(self.m1, self.m2, self.spin1x, self.spin1y, self.spin2x, self.spin2y) self.primary_spinx = conversions.primary_spin(self.m1, self.m2, self.spin1x, self.spin2x) self.primary_spiny = conversions.primary_spin(self.m1, self.m2, self.spin1y, self.spin2y) self.primary_spinz = conversions.primary_spin(self.m1, self.m2, self.spin1z, self.spin2z) self.secondary_spinx = conversions.secondary_spin(self.m1, self.m2, self.spin1x, self.spin2x) self.secondary_spiny = conversions.secondary_spin(self.m1, self.m2, self.spin1y, self.spin2y) self.secondary_spinz = conversions.secondary_spin(self.m1, self.m2, self.spin1z, self.spin2z)
def setUp(self, *args): self.numtests = 1000 self.precision = 1e-8 self.f_lower = 10. # create some component masses to work with self.m1 = numpy.random.uniform(1., 100., size=self.numtests) self.m2 = numpy.random.uniform(1., 100., size=self.numtests) # create some spins to work with spin_angledist = distributions.UniformSolidAngle() rvals = spin_angledist.rvs(size=self.numtests) self.spin1_polar = rvals['theta'] self.spin1_az = rvals['phi'] self.spin1_amp = numpy.random.uniform(0., 1., size=self.numtests) rvals = spin_angledist.rvs(size=self.numtests) self.spin2_polar = rvals['theta'] self.spin2_az = rvals['phi'] self.spin2_amp = numpy.random.uniform(0., 1., size=self.numtests) # calculate derived parameters from each self.mp = conversions.primary_mass(self.m1, self.m2) self.ms = conversions.secondary_mass(self.m1, self.m2) self.mtotal = conversions.mtotal_from_mass1_mass2(self.m1, self.m2) self.q = conversions.q_from_mass1_mass2(self.m1, self.m2) self.invq = conversions.invq_from_mass1_mass2(self.m1, self.m2) self.mchirp = conversions.mchirp_from_mass1_mass2(self.m1, self.m2) self.eta = conversions.eta_from_mass1_mass2(self.m1, self.m2) self.tau0 = conversions.tau0_from_mtotal_eta(self.mtotal, self.eta, self.f_lower) self.tau3 = conversions.tau3_from_mtotal_eta(self.mtotal, self.eta, self.f_lower) self.spin1x, self.spin1y, self.spin1z = \ coordinates.spherical_to_cartesian(self.spin1_amp, self.spin1_az, self.spin1_polar) self.spin2x, self.spin2y, self.spin2z = \ coordinates.spherical_to_cartesian(self.spin2_amp, self.spin2_az, self.spin2_polar) self.effective_spin = conversions.chi_eff(self.m1, self.m2, self.spin1z, self.spin2z) self.primary_spinx = conversions.primary_spin(self.m1, self.m2, self.spin1x, self.spin2x) self.primary_spiny = conversions.primary_spin(self.m1, self.m2, self.spin1y, self.spin2y) self.primary_spinz = conversions.primary_spin(self.m1, self.m2, self.spin1z, self.spin2z) self.secondary_spinx = conversions.secondary_spin(self.m1, self.m2, self.spin1x, self.spin2x) self.secondary_spiny = conversions.secondary_spin(self.m1, self.m2, self.spin1y, self.spin2y) self.secondary_spinz = conversions.secondary_spin(self.m1, self.m2, self.spin1z, self.spin2z)
def mass1_mass2_to_mtotal_eta(mass1, mass2): m_total = conversions.mtotal_from_mass1_mass2(mass1, mass2) eta = conversions.eta_from_mass1_mass2(mass1, mass2) return m_total,eta
def mass1_mass2_to_mtotal_eta(mass1, mass2): m_total = conversions.mtotal_from_mass1_mass2(mass1, mass2) eta = conversions.eta_from_mass1_mass2(mass1, mass2) return m_total,eta