Beispiel #1
0
    def lqbol(self):
        """Calculate the quasi-bolometric lightcurve using direct integration
        with trapezoidal integration of the fluxes
        """
        self.convert_magnitudes_to_fluxes()
        self.deredden_fluxes()
        self.get_lbol_epochs()
        self.distance_cm, self.distance_cm_err = self.get_distance_cm()

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

        for jd in self.lbol_epochs:
            wavelengths = np.array([x["wavelength"] for x in self.converted_obs if x["jd"] == jd])
            fluxes = np.array([x["flux"] for x in self.converted_obs if x["jd"] == jd])
            flux_errs = np.array([x["uncertainty"] for x in self.converted_obs if x["jd"] == jd])
            names = np.array([x["name"] for x in self.converted_obs if x["jd"] == jd])

            sort_indices = np.argsort(wavelengths)
            wavelengths = wavelengths[sort_indices]
            fluxes = fluxes[sort_indices]
            flux_errs = flux_errs[sort_indices]
            names = names[sort_indices]

            fqbol, fqbol_err = fqbol_trapezoidal(wavelengths, fluxes, flux_errs)

            lqbol = fqbol * 4.0 * np.pi * self.distance_cm ** 2.0
            lqbol_err = np.sqrt(
                (4.0 * np.pi * self.distance_cm ** 2 * fqbol_err) ** 2
                + (8.0 * np.pi * fqbol * self.distance_cm * self.distance_cm_err) ** 2
            )
            phase = jd - self.parameter_table.cols.explosion_JD[0]
            phase_err = self.parameter_table.cols.explosion_JD_err[0]
            # Quick and dirty fix for IR-only nights (don't want those in qbol calc)
            if min(wavelengths) < 10000.0:
                self.qbol_lc = np.append(self.qbol_lc, [[jd, phase, phase_err, lqbol, lqbol_err]], axis=0)
        self.qbol_lc = np.delete(self.qbol_lc, (0), axis=0)
        self.write_lbol_plaintext(self.qbol_lc, "qbol")
Beispiel #2
0
    def lbol_direct_bh09(self):
        """Calculate the bolometric lightcurve using the direct integration
        method published in Bersten & Hamuy 2009 (2009ApJ...701..200B)
        """
        self.convert_magnitudes_to_fluxes()
        self.deredden_fluxes()
        self.get_lbol_epochs()
        self.distance_cm, self.distance_cm_err = self.get_distance_cm()

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

        for jd in self.lbol_epochs:
            names = np.array([x["name"] for x in self.converted_obs if x["jd"] == jd and x["name"] != "z"])
            wavelengths = np.array([x["wavelength"] for x in self.converted_obs if x["jd"] == jd and x["name"] != "z"])
            fluxes = np.array([x["flux"] for x in self.converted_obs if x["jd"] == jd and x["name"] != "z"])
            flux_errs = np.array([x["uncertainty"] for x in self.converted_obs if x["jd"] == jd and x["name"] != "z"])

            sort_indices = np.argsort(wavelengths)
            wavelengths = wavelengths[sort_indices]
            fluxes = fluxes[sort_indices]
            flux_errs = flux_errs[sort_indices]

            fqbol, fqbol_err = fqbol_trapezoidal(wavelengths, fluxes, flux_errs)
            temperature, angular_radius, perr = bb_fit_parameters(wavelengths, fluxes, flux_errs)

            temperature_err = perr[0]
            angular_radius_err = perr[1]

            shortest_wl = np.amin(wavelengths)
            shortest_flux = np.amin(fluxes)
            shortest_flux_err = np.amin(flux_errs)
            longest_wl = np.amax(wavelengths)

            ir_corr, ir_corr_err = ir_correction(
                temperature, temperature_err, angular_radius, angular_radius_err, longest_wl
            )
            if "U" in names:
                idx = np.nonzero(names == "U")[0][0]
                U_flux = fluxes[idx]
                U_wl = wavelengths[idx]
                if U_flux < bb_flux_nounits(U_wl, temperature, angular_radius):
                    uv_corr, uv_corr_err = uv_correction_linear(shortest_wl, shortest_flux, shortest_flux_err)
                else:
                    uv_corr, uv_corr_err = uv_correction_blackbody(
                        temperature, temperature_err, angular_radius, angular_radius_err, shortest_wl
                    )
            else:
                uv_corr, uv_corr_err = uv_correction_blackbody(
                    temperature, temperature_err, angular_radius, angular_radius_err, shortest_wl
                )

            fbol = fqbol + ir_corr + uv_corr
            fbol_err = np.sqrt(np.sum(x * x for x in [fqbol_err, ir_corr_err, uv_corr_err]))
            lum = fbol * 4.0 * np.pi * self.distance_cm ** 2.0
            lum_err = np.sqrt(
                (4.0 * np.pi * self.distance_cm ** 2 * fbol_err) ** 2
                + (8.0 * np.pi * fbol * self.distance_cm * self.distance_cm_err) ** 2
            )
            phase = jd - self.parameter_table.cols.explosion_JD[0]
            phase_err = self.parameter_table.cols.explosion_JD_err[0]
            self.lc = np.append(self.lc, [[jd, phase, phase_err, lum, lum_err]], axis=0)

        self.lc = np.delete(self.lc, (0), axis=0)

        self.write_lbol_plaintext(self.lc, "direct")