Skip to content

Use ac.util.dataset.should_simulate for the 22 auto-simulate guards - #17

Merged
Jammy2211 merged 1 commit into
mainfrom
claude/pyautomind-simple-issue-x7gu1u
Aug 7, 2026
Merged

Use ac.util.dataset.should_simulate for the 22 auto-simulate guards#17
Jammy2211 merged 1 commit into
mainfrom
claude/pyautomind-simple-issue-x7gu1u

Conversation

@Jammy2211

Copy link
Copy Markdown
Collaborator

Summary

Pending release — library-first merge gate applies. Depends on PyAutoLabs/PyAutoCTI#106 (ac.util.dataset export); do not merge before that lands and the release floor covers it.

Migrates all auto-simulate guards from the raw if not path.exists(dataset_path): idiom to if ac.util.dataset.should_simulate(dataset_path):, restoring PYAUTO_SMALL_DATASETS=1 force-regeneration (an existing dataset dir is deleted so the simulator re-creates it at capped resolution). The 2026-07-27 census counted 21 sites; the sweep found 22 sites across 21 files (data_preparation/start_here.py has two guards) — all migrated, each confirmed to guard a directory path with a paired simulator subprocess. One line changed per site; pre-existing CRLF endings preserved in the 8 files that have them.

Also folds in the leg-6 side findings from the same PyAutoMind prompt (draft/maintenance/pyauto_cti/autocti_util_dataset_export.md):

  • simulate_datasets_missing.sh: fixed the reference to the nonexistent simulators/overview/non_uniform_charge_injection.pynon_uniform_cosmic_rays.py (the other referenced path was verified to exist).
  • Removed the dead first dataset_name = assignment in scripts/imaging_ci/extract.py and scripts/imaging_ci/data_preparation/examples/cosmic_ray_flagging.py.

Out of scope (left for a sibling task, per the prompt): purging the tracked dataset/overview/ and dataset/dataset_1d/ trees.

Scripts touched

All under scripts/: imaging_ci/advanced/chaining/pipelines/{parallel,serial,parallel_x2__serial_x2}.py, imaging_ci/advanced/chaining/x1_species_to_x2_species.py, imaging_ci/{correction,modeling,data_preparation}/start_here.py (data_preparation ×2 sites), imaging_ci/modeling/features/{cosmic_rays,non_uniform,serial_cti,visualize_full}.py, imaging_ci/data_preparation/examples/{bias_subtraction,cosmic_ray_flagging,pre_cti,pre_cti_and_cosmics,serial_cti}.py, imaging_ci/extract.py, plot/plotters/{ImagingCIPlotter,FitImagingCIPlotter,MultiFigurePlotter}.py, plot/diagnostics/imaging_ci/well_filling.py.

Validation

Against the sibling PyAutoCTI branch (Python 3.12, arcticpy 2.6):

  • python -m py_compile passes on all 21 edited files; grep confirms zero raw guards remain in scripts/.
  • scripts/imaging_ci/extract.py run end-to-end with the dataset absent: the new guard fired, simulated dataset/imaging_ci/simple, script exited 0.
  • Force-regeneration witnessed: a marker file placed in the dataset dir disappeared on a PYAUTO_SMALL_DATASETS=1 rerun (dir deleted + re-simulated), script exited 0.
  • scripts/imaging_ci/data_preparation/examples/cosmic_ray_flagging.py (guard + dead-assignment removal) exited 0.

Notebooks

Not regenerated: autocti is not a registered PyAutoHands generate target (absent from COLAB_PROJECTS and workspaces.yaml), and per this workspace's AGENTS.md notebook regeneration runs through the PyAutoHands release pipeline. The 22 matching guard occurrences across 21 notebooks will pick up the change at the next pipeline regen.

Could not update

None — all 22 census sites migrated.

🤖 Generated with Claude Code

https://claude.ai/code/session_01Vu1p9rcDQGRrYddB6VWcxN


Generated by Claude Code

Migrate all 22 dataset auto-simulation guards (21 scripts) from the raw
'if not path.exists(dataset_path):' idiom to
'if ac.util.dataset.should_simulate(dataset_path):'. should_simulate
restores the PYAUTO_SMALL_DATASETS=1 force-regeneration behaviour: it
deletes an existing dataset directory so the simulator re-runs at capped
resolution, instead of silently reusing a full-resolution dataset. This
depends on the PyAutoCTI ac.util.dataset export (alias of autoarray's
dataset_util) landing on the same-named branch.

Also:
- fix simulate_datasets_missing.sh, which referenced the nonexistent
  simulators/overview/non_uniform_charge_injection.py (real file:
  non_uniform_cosmic_rays.py)
- drop the dead first dataset_name assignments (immediately overwritten)
  in imaging_ci/extract.py and
  imaging_ci/data_preparation/examples/cosmic_ray_flagging.py

Notebooks are not regenerated here: autocti is not registered in
PyAutoHands COLAB_PROJECTS, so regeneration happens via the PyAutoHands
release pipeline.

Co-Authored-By: Claude Fable 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01Vu1p9rcDQGRrYddB6VWcxN
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants