def test_basic_spectroscopy_mode(self, ap_list, spt_list, det_list,
                                     config_yaml, point_source, ext_source,
                                     gauss_psf):
        # Uses a basic SpectralTraceList with 4 traces and 2 apertures
        # 2 traces attached to each apertures
        config_yaml["wave_min"] = 1.0
        config_yaml["wave_max"] = 2.5

        src = point_source + ext_source

        fov_setup_effects = [ap_list, spt_list, det_list]
        fov_apply_effects = [gauss_psf]

        fov_mgr = FOVManager(effects=fov_setup_effects, **config_yaml)
        fovs = fov_mgr.fovs

        assert all([isinstance(fov, FieldOfView) for fov in fovs])

        implane = ImagePlane(det_list.image_plane_header)
        for fov in fovs:
            fov.extract_from(src)
            for effect in fov_apply_effects:
                fov = effect.apply_to(fov)

            if fov.hdu.data is None:
                fov.view()

            implane.add(fov.hdu, wcs_suffix="D")

        if PLOTS:
            plt.imshow(implane.data, origin="lower")
            plt.show()
    def test_single_non_straight_traces(self, ap_list_single, spt_list_single,
                                        det_list, config_yaml, point_source,
                                        ext_source, gauss_psf):
        config_yaml["wave_min"] = 1.0
        config_yaml["wave_mid"] = 1.2
        config_yaml["wave_max"] = 2.5

        src = point_source + ext_source

        fov_setup_effects = [ap_list_single, spt_list_single, det_list]
        fov_apply_effects = [gauss_psf]

        fov_mgr = FOVManager(effects=fov_setup_effects, **config_yaml)
        fovs = fov_mgr.fovs

        assert all([isinstance(fov, FieldOfView) for fov in fovs])

        implane = ImagePlane(det_list.image_plane_header)
        for fov in fovs:
            fov.extract_from(src)
            for effect in fov_apply_effects:
                fov = effect.apply_to(fov)

            if fov.hdu.data is None:
                fov.view()

            implane.add(fov.hdu, wcs_suffix="D")

        if PLOTS:
            plt.imshow(implane.data, origin="lower")
            plt.show()
Esempio n. 3
0
    def test_fovs_dont_overlap_on_canvas(self, mvs_effects_list, mvs_usr_cmds):
        rc.__currsys__ = UserCommands(yamls=mvs_usr_cmds)

        implane = ImagePlane(mvs_effects_list[-2].image_plane_header)
        fov_man = FOVManager(mvs_effects_list)
        fovs = fov_man.generate_fovs_list()
        for fov in fovs:
            fov.hdu.data = np.ones((fov.header["NAXIS1"], fov.header["NAXIS2"]))
            implane.add(fov.hdu, wcs_suffix="D")

        if PLOTS:
            plt.imshow(implane.image.T, origin="lower")
            plt.colorbar()
            plt.show()
    def test_ignores_classes_other_than_fov(self, ncpa_kwargs):
        implane = ImagePlane(_implane_header())
        implane.hdu.data[1, 1] = 1
        ncpa = NonCommonPathAberration(**ncpa_kwargs)
        new_implane = ncpa.apply_to(implane)

        assert np.all(new_implane.data == implane.data)

        if PLOTS:
            plt.imshow(new_implane.image[:5,:5])
            plt.show()
Esempio n. 5
0
    def test_generates_fovs_for_spectroscopy_mode(self, ap_list, spt_list,
                                                  det_list, config_yaml,
                                                  spec_source):
        # Uses a basic SpectralTraceList with 4 traces and 2 apertures
        # 2 traces attached to each apertures
        config_yaml["wave_min"] = 1.0
        config_yaml["wave_max"] = 2.5

        effects = [ap_list, spt_list, det_list]
        fov_mgr = FOVManager(effects=effects, **config_yaml)
        fovs = fov_mgr.fovs
        print(len(fovs))

        assert all([isinstance(fov, FieldOfView) for fov in fovs])

        if PLOTS:
            implane = ImagePlane(det_list.image_plane_header)
            for fov in fovs:
                fov.extract_from(spec_source)
                fov.view()
                implane.add(fov.hdu, wcs_suffix="D")

            plt.imshow(implane.data, origin="lower")
            plt.show()
Esempio n. 6
0
def basic_image_plane():
    implane = ImagePlane(_implane_header())

    return implane