예제 #1
0
    def test_get_flux(self):
        read_calib = species.ReadCalibration("vega",
                                             filter_name="Paranal/NACO.H")
        flux = read_calib.get_flux(model_param=self.model_param)

        assert flux[0] == pytest.approx(1.1329023591019857e-09,
                                        rel=self.limit,
                                        abs=0.0)
예제 #2
0
    def test_get_magnitude(self):
        read_calib = species.ReadCalibration("vega",
                                             filter_name="Paranal/NACO.H")
        app_mag, abs_mag = read_calib.get_magnitude(
            model_param=self.model_param)

        assert app_mag[0] == 0.03
        assert abs_mag[0] is None
예제 #3
0
    def test_get_flux(self):
        read_calib = species.ReadCalibration('vega',
                                             filter_name='Paranal/NACO.H')
        flux = read_calib.get_flux(model_param=self.model_param)

        assert flux[0] == pytest.approx(1.132902304231636e-09,
                                        rel=self.limit,
                                        abs=0.)
예제 #4
0
    def test_resample_spectrum(self):
        read_calib = species.ReadCalibration("vega")
        spec_box = read_calib.resample_spectrum(np.linspace(1.0, 2.0, 10),
                                                apply_mask=True)

        assert np.sum(spec_box.wavelength) == 15.0
        assert np.sum(spec_box.flux) == pytest.approx(2.288734760321133e-08,
                                                      rel=self.limit,
                                                      abs=0.0)
예제 #5
0
    def test_read_calibration(self):
        database = species.Database()
        database.add_spectra("vega")

        read_calib = species.ReadCalibration("vega",
                                             filter_name="Paranal/NACO.H")
        assert read_calib.wavel_range == pytest.approx((1.44, 1.88),
                                                       rel=1e-7,
                                                       abs=0.0)
예제 #6
0
    def test_get_spectrum(self):
        read_calib = species.ReadCalibration("vega",
                                             filter_name="Paranal/NACO.Lp")
        spec_box = read_calib.get_spectrum(self.model_param,
                                           apply_mask=True,
                                           spec_res=100.0)

        assert np.sum(spec_box.wavelength) == pytest.approx(183.34793783628004,
                                                            rel=self.limit,
                                                            abs=0.0)
        assert np.sum(spec_box.flux) == pytest.approx(2.363239096767195e-09,
                                                      rel=self.limit,
                                                      abs=0.0)
예제 #7
0
species.plot_posterior(tag='hd218396',
                       burnin=500,
                       offset=(-0.3, -0.10),
                       output='plot_spectrum/posteriors.pdf')
objectbox = database.get_object(object_name='HD 218396', 
                                filters=filters)

samples = database.get_mcmc_spectra(tag='hd218396',
                                    burnin=500,
                                    random=30,
                                    wavel_range=(0.2, 30.0),
                                    spec_res=None)

median = database.get_median_sample(tag='hd218396', burnin=500)
print(median)
readcalib = species.ReadCalibration(tag='btnextgen')

specbox = readcalib.get_spectrum(model_param=median)

specbox_gravity = readcalib.resample_spectrum(gravity_wavel, model_param=median)

np.savetxt(output_dir + 'hr8799_star_spec_fit.dat',
           np.column_stack([specbox.wavelength, specbox.flux]),
           header='Wavelength (micron) - Flux (W m-2 micron-1)')

np.savetxt(output_dir + 'hr8799_star_spec_gravity.dat',
           np.column_stack([specbox_gravity.wavelength, specbox_gravity.flux]),
           header='Wavelength (micron) - Flux (W m-2 micron-1)')

synphot = species.multi_photometry(datatype='calibration',
                                   spectrum='btnextgen',