Skip to content

refactor(csp-batch): arrange the procedures in the order of the stages of a batch - #140

Merged
elijahmathews merged 2 commits into
feat/hotpath-flag-namesfrom
feat/hotpath-split-file
Nov 19, 2026
Merged

elijahmathews merged 2 commits into
feat/hotpath-flag-namesfrom
feat/hotpath-split-file

Conversation

@elijahmathews

Copy link
Copy Markdown
Owner

Stack: after #139. Merge order: ..., #138, #139, this. A move of procedures within one file; no procedure changed.

What changes

The procedures of opensps_csp_batch.f90 were in the order in which they were written, with the forward stages, their helpers and the reverse pass interleaved. They now follow the stages of a batch, in the order in which compute_csp_batch runs them:

  • the driver, then stage 0 (checks and plan), 1 (per-model setup), 2 (SFH weights), 3 (age sums, mass and L_bol, the slab blend and kernels), 4 (nebular emission), 5 (dust attenuation), 6 (dust emission, IGM, AGN), 7 (smoothing), 8 (outputs), and 9 (the reverse pass, the largest section),
  • a banner for each, and a table of contents after contains, so that the file reads as the hot path from top to bottom (search for Stage 3: to jump to the age sums).

How it was done, and why it is safe: a small tool segmented the file into 84 units (a procedure with its doc comment, any preprocessor wrapper around it, and the #define/#include/#undef block after it, for the template instances) and moved each whole. A mechanical check showed that the new file holds exactly the lines of the old one plus the 45 banner and table-of-contents lines: nothing lost, nothing duplicated.

A split into several modules was considered and not done: the routines call each other across the stages (the reverse pass reuses the forward helpers; the types and constants are shared), so the pieces would need a common module under them and a long chain of use lines, for little more than the order already gives. doc/HOT_PATH_TOUR.md and doc/HOT_PATHS_PLAN.md say so.

Verification

🤖 Generated with Claude Code

https://claude.ai/code/session_01MXDRCs7ATQiqhT6RLPLXR5

elijahmathews and others added 2 commits November 19, 2026 00:10
…in the order of the stages of a batch

The driver first, then stages 0 - 9 (checks and plan, per-model setup, SFH weights, age sums, nebular, attenuation, dust emission/IGM/AGN, smoothing, outputs, the reverse pass), each with a banner, and a table of contents after contains. No procedure changed: a tool segmented the file into 84 units (a procedure with its doc comment, preprocessor wrapper and include block) and moved them whole; the new file holds exactly the old lines plus 45 banner and table-of-contents lines. Bit-identical: CPU with -fno-tree-vectorize (forward and gradient dumps) and 45 forward dumps on the R9700.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01MXDRCs7ATQiqhT6RLPLXR5
@codecov

codecov Bot commented Nov 19, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 74.93%. Comparing base (43c000a) to head (5feeb3f).

Additional details and impacted files
@@                   Coverage Diff                    @@
##           feat/hotpath-flag-names     #140   +/-   ##
========================================================
  Coverage                    74.93%   74.93%           
========================================================
  Files                           51       51           
  Lines                        14481    14481           
  Branches                      6089     6089           
========================================================
  Hits                         10852    10852           
  Misses                        1482     1482           
  Partials                      2147     2147           

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@elijahmathews
elijahmathews marked this pull request as ready for review November 19, 2026 16:55
@elijahmathews
elijahmathews merged commit da4a069 into main Nov 19, 2026
16 checks passed
@elijahmathews
elijahmathews deleted the feat/hotpath-split-file branch November 19, 2026 17:49
elijahmathews added a commit that referenced this pull request Nov 19, 2026
Stack: after #140. Comment-only change in `opensps_csp_batch.f90` (the
code is untouched; it builds).

A survey of the procedures of the file for doc comments found 15 with
fewer than two comment lines before them; most are small routines with
an adequate one-line doc. The two real gaps are filled:

- `nebular_kernels` (389 lines, formerly one comment line): the doc
lists its five numbered steps (the ionizing photons Q of the young
spectra, the EUV rows with the escaping fraction, the continuum as a sum
over the nebular ages with the large factors scaled out, the line
luminosities, the line profiles) and what `grid` selects (cue does steps
3 - 5 itself).
- `age_sums_z4` (no comment): what the four slabs are, how the weights
are formed, which template instance it calls.
- `batch_backward`: the doc gets the stages of the reverse pass in order
(magnitudes -> band fluxes, the observed frame, smoothing, AGN, dust
emission, dust attenuation, the lines outside the spectrum, nebular
emission, the age sums), the mirror of the stage index of the forward
driver.

🤖 Generated with [Claude Code](https://claude.ai/code)

https://claude.ai/code/session_01MXDRCs7ATQiqhT6RLPLXR5

---------

Co-authored-by: Claude Sonnet 5.5 <[email protected]>
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.

1 participant