예제 #1
0
 def test_snr_chirping(self):
     snr = GW_calcs.snr_chirping(
         GW150914.mass_1, GW150914.mass_2,
         GW_calcs.sep_from_p(GW150914.porb / sec_in_year, GW150914.mass_1,
                             GW150914.mass_2), GW150914.ecc,
         GW150914.dist / 1000, 5)
     self.assertAlmostEqual(snr, SNR_TEST)
예제 #2
0
 def test_snr_calc(self):
     LISA_noise = LISA_hc()
     t_obs = 5 * sec_in_year
     z = GW_calcs.z_from_lum_distance(GW150914.dist / 1000)
     a = GW_calcs.sep_from_p(GW150914.porb / sec_in_year, GW150914.mass_1,
                             GW150914.mass_2)
     e = GW150914.ecc
     a_evol, e_evol, t_evol = GW_calcs.peters_evolution(
         GW_calcs.sep_from_p(GW150914.porb / sec_in_year, GW150914.mass_1,
                             GW150914.mass_2), GW150914.ecc,
         GW150914.mass_1, GW150914.mass_2, 5 * sec_in_year, 1e3)
     f_orb = 1 / (GW_calcs.p_from_a(a, GW150914.mass_1, GW150914.mass_2) *
                  sec_in_year)
     f_orb_evol = 1 / (GW_calcs.p_from_a(a_evol, GW150914.mass_1,
                                         GW150914.mass_2) * sec_in_year)
     t_evol_log = np.logspace(-6, np.log10(t_obs), 5000)
     forb_evol_log = np.interp(t_evol_log,
                               xp=t_evol * sec_in_year,
                               fp=f_orb_evol)
     e_evol_log = np.interp(t_evol_log, xp=t_evol * sec_in_year, fp=e_evol)
     n_harm = int(GW_calcs.n_max(np.array([e]))[0])
     h_c_squared = []
     freqs = []
     for n in range(1, n_harm):
         h_c_squared.append(
             GW_calcs.hc2(GW150914.mass_1, GW150914.mass_2, forb_evol_log,
                          GW150914.dist / 1000, e_evol_log, n))
         freqs.append(forb_evol_log * n)
     h_c_squared = np.array(h_c_squared)
     freqs = np.array(freqs)
     snr = GW_calcs.snr_calc(freqs * (1 + z), h_c_squared**0.5,
                             LISA_noise(freqs * (1 + z)), 1)
     self.assertAlmostEqual(snr, SNR_TEST)
예제 #3
0
 def test_peters_evolution(self):
     a, e, t = GW_calcs.peters_evolution(
         GW_calcs.sep_from_p(GW150914.porb / sec_in_year, GW150914.mass_1,
                             GW150914.mass_2), GW150914.ecc,
         GW150914.mass_1, GW150914.mass_2, 5 * sec_in_year, 10)
     self.assertTrue(np.allclose(a, A_TEST))
     self.assertTrue(np.allclose(e, E_TEST))
     self.assertTrue(np.allclose(t, T_TEST))
     self.assertTrue(np.min(e) > 0.0)
     self.assertTrue(np.min(a) > 0.0)
     self.assertTrue(np.max(e) < 1.0)
     self.assertTrue(np.max(t) <= 5.0)
예제 #4
0
    def LISA_full_obs(self, T_obs):
        """Computes the gravitational wave signal from the population
        that will be observable by LISA, including SNR and PSD according
        to the user input

        Parameters
        ----------
        realization : DataFrame
            Milky Way population realization of size n_samp
        T_obs : float
            LISA observation time in seconds

        Returns
        -------
        SNR_dat : DataFrame
            DataFrame containing signal to noise ratios for all systems
            in realization
        PSD_dat : DataFrame
            DataFrame containing the power spectral density for all systems
            in realization
        foreground_dat : DataFrame
            DataFrame containing power spectral density of the population
            over a set of frequency bins with width set by the LISA
            observation time
        """

        # Compute the PSD
        #######################################################################
        PSD_dat = GW_calcs.LISA_PSD(self.realization.mass_1,
                                    self.realization.mass_2,
                                    10**self.realization.porb,
                                    self.realization.ecc, self.realization.xGx,
                                    self.realization.yGx, self.realization.zGx,
                                    150, T_obs)
        # Compute the foreground from the PSD dataframe
        #######################################################################
        foreground_dat = GW_calcs.compute_foreground(PSD_dat, T_obs)

        LISA_plus_foreground = GW_calcs.LISA_combo(foreground_dat)

        # Compute the SNR
        #######################################################################
        SNR_dat = GW_calcs.LISA_SNR(
            self.realization.mass_1, self.realization.mass_2,
            10**self.realization.porb, self.realization.ecc,
            self.realization.xGx, self.realization.yGx, self.realization.zGx,
            150, T_obs, foreground_dat, LISA_plus_foreground)

        return SNR_dat, PSD_dat, foreground_dat
예제 #5
0
 def test_PSD(self):
     # Test the PSDs with observed GWs with dummy orbital periods and eccs
     PSD_dat = GW_calcs.LISA_PSD(BCM_DAT.mass_1, BCM_DAT.mass_2,
                                 BCM_DAT.porb, BCM_DAT.ecc, BCM_DAT.xGx,
                                 BCM_DAT.yGx, BCM_DAT.zGx, 10,
                                 4 * sec_in_year)
     self.assertAlmostEqual(np.sum(PSD_dat.PSD), PSD_SUM_TEST)
예제 #6
0
 def test_peak_gw_freq(self):
     # Test the peak gw freq with a single binary
     f_gw_peak = GW_calcs.peak_gw_freq(m1=GW150914.mass_1 * Msun,
                                       m2=GW150914.mass_2 * Msun,
                                       porb=GW150914.porb,
                                       ecc=GW150914.ecc)
     self.assertAlmostEqual(f_gw_peak, F_PEAK_TEST)
예제 #7
0
    def LISA_obs(self, T_obs):
        """Computes the gravitational wave signal from the population
        that will be observable by LISA, including SNR and PSD according
        to the user input

        Parameters
        ----------
        realization : DataFrame
            Milky Way population realization of size n_samp
        T_obs : float
            LISA observation time in seconds

        Returns
        -------
        PSD_dat : DataFrame
            DataFrame containing the power spectral density for all systems
            in realization
        """
        # Compute the PSD
        #######################################################################
        PSD_dat = GW_calcs.LISA_PSD(self.realization.mass_1,
                                    self.realization.mass_2,
                                    10**self.realization.porb,
                                    self.realization.ecc, self.realization.xGx,
                                    self.realization.yGx, self.realization.zGx,
                                    150, T_obs)
        return PSD_dat
예제 #8
0
 def test_hc2(self):
     hc_2_10 = GW_calcs.hc2(D=GW150914.dist / 1000,
                            f_orb=1 / GW150914.porb,
                            m1=GW150914.mass_1,
                            m2=GW150914.mass_2,
                            e=GW150914.ecc,
                            n=10)
     self.assertAlmostEqual(hc_2_10, HC_2_10_TEST)
예제 #9
0
 def test_da_dt(self):
     de_dt = GW_calcs.de_dt(
         GW150914.mass_1 * Msun, GW150914.mass_2 * Msun,
         GW_calcs.sep_from_p(GW150914.porb / sec_in_year, GW150914.mass_1,
                             GW150914.mass_2) * m_in_au, GW150914.ecc)
     self.assertAlmostEqual(de_dt, DE_DT_TEST)
예제 #10
0
 def test_m_chirp(self):
     # Test the chirp mass calc with a single binary
     m_chirp = GW_calcs.m_chirp(GW150914.mass_1, GW150914.mass_2)
     self.assertAlmostEqual(m_chirp, MCHIRP_TEST)
예제 #11
0
 def test_z_from_lum_distance(self):
     # Test the calculator to get z from d_lum
     z = GW_calcs.z_from_lum_distance(D_LUM)
     self.assertAlmostEqual(np.round(z, 4), Z_TEST)
예제 #12
0
 def test_comoving_distance(self):
     # Test the luminosity distance calculator
     d_lum = GW_calcs.luminosity_distance(Z)
     self.assertAlmostEqual(np.round(d_lum, 1), D_LUM_TEST)
예제 #13
0
 def test_comoving_distance(self):
     # Test the comoving distance calculator
     d_co = GW_calcs.comoving_distance(Z)
     self.assertAlmostEqual(np.round(d_co, 1), D_CO_TEST)
예제 #14
0
 def test_sep_from_p(self):
     sep = GW_calcs.sep_from_p(1, 1, 0)
     self.assertEqual(sep, 1.0)
예제 #15
0
 def test_peters_gfac(self):
     # Test the g factor with 10 harmonics
     g_factor = GW_calcs.peters_gfac(GW150914.ecc, N_HARMONIC)
     g_factor_sum = g_factor.sum()
     self.assertAlmostEqual(g_factor_sum, G_FAC_TEST)
예제 #16
0
 def test_peters_g(self):
     # Test the g factor at the n=10 harmonic
     g_factor = GW_calcs.peters_g(GW150914.ecc, N_HARMONIC)
     self.assertAlmostEqual(g_factor, G_FAC_TEST)
예제 #17
0
 def test_F_e(self):
     # Test the f(d) factor
     f_e = GW_calcs.F_e(GW150914.ecc)
     self.assertAlmostEqual(f_e, F_E_TEST)
예제 #18
0
 def test_n_max(self):
     n_max = GW_calcs.n_max(ECC_ARRAY)
     self.assertTrue(np.allclose(n_max, N_MAX_TEST))
예제 #19
0
 def test_hc2_circ(self):
     hc_2_circ = GW_calcs.hc2_circ(D=GW150914.dist / 1000,
                                   f_orb=1 / GW150914.porb,
                                   m1=GW150914.mass_1,
                                   m2=GW150914.mass_2)
     self.assertAlmostEqual(hc_2_circ, HC_2_CIRC_TEST)