Ejemplo n.º 1
0
    def test__from_post_cti_data(self, clocker_1d, traps_x2, ccd):

        layout = ac.Layout1DLine(shape_1d=(5,), region_list=[(0, 5)])
        simulator = ac.SimulatorDatasetLine(
            pixel_scales=1.0,
            normalization=10.0,
            read_noise=4.0,
            add_poisson_noise=False,
            noise_seed=1,
        )

        dataset_line = simulator.from_layout(
            layout=layout, clocker=clocker_1d, trap_list=traps_x2, ccd=ccd
        )

        pre_cti_data = simulator.pre_cti_data_from(
            layout=layout, pixel_scales=1.0
        ).native

        post_cti_data = clocker_1d.add_cti(
            data=pre_cti_data, trap_list=traps_x2, ccd=ccd
        )

        dataset_line_via_post_cti_data = simulator.from_post_cti_data(
            post_cti_data=post_cti_data, pre_cti_data=pre_cti_data.native, layout=layout
        )

        assert (dataset_line.data == dataset_line_via_post_cti_data.data).all()
        assert (
            dataset_line.noise_map == dataset_line_via_post_cti_data.noise_map
        ).all()
        assert (
            dataset_line.pre_cti_data == dataset_line_via_post_cti_data.pre_cti_data
        ).all()
Ejemplo n.º 2
0
    def test__pre_cti_data_from(self):

        simulator = ac.SimulatorDatasetLine(normalization=10.0, pixel_scales=1.0)

        layout = ac.Layout1DLine(shape_1d=(3,), region_list=[(0, 2)])

        pre_cti_data = simulator.pre_cti_data_from(layout=layout, pixel_scales=1.0)

        print(pre_cti_data)

        assert (pre_cti_data.native == np.array([10.0, 10.0, 0.0])).all()
Ejemplo n.º 3
0
    def test__no_instrumental_effects_input__only_cti_simulated(
        self, clocker_1d, traps_x2, ccd
    ):

        layout = ac.Layout1DLine(shape_1d=(5,), region_list=[(0, 5)])

        simulator = ac.SimulatorDatasetLine(
            pixel_scales=1.0, normalization=10.0, add_poisson_noise=False
        )

        dataset_line = simulator.from_layout(
            layout=layout, clocker=clocker_1d, trap_list=traps_x2, ccd=ccd
        )

        assert dataset_line.data == pytest.approx(
            np.array([9.43, 9.43, 9.43, 9.43, 9.43]), 1e-1
        )
        assert dataset_line.layout == layout
Ejemplo n.º 4
0
    def test__include_read_noise__is_added_after_cti(self, clocker_1d, traps_x2, ccd):

        layout = ac.Layout1DLine(shape_1d=(5,), region_list=[(0, 5)])

        simulator = ac.SimulatorDatasetLine(
            pixel_scales=1.0,
            normalization=10.0,
            read_noise=1.0,
            add_poisson_noise=False,
            noise_seed=1,
        )

        dataset_line = simulator.from_layout(
            layout=layout, clocker=clocker_1d, trap_list=traps_x2, ccd=ccd
        )

        # Use seed to give us a known read noises map we'll test_autocti for

        assert dataset_line.data == pytest.approx(
            np.array([11.05513, 9.36790, 9.47129, 8.92700, 10.8654]), 1e-2
        )
        assert dataset_line.layout == layout
Ejemplo n.º 5
0
        region_list=region_1d_list,
        normalization=normalization,
        prescan=prescan,
        overscan=overscan,
    )
    for normalization in normalization_list
]


"""
__Simulate__

To simulate line data including CTI, we pass the line layout to a `SimulatorDatasetLine`, which adds CTI via arCTIc and 
read-noise to the data.
"""
simulator = ac.SimulatorDatasetLine(read_noise=0.001, pixel_scales=0.1)

"""
We now pass each line pattern to the simulator. This creates a list of instances of the `DatasetLine` class, which 
include the data (with CTI), noise-maps and the pre_cti lines.
"""
dataset_line_list = [
    simulator.from_layout(
        clocker=clocker, layout=layout, trap_list=[trap_0, trap_1], ccd=ccd
    )
    for layout in layout_list
]

dataset_line_plotter = aplt.DatasetLinePlotter(dataset_line=dataset_line_list[0])
dataset_line_plotter.subplot_dataset_line()