Skip to content

Commit

Permalink
fix unit tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Jammy2211 committed May 3, 2024
1 parent 93642b2 commit 702f574
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 6 deletions.
2 changes: 1 addition & 1 deletion autocti/charge_injection/plot/fit_ci_plotters.py
Original file line number Diff line number Diff line change
Expand Up @@ -265,7 +265,7 @@ def figures_1d(
)

if noise_map:
y = self.extract_region_from(array=self.fit.image, region=region)
y = self.extract_region_from(array=self.fit.data, region=region)

self.mat_plot_1d.plot_yx(
y=y,
Expand Down
3 changes: 3 additions & 0 deletions autocti/model/analysis.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,9 @@ def save_results_combined(self, paths: af.DirectoryPaths, result: ResultImagingC
The result of a model fit, including the non-linear search and samples.
"""

if result.samples is None:
return

weight_list = []
delta_ellipticity_list = []

Expand Down
1 change: 0 additions & 1 deletion docs/api/data.rst
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ grids of (y,x) Cartesian coordinates.
Mask2D
Array2D
Grid2D
Grid2DIterate
Grid2DIrregular

Charge Injection Imaging
Expand Down
7 changes: 7 additions & 0 deletions test_autocti/aggregator/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
from autoconf import conf
import autofit as af
import autocti as ac
from autoconf.conf import with_config
from autofit.non_linear.samples import Sample


Expand All @@ -28,6 +29,12 @@ def clean(database_file):
shutil.rmtree(result_path)


@with_config(
"general",
"output",
"samples_to_csv",
value=True,
)
def aggregator_from(database_file, analysis, model, samples):
result_path = path.join(conf.instance.output_path, database_file)

Expand Down
8 changes: 4 additions & 4 deletions test_autocti/charge_injection/model/test_analysis_ci.py
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,7 @@ def test__full_and_extracted_fits_from_instance_and_imaging_ci(

fit = ac.FitImagingCI(dataset=masked_dataset, post_cti_data=post_cti_data)

assert fit.image.shape == (7, 1)
assert fit.data.shape == (7, 1)
assert fit_analysis.log_likelihood == pytest.approx(fit.log_likelihood)

fit_full_analysis = analysis.fit_via_instance_and_dataset_from(
Expand All @@ -221,7 +221,7 @@ def test__full_and_extracted_fits_from_instance_and_imaging_ci(

fit = ac.FitImagingCI(dataset=imaging_ci_7x7, post_cti_data=post_cti_data)

assert fit.image.shape == (7, 7)
assert fit.data.shape == (7, 7)
assert fit_full_analysis.log_likelihood == pytest.approx(fit.log_likelihood)


Expand Down Expand Up @@ -273,7 +273,7 @@ def test__extracted_fits_from_instance_and_imaging_ci__include_noise_scaling(
},
)

assert fit.image.shape == (7, 1)
assert fit.data.shape == (7, 1)
assert fit.log_likelihood == pytest.approx(fit_analysis.log_likelihood, 1.0e-4)

fit = ac.FitImagingCI(
Expand All @@ -300,7 +300,7 @@ def test__extracted_fits_from_instance_and_imaging_ci__include_noise_scaling(
},
)

assert fit.image.shape == (7, 7)
assert fit.data.shape == (7, 7)
assert fit.log_likelihood == pytest.approx(fit_full_analysis.log_likelihood, 1.0e-4)

fit = ac.FitImagingCI(
Expand Down

0 comments on commit 702f574

Please sign in to comment.