Exemplo n.º 1
0
    def lbol_bc_bh09(self, filter1, filter2):
        """Calculate the bolometric lightcurve using the bolometric corrections
        found in Bersten & Hamuy 2009 (2009ApJ...701..200B). These require
        specifying a color, taken to be filter1 - filter2"""
        self.get_magnitudes()
        self.deredden_UBVRI_magnitudes()
        self.get_bc_epochs(filter1, filter2)
        self.distance_cm, self.distance_cm_err = self.get_distance_cm()

        self.bc_lc = np.array([[0.0, 0.0, 0.0, 0.0, 0.0]])

        for i in range(len(self.bc_epochs)):
            jd = self.bc_epochs[i]
            color = self.get_bc_color(jd, filter1, filter2)
            color_err = self.get_bc_color_uncertainty(jd, filter1, filter2)
            v_mag = np.array([
                x['magnitude'] for x in self.photometry
                if x['jd'] == jd and x['name'] == 'V'
            ])
            v_mag_err = np.array([
                x['uncertainty'] for x in self.photometry
                if x['jd'] == jd and x['name'] == 'V'
            ])
            lbol_bc, lbol_bc_err = calc_Lbol(
                color, color_err, filter1 + "minus" + filter2, v_mag,
                v_mag_err, self.distance_cm, self.distance_cm_err)
            phase = jd - self.parameter_table.cols.explosion_JD[0]
            phase_err = self.parameter_table.cols.explosion_JD_err[0]
            self.bc_lc = np.append(
                self.bc_lc, [[jd, phase, phase_err, lbol_bc, lbol_bc_err]],
                axis=0)

        self.bc_lc = np.delete(self.bc_lc, (0), axis=0)
        self.write_lbol_plaintext(self.bc_lc, 'bc_' + filter1 + '-' + filter2)
Exemplo n.º 2
0
 def test_Lbol_is_bad_if_bc_is_bad(self):
     color_value = 123.0
     expected = -999
     result = luminosity.calc_Lbol(color_value, self.color_err,
                                   self.color_type, self.v_magnitude,
                                   self.v_magnitude_err, self.distance,
                                   self.distance_err)[0]
     self.assertEqual(expected, result)
Exemplo n.º 3
0
 def test_Lbol_uncertainty_is_bad_if_bc_is_bad(self):
     color_value = 123.0
     expected = -999
     result = luminosity.calc_Lbol(color_value, self.color_err,
                                       self.color_type, 
                                       self.v_magnitude, 
                                       self.v_magnitude_err,
                                       self.distance,
                                       self.distance_err)[1]
     self.assertEqual(expected, result)
Exemplo n.º 4
0
 def test_Lbol(self):
     expected = luminosity.calc_Fbol(self.color_value, self.color_err,
                                       self.color_type,
                                       self.v_magnitude,
                                       self.v_magnitude_err)[0] \
                * luminosity.calc_4piDsquared(self.distance,
                                            self.distance_err)[0]
     result = luminosity.calc_Lbol(self.color_value, self.color_err,
                                   self.color_type, self.v_magnitude,
                                   self.v_magnitude_err, self.distance,
                                   self.distance_err)[0]
     self.assertAlmostEqual(expected, result)
Exemplo n.º 5
0
 def test_Lbol(self):
     expected = luminosity.calc_Fbol(self.color_value, self.color_err, 
                                       self.color_type,
                                       self.v_magnitude,
                                       self.v_magnitude_err)[0] \
                * luminosity.calc_4piDsquared(self.distance, 
                                            self.distance_err)[0]
     result = luminosity.calc_Lbol(self.color_value, self.color_err,
                                       self.color_type,
                                       self.v_magnitude, 
                                       self.v_magnitude_err,
                                       self.distance,
                                       self.distance_err)[0]
     self.assertAlmostEqual(expected, result)
Exemplo n.º 6
0
    def test_Lbol_uncertainty(self):
        Fbol, Fbol_err = luminosity.calc_Fbol(self.color_value, self.color_err,
                                              self.color_type,
                                              self.v_magnitude,
                                              self.v_magnitude_err)
        dist, dist_err = luminosity.calc_4piDsquared(self.distance,
                                                     self.distance_err)

        expected = math.sqrt((dist * Fbol_err)**2 + (Fbol * dist_err)**2)
        result = luminosity.calc_Lbol(self.color_value, self.color_err,
                                      self.color_type, self.v_magnitude,
                                      self.v_magnitude_err, self.distance,
                                      self.distance_err)[1]
        self.assertEqual(expected, result)
Exemplo n.º 7
0
    def test_Lbol_uncertainty(self):
        Fbol, Fbol_err = luminosity.calc_Fbol(self.color_value, 
                                              self.color_err, 
                                              self.color_type,
                                              self.v_magnitude,
                                              self.v_magnitude_err)
        dist, dist_err = luminosity.calc_4piDsquared(self.distance,
                                                 self.distance_err)


        expected = math.sqrt((dist * Fbol_err)**2 + (Fbol * dist_err)**2)
        result = luminosity.calc_Lbol(self.color_value, self.color_err,
                                          self.color_type,
                                          self.v_magnitude, 
                                          self.v_magnitude_err,
                                          self.distance,
                                          self.distance_err)[1]
        self.assertEqual(expected, result)