def test__individual_attributes_are_output(dataset_line_7, plot_path, plot_patch): dataset_line_plotter = aplt.DatasetLinePlotter( dataset_line=dataset_line_7, mat_plot_1d=aplt.MatPlot1D( output=aplt.Output(plot_path, format="png")), ) dataset_line_plotter.figures_1d(data=True, noise_map=True, pre_cti_data=True, signal_to_noise_map=True) assert path.join(plot_path, "data.png") in plot_patch.paths assert path.join(plot_path, "noise_map.png") in plot_patch.paths assert path.join(plot_path, "pre_cti_data.png") in plot_patch.paths assert path.join(plot_path, "signal_to_noise_map.png") in plot_patch.paths plot_patch.paths = [] dataset_line_plotter.figures_1d(data=True, pre_cti_data=True) assert path.join(plot_path, "data.png") in plot_patch.paths assert path.join(plot_path, "noise_map.png") not in plot_patch.paths assert path.join(plot_path, "pre_cti_data.png") in plot_patch.paths assert path.join(plot_path, "signal_to_noise_map.png") not in plot_patch.paths
def test__fit_line_subplots_are_output(fit_line_7, plot_path, plot_patch): fit_ci_plotter = aplt.FitDatasetLinePlotter( fit=fit_line_7, mat_plot_1d=aplt.MatPlot1D( output=aplt.Output(plot_path, format="png")), ) fit_ci_plotter.subplot_fit_dataset_line() assert path.join(plot_path, "subplot_fit_dataset_line.png") in plot_patch.paths
def test__subplot_dataset_line__is_output(dataset_line_7, plot_path, plot_patch): dataset_line_plotter = aplt.DatasetLinePlotter( dataset_line=dataset_line_7, mat_plot_1d=aplt.MatPlot1D( output=aplt.Output(plot_path, format="png")), ) dataset_line_plotter.subplot_dataset_line() assert path.join(plot_path, "subplot_dataset_line.png") in plot_patch.paths
def test__individual_attribute_plots__all_plot_correctly( fit_ci_7x7, plot_path, plot_patch): fit_ci_plotter = aplt.FitImagingCIPlotter( fit=fit_ci_7x7, mat_plot_2d=aplt.MatPlot2D( output=aplt.Output(plot_path, format="png")), mat_plot_1d=aplt.MatPlot1D( output=aplt.Output(plot_path, format="png")), ) fit_ci_plotter.figures_2d( image=True, noise_map=True, signal_to_noise_map=True, pre_cti_data=True, post_cti_data=True, residual_map=True, normalized_residual_map=True, chi_squared_map=True, ) assert path.join(plot_path, "image_2d.png") in plot_patch.paths assert path.join(plot_path, "noise_map.png") in plot_patch.paths assert path.join(plot_path, "signal_to_noise_map.png") in plot_patch.paths assert path.join(plot_path, "pre_cti_data.png") in plot_patch.paths assert path.join(plot_path, "post_cti_data.png") in plot_patch.paths assert path.join(plot_path, "residual_map.png") in plot_patch.paths assert path.join(plot_path, "normalized_residual_map.png") in plot_patch.paths assert path.join(plot_path, "chi_squared_map.png") in plot_patch.paths plot_patch.paths = [] fit_ci_plotter.figures_2d( image=True, noise_map=False, signal_to_noise_map=False, pre_cti_data=True, post_cti_data=True, chi_squared_map=True, ) assert path.join(plot_path, "image_2d.png") in plot_patch.paths assert path.join(plot_path, "noise_map.png") not in plot_patch.paths assert path.join(plot_path, "signal_to_noise_map.png") not in plot_patch.paths assert path.join(plot_path, "pre_cti_data.png") in plot_patch.paths assert path.join(plot_path, "post_cti_data.png") in plot_patch.paths assert path.join(plot_path, "residual_map.png") not in plot_patch.paths assert path.join(plot_path, "chi_squared_map.png") in plot_patch.paths
def test__subplot_ci_lines__is_output(imaging_ci_7x7, plot_path, plot_patch): imaging_ci_plotter = aplt.ImagingCIPlotter( imaging=imaging_ci_7x7, mat_plot_2d=aplt.MatPlot2D( output=aplt.Output(plot_path, format="png")), mat_plot_1d=aplt.MatPlot1D( output=aplt.Output(plot_path, format="png")), ) imaging_ci_plotter.subplot_imaging_ci() assert path.join(plot_path, "subplot_imaging_ci.png") in plot_patch.paths imaging_ci_plotter.subplot_1d_ci_line_region( line_region="parallel_front_edge") assert (path.join(plot_path, "subplot_1d_ci_parallel_front_edge.png") in plot_patch.paths)
def test__fit_ci_subplots_are_output(fit_ci_7x7, plot_path, plot_patch): fit_ci_plotter = aplt.FitImagingCIPlotter( fit=fit_ci_7x7, mat_plot_2d=aplt.MatPlot2D( output=aplt.Output(plot_path, format="png")), mat_plot_1d=aplt.MatPlot1D( output=aplt.Output(plot_path, format="png")), ) fit_ci_plotter.subplot_fit_ci() assert path.join(plot_path, "subplot_fit_ci.png") in plot_patch.paths fit_ci_plotter.subplot_1d_ci_line_region(line_region="parallel_front_edge") assert (path.join(plot_path, "subplot_1d_fit_ci_parallel_front_edge.png") in plot_patch.paths) fit_ci_plotter.subplot_noise_scaling_map_list() assert (path.join(plot_path, "subplot_noise_scaling_map_list.png") in plot_patch.paths)
def test__individual_lines_are_output(imaging_ci_7x7, plot_path, plot_patch): imaging_ci_plotter = aplt.ImagingCIPlotter( imaging=imaging_ci_7x7, mat_plot_1d=aplt.MatPlot1D( output=aplt.Output(plot_path, format="png")), ) imaging_ci_plotter.figures_1d_ci_line_region( line_region="parallel_front_edge", image=True, noise_map=True, pre_cti_data=True, signal_to_noise_map=True, ) assert path.join(plot_path, "image_parallel_front_edge.png") in plot_patch.paths assert path.join(plot_path, "noise_map_parallel_front_edge.png") in plot_patch.paths assert (path.join(plot_path, "pre_cti_data_parallel_front_edge.png") in plot_patch.paths) assert (path.join(plot_path, "signal_to_noise_map_parallel_front_edge.png") in plot_patch.paths) plot_patch.paths = [] imaging_ci_plotter.figures_1d_ci_line_region( line_region="parallel_front_edge", image=True, pre_cti_data=True) assert path.join(plot_path, "image_parallel_front_edge.png") in plot_patch.paths assert (path.join(plot_path, "noise_map_parallel_front_edge.png") not in plot_patch.paths) assert (path.join(plot_path, "pre_cti_data_parallel_front_edge.png") in plot_patch.paths) assert (path.join(plot_path, "signal_to_noise_map_parallel_front_edge.png") not in plot_patch.paths)
def test__individual_attributes_are_output(imaging_ci_7x7, plot_path, plot_patch): imaging_ci_plotter = aplt.ImagingCIPlotter( imaging=imaging_ci_7x7, mat_plot_2d=aplt.MatPlot2D( output=aplt.Output(plot_path, format="png")), mat_plot_1d=aplt.MatPlot1D( output=aplt.Output(plot_path, format="png")), ) imaging_ci_7x7.cosmic_ray_map[0, 0] = 1.0 imaging_ci_plotter.figures_2d( image=True, noise_map=True, pre_cti_data=True, signal_to_noise_map=True, cosmic_ray_map=True, ) assert path.join(plot_path, "image_2d.png") in plot_patch.paths assert path.join(plot_path, "noise_map.png") in plot_patch.paths assert path.join(plot_path, "pre_cti_data.png") in plot_patch.paths assert path.join(plot_path, "signal_to_noise_map.png") in plot_patch.paths assert path.join(plot_path, "cosmic_ray_map.png") in plot_patch.paths plot_patch.paths = [] imaging_ci_plotter.figures_2d(image=True, pre_cti_data=True) assert path.join(plot_path, "image_2d.png") in plot_patch.paths assert path.join(plot_path, "noise_map.png") not in plot_patch.paths assert path.join(plot_path, "pre_cti_data.png") in plot_patch.paths assert path.join(plot_path, "signal_to_noise_map.png") not in plot_patch.paths
def test__individual_line_attriutes_plot__all_plot_correctly_output( fit_ci_7x7, plot_path, plot_patch): fit_ci_plotter = aplt.FitImagingCIPlotter( fit=fit_ci_7x7, mat_plot_2d=aplt.MatPlot2D( output=aplt.Output(plot_path, format="png")), mat_plot_1d=aplt.MatPlot1D( output=aplt.Output(plot_path, format="png")), ) fit_ci_plotter.figures_1d_ci_line_region( line_region="parallel_front_edge", image=True, noise_map=True, signal_to_noise_map=True, pre_cti_data=True, post_cti_data=True, residual_map=True, normalized_residual_map=True, chi_squared_map=True, ) assert path.join(plot_path, "image_parallel_front_edge.png") in plot_patch.paths assert path.join(plot_path, "noise_map_parallel_front_edge.png") in plot_patch.paths assert (path.join(plot_path, "signal_to_noise_map_parallel_front_edge.png") in plot_patch.paths) assert (path.join(plot_path, "pre_cti_data_parallel_front_edge.png") in plot_patch.paths) assert (path.join(plot_path, "post_cti_data_parallel_front_edge.png") in plot_patch.paths) assert (path.join(plot_path, "residual_map_parallel_front_edge.png") in plot_patch.paths) assert (path.join(plot_path, "normalized_residual_map_parallel_front_edge.png") in plot_patch.paths) assert (path.join(plot_path, "chi_squared_map_parallel_front_edge.png") in plot_patch.paths) plot_patch.paths = [] fit_ci_plotter.figures_1d_ci_line_region( line_region="parallel_front_edge", image=True, noise_map=False, signal_to_noise_map=False, pre_cti_data=True, post_cti_data=True, chi_squared_map=True, ) assert path.join(plot_path, "image_parallel_front_edge.png") in plot_patch.paths assert (path.join(plot_path, "noise_map_parallel_front_edge.png") not in plot_patch.paths) assert (path.join(plot_path, "signal_to_noise_map_parallel_front_edge.png") not in plot_patch.paths) assert (path.join(plot_path, "pre_cti_data_parallel_front_edge.png") in plot_patch.paths) assert (path.join(plot_path, "post_cti_data_parallel_front_edge.png") in plot_patch.paths) assert (path.join(plot_path, "residual_map_parallel_front_edge.png") not in plot_patch.paths) assert (path.join(plot_path, "chi_squared_map_parallel_front_edge.png") in plot_patch.paths)
] dataset_line_plotter = aplt.DatasetLinePlotter(dataset_line=dataset_line_list[0]) dataset_line_plotter.subplot_dataset_line() """ __Output__ Output a subplot of the line data, noise-map and pre cti image to .png files. """ for dataset_line in dataset_line_list: filename = f"dataset_line_{dataset_line.layout.normalization}" mat_plot_1d = aplt.MatPlot1D( output=aplt.Output(path=dataset_path, filename=filename, format="png") ) dataset_line_plotter = aplt.DatasetLinePlotter( dataset_line=dataset_line, mat_plot_1d=mat_plot_1d ) dataset_line_plotter.subplot_dataset_line() """ Output the line data, noise-map and pre cti image of the charge injection dataset to .fits files. """ [ dataset_line.output_to_fits( data_path=path.join( dataset_path, f"data_{dataset_line.layout.normalization}.fits" ),