Пример #1
0
    def test_read_element_angstroms(self):
        test_fp = os.path.abspath(
            os.path.join(__package__, 'etc', "tests", "data",
                         "test_atmos_angstroms.dat"))

        element = read_element(test_fp)

        assert_quantity_allclose(element.waveset[0], 3200 * u.AA)
        assert_quantity_allclose(element(element.waveset[0]), 0.306, rtol=1e-3)
Пример #2
0
    def test_read_element_microns_passed_waveunit(self):
        test_fp = os.path.abspath(
            os.path.join(__package__, 'etc', "tests", "data",
                         "test_mirror_microns.dat"))

        element = read_element(test_fp, wave_units=u.micron)

        assert_quantity_allclose(element.waveset[0], 3000 * u.AA)
        assert_quantity_allclose(element(element.waveset[0]), 0.751)
Пример #3
0
    def test_read_element(self):
        test_fp = os.path.abspath(
            os.path.join(__package__, 'etc', "tests", "data",
                         "test_mirror.dat"))

        element = read_element(test_fp)

        assert_quantity_allclose(element.waveset[0], 2750 * u.AA)
        assert_quantity_allclose(element(element.waveset[0]), 0.64)
Пример #4
0
    def test_config_item_Vfilter(self):
        element = read_element('V')

        assert type(element) == SpectralElement
        assert_quantity_allclose(element.waveset[0], 4700 * u.AA)
        assert_quantity_allclose(element(element.waveset[0]), 0.0)
        assert_quantity_allclose(element.waveset[-1], 7000 * u.AA)
        assert_quantity_allclose(element(element.waveset[-1]), 0.0)
        assert_quantity_allclose(element(530 * u.nm), 1.0)
Пример #5
0
    def test_read_element_microns_passed_fluxunit(self):
        test_fp = os.path.abspath(
            os.path.join(__package__, 'etc', "tests", "data",
                         "test_mirror_microns.dat"))

        element = read_element(test_fp, flux_units=u.percent)

        assert_quantity_allclose(element.waveset[0], 3000 * u.AA)
        assert_quantity_allclose(element(element.waveset[0]),
                                 0.00751)  # File is not in percent
Пример #6
0
    def test_read_fudge_greater_than_one_as_SE(self):
        test_fp = os.path.abspath(
            os.path.join(__package__, 'etc', "tests", "data",
                         "test_fudge.dat"))

        element = read_element(test_fp, element_type='spectral_element')

        assert type(element) == SpectralElement
        assert_quantity_allclose(element.waveset[0], 320 * u.nm)
        assert_quantity_allclose(element(element.waveset[0]), 0.93)
        assert_quantity_allclose(element.waveset[-1], 1000 * u.nm)
        assert_quantity_allclose(element(element.waveset[-1]), 3.2)
Пример #7
0
    def test_read_element_as_sourcespectrum(self):
        test_fp = os.path.abspath(
            os.path.join(__package__, 'etc', "tests", "data",
                         "test_radiance.dat"))

        element = read_element(test_fp, element_type='spectrum')

        assert isinstance(element, SourceSpectrum)
        assert element.waveset[0].unit == u.AA
        assert_quantity_allclose(element.waveset[0], 300 * u.nm)
        assert_quantity_allclose(element(element.waveset[0]),
                                 16.4805 * units.PHOTLAM,
                                 rtol=1e-3)
Пример #8
0
    def test_read_fudge_greater_than_one(self):
        """ESO Omegacam has an optics throughput fudge which goes fro, 0.93 to 3.2
        with a mean of 1.4024. This incorrectly triggers the divide by 100 logic
        to convert it from a percentage to a 0..1 range. This test checks this
        is correctly handled"""
        test_fp = os.path.abspath(
            os.path.join(__package__, 'etc', "tests", "data",
                         "test_fudge.dat"))

        element = read_element(test_fp)

        assert_quantity_allclose(element.waveset[0], 320 * u.nm)
        assert_quantity_allclose(element(element.waveset[0]), 0.93)
        assert_quantity_allclose(element.waveset[-1], 1000 * u.nm)
        assert_quantity_allclose(element(element.waveset[-1]), 3.2)
Пример #9
0
    def test_read_element_as_sourcespectrum_ownfluxunits(self):
        test_fp = os.path.abspath(
            os.path.join(__package__, 'etc', "tests", "data",
                         "test_radiance.dat"))

        eso_unit = units.u.photon / units.u.s / units.u.m**2 / units.u.um

        element = read_element(test_fp,
                               element_type='spectrum',
                               flux_units=eso_unit)

        assert isinstance(element, SourceSpectrum)
        assert element.waveset[0].unit == u.AA
        assert element(element.waveset[0]).unit == units.PHOTLAM
        assert_quantity_allclose(element.waveset[0], 300 * u.nm)
        assert_quantity_allclose(element(element.waveset[0]),
                                 16.4805 * eso_unit,
                                 rtol=1e-3)