Skip to content

refactor: auto-simulate datasets with al.util.dataset.simulate_if_needed - #120

Merged
Jammy2211 merged 1 commit into
mainfrom
claude/pyautoarray-simulate-helper-yuqd16
Nov 1, 2026
Merged

Jammy2211 merged 1 commit into
mainfrom
claude/pyautoarray-simulate-helper-yuqd16

Conversation

@Jammy2211

Copy link
Copy Markdown
Collaborator

Part of PyAutoLabs/autogalaxy_workspace#268 (phase 3 of PyAutoLabs/PyAutoArray#669).

Merge only after the PyAutoArray release that carries PyAutoLabs/PyAutoArray#670. The tutorials call al.util.dataset.simulate_if_needed, which released PyAutoArray doesn't have yet.

Overlap: the Mind task howto-chapter2-format also claims this repo. Its branch isn't on GitHub, so overlap couldn't be checked. If it touches the same auto-simulate blocks, whichever merges second takes a small rebase.

Summary

Replaces the 8-line should_simulate + subprocess.run auto-simulate block with the one-line al.util.dataset.simulate_if_needed(dataset_path, simulator=...) in 24 tutorial scripts (29 blocks).

  • The rewrite is mechanical and done with an AST matcher, so it only touches the exact standard block. Dataset and simulator paths are kept exactly. A redundant str(...) around the path is dropped because the helper calls str() itself. Behaviour is unchanged.
  • One in-block comment, "Use the same Python interpreter as this tutorial.", is dropped together with the sys.executable call it described.
  • The 24 matching notebooks were regenerated with PyAutoHands generate.py howtolens --assistant-root <autolens_assistant>. I reverted unrelated generator noise (3 Colab-context refreshes and Unicode escaping in 3 notebooks), so each notebook diff is only this rewrite.

Testing

  • Every inserted call is identical to black's output, and all changed scripts compile.
  • check_dataset_allowlist: 30 guarded call sites before and 30 after.
  • Smoke run: chapter_1_introduction/tutorial_6_fitting.py passed against released autolens with merged PyAutoArray main, simulating its dataset through the helper.

Not changed

scripts/chapter_1_introduction/tutorial_5_data.py:696 simulates inline, so it isn't the standard block and was left as-is.

Merge mode: human /prm, after the release.


Generated by Claude Code

Replace the 8-line should_simulate + subprocess.run block with the
one-line util.dataset.simulate_if_needed(dataset_path, simulator=...)
helper (PyAutoArray#670): 29 blocks in 24 scripts. Mechanical rewrite:
dataset and simulator paths kept exactly; a redundant str(...) around
the path is dropped because the helper str()s it. Non-standard blocks
are untouched.
The one in-block comment ("Use the same Python interpreter as this
tutorial.") is dropped with the sys.executable call it described.

24 notebooks regenerated with PyAutoHands generate.py howtolens
--assistant-root autolens_assistant; unrelated Colab-context refreshes and
unicode-escaping noise from the generator were reverted, so each
notebook diff is only this rewrite.

check_dataset_allowlist reports the same guarded call-site count before
and after. Requires the PyAutoArray release that carries #670.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_016nhQ8NyQo2s3YUk8eUrrB3
@Jammy2211
Jammy2211 merged commit c17be87 into main Nov 1, 2026
8 checks passed
@Jammy2211
Jammy2211 deleted the claude/pyautoarray-simulate-helper-yuqd16 branch November 1, 2026 20:51
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