Esempio n. 1
0
 def test_initialises_from_array_dict(self):
     n = 5
     kwargs = surf_list_kwargs(n)
     surf_list = sl.SurfaceList(**kwargs)
     assert len(surf_list.data) == n
     assert isinstance(surf_list, sl.SurfaceList)
     assert surf_list.surfaces["M1"].area == 1 * u.m**2
Esempio n. 2
0
    def test_adds_bg_to_source_if_source_has_no_bg(self):
        n = 11
        kwargs = surf_list_kwargs(n)
        surf_list = sl.SurfaceList(**kwargs)
        src = so._vega_source()

        wave = np.linspace(1, 2.5, 1000) * u.um
        flux_before = src.spectra[0](wave).value
        src = surf_list.apply_to(src)
        flux_after = src.spectra[0](wave).value

        assert np.average(flux_after / flux_before) == approx(0.985**n)
        assert src.fields[-1].header["BG_SRC"] is True
        assert src.fields[-1].header["SPEC_REF"] == 1

        if PLOTS:
            plt.semilogy(wave, flux_before)
            plt.semilogy(wave, flux_after)
            plt.show()
Esempio n. 3
0
    def test_combines_emission_correctly(self):
        n = 5
        kwargs = surf_list_kwargs(n)
        surf_list = sl.SurfaceList(**kwargs)

        wave = np.arange(0.8, 2.5, 0.01) * u.um
        sum_values = np.sum([surf_list.surfaces[key].emission(wave).value
                             for key in surf_list.surfaces], axis=0)
        comb_value = surf_list.emission(wave).value
        sollwert = np.sum([0.985 ** n for n in range(n)]) / n

        assert np.average(comb_value / sum_values) == approx(sollwert, rel=1e-5)

        # print(sum_values, comb_value, comb_value / sum_values, sollwert)
        if PLOTS:
            wave = np.linspace(0.8, 2.5, 100) * u.um
            for key, surf in surf_list.surfaces.items():
                plt.semilogy(wave, surf.emission(wave))
            plt.semilogy(wave, surf_list.emission(wave))
            plt.show()
Esempio n. 4
0
 def test_initialises_with_nothing(self):
     assert isinstance(sl.SurfaceList(), sl.SurfaceList)
Esempio n. 5
0
def micado_surf_list():
    return sl.SurfaceList(filename="LIST_mirrors_MICADO_Wide.tbl")
Esempio n. 6
0
 def test_plotting(self):
     if PLOTS:
         surf_list = micado_surf_list()
         surf_list = sl.SurfaceList(**surf_list_kwargs(2))
         surf_list.plot("xe")
         plt.show()