Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ repo.

**The list is a representative set, ordered by dependency.** Since 2026-11-05
(cti-upkeep 3a, autocti_workspace#43) it covers every area — `overview/`,
`dataset_1d/`, `imaging_ci/`, `plot/` — with 36 scripts. Scripts run in the file's
`dataset_1d/`, `imaging_ci/`, `plot/` — with 44 scripts. Scripts run in the file's
order, so each group lists its simulator before the scripts that load its data,
and a fit before the database and plot scripts that read its results. Add a new
entry in its group, after anything it depends on, and time it from a fresh clone
Expand Down
8 changes: 6 additions & 2 deletions notebooks/dataset_1d/advanced/temporal/database.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -110,14 +110,18 @@
"Interpolation uses the maximum log likelihood model of each fit to build an interpolation model of the CTI as a\n",
"function of time. \n",
"\n",
"We therefore first create a list of instances of these maximum log likelihood models via the database."
"We therefore first create a list of instances of these maximum log likelihood models via the database.\n",
"\n",
"Each fit in `fit.py` is a `FactorGraphModel` over the charge injection datasets taken at one time, so its instance\n",
"holds one entry per dataset (`instance[0]`, `instance[1]`, ...) plus the shared `factor`. Every entry carries the\n",
"same `cti` model and `time`, so we take the first, `[0]`, which is what `fit.py` does via `result_list[0].instance`."
]
},
{
"cell_type": "code",
"metadata": {},
"source": [
"ml_instances_list = [samps.max_log_likelihood() for samps in agg.values(\"samples\")]"
"ml_instances_list = [samps.max_log_likelihood()[0] for samps in agg.values(\"samples\")]"
],
"outputs": [],
"execution_count": null
Expand Down
11 changes: 7 additions & 4 deletions notebooks/dataset_1d/advanced/temporal/plot.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -111,23 +111,26 @@
"space mission. \n",
"\n",
"We produce this plot by extracting the trap density from the median PDF model, with errors at the 3.0 sigma confidence\n",
"level. We also extract the time at which each dataset was acquired."
"level. We also extract the time at which each dataset was acquired.\n",
"\n",
"Each fit is a `FactorGraphModel` over the datasets taken at one time, so every instance holds one entry per dataset\n",
"plus the shared `factor`. Every entry carries the same `cti` model and `time`, so we take the first, `[0]`."
]
},
{
"cell_type": "code",
"metadata": {},
"source": [
"mp_instances_list = [samps.median_pdf() for samps in agg.values(\"samples\")]\n",
"mp_instances_list = [samps.median_pdf()[0] for samps in agg.values(\"samples\")]\n",
"density_mp_list = [instance.cti.trap_list[0].density for instance in mp_instances_list]\n",
"\n",
"ue3_instance_list = [\n",
" samps.errors_at_upper_sigma(sigma=3.0) for samps in agg.values(\"samples\")\n",
" samps.errors_at_upper_sigma(sigma=3.0)[0] for samps in agg.values(\"samples\")\n",
"]\n",
"density_ue3_list = [instance.cti.trap_list[0].density for instance in ue3_instance_list]\n",
"\n",
"le3_instance_list = [\n",
" samps.errors_at_lower_sigma(sigma=3.0) for samps in agg.values(\"samples\")\n",
" samps.errors_at_lower_sigma(sigma=3.0)[0] for samps in agg.values(\"samples\")\n",
"]\n",
"density_le3_list = [instance.cti.trap_list[0].density for instance in le3_instance_list]\n",
"\n",
Expand Down
30 changes: 18 additions & 12 deletions notebooks/imaging_ci/advanced/chaining/noise_scaling.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -97,8 +97,8 @@
"cell_type": "code",
"metadata": {},
"source": [
"dataset_name = \"simple\"\n",
"dataset_path = path.join(\"dataset\", \"imaging_ci\", \"poisson\", dataset_name)"
"dataset_name = \"poisson\"\n",
"dataset_path = path.join(\"dataset\", \"imaging_ci\", dataset_name)"
],
"outputs": [],
"execution_count": null
Expand Down Expand Up @@ -330,7 +330,8 @@
"metadata": {},
"source": [
"analysis_1_list = [\n",
" ac.AnalysisImagingCI(dataset=dataset, clocker=clocker) for dataset in dataset_list\n",
" ac.AnalysisImagingCI(dataset=dataset, clocker=clocker, dataset_full=dataset_full)\n",
" for dataset, dataset_full in zip(dataset_list, imaging_ci_full_list)\n",
"]"
],
"outputs": [],
Expand Down Expand Up @@ -381,19 +382,22 @@
"We now set each charge injection imaging dataset with a noise scaling map, where this noise-scaling map is the\n",
"chi-squared values of different regions of the image.\n",
"\n",
"For this script we only perform noise map scaling in one region of the data, the parallel EPERs."
"For this script we only perform noise map scaling in one region of the data, the parallel EPERs.\n",
"\n",
"The full (unmasked) copy of each dataset gets the same noise scaling maps, because visualization of the model-fit\n",
"also fits the full dataset and scales its noise in the same way."
]
},
{
"cell_type": "code",
"metadata": {},
"source": [
"[\n",
" imaging_ci.set_noise_scaling_map_dict(\n",
" noise_scaling_map_dict=result_1.noise_scaling_map_dict\n",
" )\n",
" for dataset, result_1 in zip(dataset_list, result_1_list)\n",
"]"
"for dataset, dataset_full, result_1 in zip(\n",
" dataset_list, imaging_ci_full_list, result_1_list\n",
"):\n",
" noise_scaling_map_dict = result_1.noise_scaling_map_dict\n",
" dataset.noise_scaling_map_dict = noise_scaling_map_dict\n",
" dataset_full.noise_scaling_map_dict = noise_scaling_map_dict"
],
"outputs": [],
"execution_count": null
Expand Down Expand Up @@ -449,7 +453,8 @@
"metadata": {},
"source": [
"analysis_2_list = [\n",
" ac.AnalysisImagingCI(dataset=dataset, clocker=clocker) for dataset in dataset_list\n",
" ac.AnalysisImagingCI(dataset=dataset, clocker=clocker, dataset_full=dataset_full)\n",
" for dataset, dataset_full in zip(dataset_list, imaging_ci_full_list)\n",
"]"
],
"outputs": [],
Expand Down Expand Up @@ -595,7 +600,8 @@
"metadata": {},
"source": [
"analysis_3_list = [\n",
" ac.AnalysisImagingCI(dataset=dataset, clocker=clocker) for dataset in dataset_list\n",
" ac.AnalysisImagingCI(dataset=dataset, clocker=clocker, dataset_full=dataset_full)\n",
" for dataset, dataset_full in zip(dataset_list, imaging_ci_full_list)\n",
"]"
],
"outputs": [],
Expand Down
2 changes: 1 addition & 1 deletion notebooks/plot/diagnostics/imaging_ci/well_filling.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@
" layout.extract.parallel_eper.binned_array_1d_from(\n",
" array=dataset.data,\n",
" settings=ac.SettingsExtract(pixels=(0, 1)),\n",
" )\n",
" )[0]\n",
" )\n",
" for dataset, layout in zip(dataset_list, layout_list)\n",
"]\n",
Expand Down
6 changes: 5 additions & 1 deletion scripts/dataset_1d/advanced/temporal/database.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,12 @@
function of time.

We therefore first create a list of instances of these maximum log likelihood models via the database.

Each fit in `fit.py` is a `FactorGraphModel` over the charge injection datasets taken at one time, so its instance
holds one entry per dataset (`instance[0]`, `instance[1]`, ...) plus the shared `factor`. Every entry carries the
same `cti` model and `time`, so we take the first, `[0]`, which is what `fit.py` does via `result_list[0].instance`.
"""
ml_instances_list = [samps.max_log_likelihood() for samps in agg.values("samples")]
ml_instances_list = [samps.max_log_likelihood()[0] for samps in agg.values("samples")]

"""
__Interpolation__
Expand Down
9 changes: 6 additions & 3 deletions scripts/dataset_1d/advanced/temporal/plot.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,17 +47,20 @@

We produce this plot by extracting the trap density from the median PDF model, with errors at the 3.0 sigma confidence
level. We also extract the time at which each dataset was acquired.

Each fit is a `FactorGraphModel` over the datasets taken at one time, so every instance holds one entry per dataset
plus the shared `factor`. Every entry carries the same `cti` model and `time`, so we take the first, `[0]`.
"""
mp_instances_list = [samps.median_pdf() for samps in agg.values("samples")]
mp_instances_list = [samps.median_pdf()[0] for samps in agg.values("samples")]
density_mp_list = [instance.cti.trap_list[0].density for instance in mp_instances_list]

ue3_instance_list = [
samps.errors_at_upper_sigma(sigma=3.0) for samps in agg.values("samples")
samps.errors_at_upper_sigma(sigma=3.0)[0] for samps in agg.values("samples")
]
density_ue3_list = [instance.cti.trap_list[0].density for instance in ue3_instance_list]

le3_instance_list = [
samps.errors_at_lower_sigma(sigma=3.0) for samps in agg.values("samples")
samps.errors_at_lower_sigma(sigma=3.0)[0] for samps in agg.values("samples")
]
density_le3_list = [instance.cti.trap_list[0].density for instance in le3_instance_list]

Expand Down
28 changes: 17 additions & 11 deletions scripts/imaging_ci/advanced/chaining/noise_scaling.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,8 @@

The paths pointing to the dataset we will use for CTI modeling.
"""
dataset_name = "simple"
dataset_path = path.join("dataset", "imaging_ci", "poisson", dataset_name)
dataset_name = "poisson"
dataset_path = path.join("dataset", "imaging_ci", dataset_name)

"""
__Layout__
Expand Down Expand Up @@ -183,7 +183,8 @@
provides a reasonably accurate CTI model.
"""
analysis_1_list = [
ac.AnalysisImagingCI(dataset=dataset, clocker=clocker) for dataset in dataset_list
ac.AnalysisImagingCI(dataset=dataset, clocker=clocker, dataset_full=dataset_full)
for dataset, dataset_full in zip(dataset_list, imaging_ci_full_list)
]

"""
Expand Down Expand Up @@ -218,13 +219,16 @@
chi-squared values of different regions of the image.

For this script we only perform noise map scaling in one region of the data, the parallel EPERs.

The full (unmasked) copy of each dataset gets the same noise scaling maps, because visualization of the model-fit
also fits the full dataset and scales its noise in the same way.
"""
[
imaging_ci.set_noise_scaling_map_dict(
noise_scaling_map_dict=result_1.noise_scaling_map_dict
)
for dataset, result_1 in zip(dataset_list, result_1_list)
]
for dataset, dataset_full, result_1 in zip(
dataset_list, imaging_ci_full_list, result_1_list
):
noise_scaling_map_dict = result_1.noise_scaling_map_dict
dataset.noise_scaling_map_dict = noise_scaling_map_dict
dataset_full.noise_scaling_map_dict = noise_scaling_map_dict

"""
__Model (Search 2)__
Expand Down Expand Up @@ -258,7 +262,8 @@
more accurate and precise.
"""
analysis_2_list = [
ac.AnalysisImagingCI(dataset=dataset, clocker=clocker) for dataset in dataset_list
ac.AnalysisImagingCI(dataset=dataset, clocker=clocker, dataset_full=dataset_full)
for dataset, dataset_full in zip(dataset_list, imaging_ci_full_list)
]

"""
Expand Down Expand Up @@ -349,7 +354,8 @@
more accurate and precise.
"""
analysis_3_list = [
ac.AnalysisImagingCI(dataset=dataset, clocker=clocker) for dataset in dataset_list
ac.AnalysisImagingCI(dataset=dataset, clocker=clocker, dataset_full=dataset_full)
for dataset, dataset_full in zip(dataset_list, imaging_ci_full_list)
]

"""
Expand Down
2 changes: 1 addition & 1 deletion scripts/plot/diagnostics/imaging_ci/well_filling.py
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@
layout.extract.parallel_eper.binned_array_1d_from(
array=dataset.data,
settings=ac.SettingsExtract(pixels=(0, 1)),
)
)[0]
)
for dataset, layout in zip(dataset_list, layout_list)
]
Expand Down
8 changes: 8 additions & 0 deletions smoke_tests.txt
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@ dataset_1d/correction/start_here.py
dataset_1d/extract.py
dataset_1d/simulators/examples/temporal.py
dataset_1d/advanced/temporal/fit.py
dataset_1d/advanced/temporal/database.py
dataset_1d/advanced/temporal/plot.py

# imaging_ci: simulate, model, data preparation, correction, extract, chaining
imaging_ci/simulators/start_here.py
Expand All @@ -39,6 +41,8 @@ imaging_ci/data_preparation/examples/cosmic_ray_flagging.py
imaging_ci/correction/start_here.py
imaging_ci/extract.py
imaging_ci/advanced/chaining/pipelines/parallel.py
imaging_ci/simulators/examples/poisson_traps.py
imaging_ci/advanced/chaining/noise_scaling.py

# plot: plotters, one CCD chain (simulate, fit, database), diagnostics
plot/start_here.py
Expand All @@ -47,5 +51,9 @@ plot/plotters/FitImagingCIPlotter.py
plot/ccd/dataset_1d/simulator.py
plot/ccd/dataset_1d/fit.py
plot/ccd/dataset_1d/database.py
plot/fpa/imaging_ci/simulator.py
plot/fpa/imaging_ci/fit.py
plot/fpa/imaging_ci/database.py
plot/diagnostics/imaging_ci/simulator.py
plot/diagnostics/imaging_ci/well_filling.py
plot/diagnostics/imaging_ci/fpr_vs_eper.py
Loading