Repository navigation
Run the source pipeline once per request instead of once per CCD - #2432
Merged
Merged
Conversation
cquiroz
added this pull request to stack #2431
September 23, 2026 20:57
cquiroz
force-pushed
the
perf-pr/04-source-pipeline-once-per-request
branch
from
September 23, 2026 22:30
d821e2d to
3f629af
Compare
…t or order SEDFactory.calculate is split into a telescope stage, everything before the instrument, and an instrument stage that applies the components, the instrument background and, for the AO instruments, the AO system. A per request SourceCache memoizes the telescope stage per distinct sampling setup and hands out a clone with the instrument stage applied on every call. GmosRecipe uses it so the three CCDs, the two IFU slits and the integration time second pass share one telescope stage. GnirsRecipe uses it so the six cross-dispersed orders share one too: since the GNIRS wavelength fix the recipe ran the whole pipeline per order, which had made cross-dispersed requests about five times slower. Sharing only happens when sampling, observing range, bands, site and the trimmed sampling range match, so results are identical by construction.
cquiroz
force-pushed
the
perf-pr/04-source-pipeline-once-per-request
branch
from
September 23, 2026 22:31
3f629af to
ec1cd64
Compare
|
This pull request does not currently match the merge queue conditions, so it cannot be queued from here. The box comes back if it matches again. |
There was a problem hiding this comment.
Copilot review overview
🟡 Changes recommended
One or more issues must be addressed before approval.
Get a fresh assessment by requesting another Copilot review.
Review effort: Lite
Findings: 1
What changed in this PR
Refactors ITC source calculations into reusable telescope and instrument stages, allowing GMOS and GNIRS requests to share telescope-stage results across CCDs, slits, and passes.
Changes:
- Adds telescope-stage caching in
SEDFactory.SourceCache. - Updates GMOS and GNIRS recipes to use cached source results.
- Clones cached spectra before applying instrument-specific processing.
| File | Description |
|---|---|
| bundle/edu.gemini.itc/src/main/java/edu/gemini/itc/gnirs/GnirsRecipe.java | Updated as part of this pull request. |
| bundle/edu.gemini.itc/src/main/java/edu/gemini/itc/gmos/GmosRecipe.java | Updated as part of this pull request. |
| bundle/edu.gemini.itc/src/main/java/edu/gemini/itc/base/SEDFactory.java | Updated as part of this pull request. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
atTelescope validates the source against getFirstNonZero and getLastNonZero, so two instruments that differ there must not share a cached telescope stage. GMOS CCDs share both values, so outputs and cache hits are unchanged.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

SEDFactory.calculate is split into a telescope stage, everything before the instrument, and an instrument stage that applies the components, the instrument background and, for the AO instruments, the AO system. We can cache those stage results.
GmosRecipe uses it so the three CCDs, the two IFU slits and the integration time second pass share one telescope stage.
Sharing only happens when sampling, observing range, bands, site and the trimmed sampling range match, so results are identical by construction.
This trims abour 10-15% of gnirs time