Skip to content

Added user specified render bounds and temperature offset to lightcurve generation.#128

Open
s-neilson wants to merge 7 commits into
danieljprice:mainfrom
s-neilson:master
Open

Added user specified render bounds and temperature offset to lightcurve generation.#128
s-neilson wants to merge 7 commits into
danieljprice:mainfrom
s-neilson:master

Conversation

@s-neilson

@s-neilson s-neilson commented Jun 24, 2026

Copy link
Copy Markdown
Contributor

Added the following new features to lightcurve generation:

  • Added the ability to use the "xmin", "xmax", "ymin" and "ymax" flags to specify the rendering region similar to other SPLASH modes. If a bound is not specified by the user then it is automatically calculated like it was previously.
  • Added the flag "ocol" that will apply a constant temperature offset. The offset defaults to zero if the user does not specify a value.

Also added references to the above new features to the lightcurve generation documentation. Also added a reference to the spectral hardening factor to the lightcurve generation documentation.

Summary by CodeRabbit

Summary of changes

  • New Features

    • Added a configurable temperature offset via an ocol environment variable for non-sink particle light curves.
    • Added per-axis environment overrides for render-region margin bounds (SPLASH_MARGIN_{XMIN,XMAX,YMIN,YMAX}).
  • Bug Fixes

    • Added validation to prevent spectrum evaluation when the offset temperature becomes non-positive, returning a clear error.
    • Ensured the temperature offset is applied only to the non-sink particle path.
    • Updated the interpolation-weight allocation failure error code.
  • Documentation

    • Updated lightcurve documentation to describe the new bound overrides and temperature/offset behavior.
  • Style

    • Added console output for the selected temperature offset value.

…xmin", "ymin", "xmax" and "ymax" flags. The render region bounds that are not specified are calculated automatically as they were before. The user can also now specify a constant tempature offset with the "o_col" flag.
@coderabbitai

coderabbitai Bot commented Jun 24, 2026

Copy link
Copy Markdown

Review Change Stack

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review
📝 Walkthrough

Walkthrough

get_lightcurve now reads o_col, allows render bounds to be overridden with SPLASH_MARGIN_*, shares o_col through the OpenMP loop, applies it in the non-sink temperature calculation, and adds error handling for allocation failure and non-positive temperatures.

Changes

Temperature offset and render margin expansion

Layer / File(s) Summary
o_col setup and render margin overrides
src/lightcurve.f90, docs/lightcurve.rst
Declares o_col, reads and prints it from ocol, overrides computed xmin/xmax bounds with SPLASH_MARGIN_XMIN, SPLASH_MARGIN_XMAX, SPLASH_MARGIN_YMIN, and SPLASH_MARGIN_YMAX, and documents the default bounds and --fcol/--ocol temperature options.
Loop sharing and temperature checks
src/lightcurve.f90
Adds o_col to the OpenMP shared(...) list, updates the non-sink B_nu temperature to include o_col, adds a non-positive-temperature check with ierr=6, aborts after the loop on that error, and changes the allocation-failure code to ierr=5.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Poem

🐰 Hop, hop, a tiny offset landed,
Bounds grew wide where the render was planned.
If temps turn cold, the bunny says “nay,”
And o_col glows through the ray-traced day.

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly matches the main change: user-specified render bounds and a temperature offset for lightcurve generation.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Comment @coderabbitai help to get the list of available commands.

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request introduces a temperature offset parameter o_col and allows custom rendering bounds via environment variables in src/lightcurve.f90. The review feedback highlights three key issues: a command-line flag collision where o_col conflicts with --fcol due to substring matching, a lack of validation for manual rendering bounds which could lead to division-by-zero errors if xmin >= xmax, and the potential for non-positive temperatures if a negative temperature offset is provided, which would cause failures in the Planck function calculation.

Important

The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.

Comment thread src/lightcurve.f90 Outdated
Comment thread src/lightcurve.f90
Comment thread src/lightcurve.f90

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 3

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@src/lightcurve.f90`:
- Around line 136-139: The bounds setup in lightcurve handling now accepts
user-influenced margins, so the code must validate that each axis has xmax
greater than xmin before using the values to derive dx and npixy. Add a guard in
the lightcurve bounds calculation path around the xmin/xmax assignments (and the
later npixy computation site) to reject or correct invalid ordering for both
axes before any pixel geometry is computed.
- Around line 136-139: The bounds handling in lightcurve setup is treating
SPLASH_MARGIN_XMIN/XMAX/YMIN/YMAX as absolute replacements instead of margins.
Update the logic around the computed xmin/xmax values so the environment values
are applied as offsets relative to the auto-detected bounds, preserving the
existing margin semantics in the lightcurve rendering path.
- Line 250: The temperature offset in the lightcurve calculation can produce
non-positive values before the B_nu call, which then propagates invalid physics
through the outputs. Update the temperature computation in the lightcurve
routine around the tempi assignment to clamp or validate the result so tempi
always stays strictly positive before it is passed to B_nu, preserving the
existing flow in the same calculation block.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 69892370-6353-4f19-aadd-c58d78f9fcfb

📥 Commits

Reviewing files that changed from the base of the PR and between 4efd030 and 7d29ea0.

📒 Files selected for processing (1)
  • src/lightcurve.f90

Comment thread src/lightcurve.f90
Comment thread src/lightcurve.f90
… being less than or equal to the minimum bounds, and also prevented the temperature offset making particle temperatures less than or equal to zero. Lightcurve generation will be aborted in both of these scenarios.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@src/lightcurve.f90`:
- Line 262: Fix the malformed conditionals in the lightcurve logic: the `if`
statement using `tempi` in the `src/lightcurve.f90` code currently splits the
relational operator, and the later check on `ierr` uses assignment syntax
instead of equality. Update the affected conditionals in the relevant lightcurve
routine so the comparisons use the proper Fortran operators `<=` and `==`,
keeping the surrounding control flow unchanged.
- Around line 235-237: The OpenMP loop in the lightcurve routine is writing to
the shared ierr variable, which can race across threads; change the parallel
logic around the loop in lightcurve.f90 to use a thread-local/reduction-style
flag and assign ierr = 6 only once after the parallel region completes. Also fix
the final conditional that checks ierr so it uses a comparison (ierr == 6)
rather than an assignment, and keep the change localized to the loop and
post-processing around the shared/private OpenMP clauses.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: ac19a4ab-8f6d-4e5a-92c1-1c371da93165

📥 Commits

Reviewing files that changed from the base of the PR and between 55eb81d and 8b22db0.

📒 Files selected for processing (1)
  • src/lightcurve.f90

Comment thread src/lightcurve.f90
Comment thread src/lightcurve.f90 Outdated
… references to the spectral hardening factor, constant temperature offset and the user defined render region bounds.
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