Skip to content

feat(backend): Store elevation limits inside the Constraints class - #790

Open
dngomez wants to merge 2 commits into
mainfrom
GSCHED-1043/access-equivalent-airmass-and-hour-angle-observation-constraints
Open

dngomez wants to merge 2 commits into
mainfrom
GSCHED-1043/access-equivalent-airmass-and-hour-angle-observation-constraints

Conversation

@dngomez

@dngomez dngomez commented Sep 25, 2026 •

Copy link
Copy Markdown
Contributor

Changelog

feature (GSCHED-1043): Parse elevation limit from program providers if possible, otherwise do it when the target information is retrieved for nonsidereal targets. Store the elevation limit inside the Constraints class

Scope

  • Backend (backend/)
  • Frontend (frontend/)
  • Docs (docs/)
  • CI/Infra (.github/)

Jira

Checklist

  • Changelog fragment added to changelog.d/
  • Commit messages follow conventional commits (feat(backend):, fix(frontend):, etc.)
  • No breaking changes (or breaking fragment added)

@dngomez
dngomez force-pushed the GSCHED-1043/access-equivalent-airmass-and-hour-angle-observation-constraints branch from 44caed4 to 1523b77 Compare September 30, 2026 20:09
@dngomez
dngomez marked this pull request as ready for review September 30, 2026 20:10
@dngomez
dngomez requested a review from stroncod September 30, 2026 20:10
@dngomez

dngomez commented Sep 30, 2026

Copy link
Copy Markdown
Contributor Author

This PR requires the gemini-hlsw/lucupy#134 to be approved and merged to regenerate the uv lockfile and then be able to merge this PR.

elif constraints.elevation_type == ElevationType.HOUR_ANGLE:
hourangle_deg = np.degrees(hourangle)
mask &= (hourangle_deg >= constraints.elevation_min) & (hourangle_deg <= constraints.elevation_max)
# Hour angle constraints are in hours.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

This would need a recalculation of the DB as it might yield different results.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

How should we recalculate this info?
Must the current data be manually deleted in order to run the re-calculation or this will be automatically run?

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Manually deleted and recalculated for now. is a bit tricky because what we have in storage now might not be useful and it can get stale safely. I guess is a case to case to check if the program is going to be use. At least for dev as we test with what is available it would be good to recalculate but with Prod I think past aggregated obs might not show up in the future.

@mergify

mergify Bot commented Oct 1, 2026

Copy link
Copy Markdown
Contributor

Tick the box to add this pull request to the merge queue (same as @mergifyio queue).

  • Queue this pull request

Comment on lines -113 to +118
hourangle_deg = np.degrees(hourangle)
mask &= (hourangle_deg >= constraints.elevation_min) & (hourangle_deg <= constraints.elevation_max)
# Hour angle constraints are in hours.
hourangle_hours = np.degrees(hourangle) / 15.0
mask &= (hourangle_hours >= constraints.elevation_min) & (hourangle_hours <= constraints.elevation_max)
# Within the hour angle limits the airmass is at most the one at the limits, so the equivalent
# airmass constraint (sky.hour_angle_to_airmass_limits) only adds the airmass cap.
mask &= airmass <= ElevationLimits.AIRMASS_LIMIT

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Also, for this change would be good to have @bryanmiller input

This branch has not been deployed

No deployments
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