Skip to content

Commit

Permalink
refactor removing Masked objects
Browse files Browse the repository at this point in the history
  • Loading branch information
Jammy2211 committed Apr 8, 2021
2 parents e933cef + 1e370c6 commit a5a6d01
Show file tree
Hide file tree
Showing 38 changed files with 678 additions and 1,186 deletions.
3 changes: 1 addition & 2 deletions autocti/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,13 @@
from autoarray.instruments import euclid
from autoarray.instruments import acs
from autoarray.dataset import preprocess
from autoarray.dataset.imaging import Imaging

from autocti.structures.lines import Line
from autocti.structures.lines import LineCollection

from .mask.mask import Mask2D
from .mask.mask import SettingsMask
from .dataset.imaging import Imaging
from .dataset.imaging import MaskedImaging
from .dataset.warm_pixels import find_warm_pixels
from . import charge_injection as ci
from .analysis.analysis import AnalysisCIImaging
Expand Down
4 changes: 2 additions & 2 deletions autocti/analysis/analysis.py
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ def fit_from_instance_and_ci_imaging(
)

return ci_fit.CIFitImaging(
masked_ci_imaging=ci_imaging,
ci_imaging=ci_imaging,
ci_post_cti=ci_post_cti,
hyper_noise_scalars=hyper_noise_scalars,
)
Expand Down Expand Up @@ -241,7 +241,7 @@ def pipe_cti(ci_data_masked, instance, clocker, hyper_noise_scalars):
)

fit = ci_fit.CIFitImaging(
masked_ci_imaging=ci_data_masked,
ci_imaging=ci_data_masked,
ci_post_cti=ci_post_cti,
hyper_noise_scalars=hyper_noise_scalars,
)
Expand Down
14 changes: 7 additions & 7 deletions autocti/analysis/visualizer.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ def should_plot(name):
imaging=ci_imaging, mat_plot_2d=mat_plot_2d, include_2d=self.include_2d
)

ci_imaging_plotter.figures(
ci_imaging_plotter.figures_2d(
image=should_plot("data"),
noise_map=should_plot("noise_map"),
inverse_noise_map=should_plot("inverse_noise_map"),
Expand Down Expand Up @@ -94,7 +94,7 @@ def should_plot(name):
fit=fit, mat_plot_2d=mat_plot_2d, include_2d=self.include_2d
)

ci_fit_plotter.figures(
ci_fit_plotter.figures_2d(
image=should_plot("data"),
noise_map=should_plot("noise_map"),
signal_to_noise_map=should_plot("signal_to_noise_map"),
Expand All @@ -109,7 +109,7 @@ def should_plot(name):

if should_plot("all_at_end_png"):

ci_fit_plotter.figures(
ci_fit_plotter.figures_2d(
image=True,
noise_map=True,
signal_to_noise_map=True,
Expand Down Expand Up @@ -183,17 +183,17 @@ def should_plot(name):

if should_plot("subplot_residual_maps"):
multi_plotter.subplot_of_figure(
func_name="figures", figure_name="residual_map"
func_name="figures_2d", figure_name="residual_map"
)

if should_plot("subplot_normalized_residual_maps"):
multi_plotter.subplot_of_figure(
func_name="figures", figure_name="normalized_residual_map"
func_name="figures_2d", figure_name="normalized_residual_map"
)

if should_plot("subplot_chi_squared_maps"):
multi_plotter.subplot_of_figure(
func_name="figures", figure_name="chi_squared_map"
func_name="figures_2d", figure_name="chi_squared_map"
)

def visualize_multiple_ci_fits_subplots_1d_lines(self, fits, line_region):
Expand Down Expand Up @@ -241,7 +241,7 @@ def visualize_fit_in_fits(self, fit):
fit=fit, mat_plot_2d=mat_plot_2d, include_2d=self.include_2d
)

ci_fit_plotter.figures(
ci_fit_plotter.figures_2d(
image=True,
noise_map=True,
signal_to_noise_map=True,
Expand Down
4 changes: 2 additions & 2 deletions autocti/charge_injection/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@
from .ci_hyper import CIHyperNoiseScalar
from .ci_hyper import CIHyperNoiseCollection
from .ci_imaging import CIImaging
from .ci_imaging import SettingsMaskedCIImaging
from .ci_imaging import MaskedCIImaging
from .ci_imaging import SettingsCIImaging
from .ci_imaging import CIImaging
from .ci_imaging import SimulatorCIImaging
from .ci_mask import SettingsCIMask
from .ci_mask import CIMask2D
Expand Down
19 changes: 8 additions & 11 deletions autocti/charge_injection/ci_fit.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,17 +6,14 @@

class CIFitImaging(fit.FitImaging):
def __init__(
self,
masked_ci_imaging: ci_imaging.MaskedCIImaging,
ci_post_cti,
hyper_noise_scalars=None,
self, ci_imaging: ci_imaging.CIImaging, ci_post_cti, hyper_noise_scalars=None
):
"""Fit a charge injection ci_data-set with a model cti image, also scalng the noises within a Bayesian
framework.
Parameters
-----------
masked_ci_imaging
ci_imaging
The charge injection image that is fitted.
cti_params : arctic_params.ArcticParams
The cti model parameters which describe how CTI during clocking.
Expand All @@ -26,22 +23,22 @@ def __init__(
The ci_hyper-parameter(s) which the noise_scaling_maps_list is multiplied by to scale the noise-map.
"""

self.ci_masked_data = masked_ci_imaging
self.ci_masked_data = ci_imaging
self.hyper_noise_scalars = hyper_noise_scalars

if hyper_noise_scalars is not None and len(hyper_noise_scalars) > 0:

self.noise_scaling_maps = masked_ci_imaging.noise_scaling_maps
self.noise_scaling_maps = ci_imaging.noise_scaling_maps

noise_map = hyper_noise_map_from_noise_map_and_noise_scalings(
hyper_noise_scalars=hyper_noise_scalars,
noise_scaling_maps=masked_ci_imaging.noise_scaling_maps,
noise_map=masked_ci_imaging.noise_map,
noise_scaling_maps=ci_imaging.noise_scaling_maps,
noise_map=ci_imaging.noise_map,
)

masked_ci_imaging = masked_ci_imaging.modify_noise_map(noise_map=noise_map)
ci_imaging = ci_imaging.modify_noise_map(noise_map=noise_map)

super().__init__(imaging=masked_ci_imaging, model_image=ci_post_cti)
super().__init__(imaging=ci_imaging, model_image=ci_post_cti)

@property
def masked_ci_imaging(self):
Expand Down
Loading

0 comments on commit a5a6d01

Please sign in to comment.