fix: anchor observing night date to action start time and local noon boundary#131
Merged
ppp-one merged 2 commits intoppp-one:mainfrom Mar 24, 2026
Merged
Conversation
…boundary Replace sun-altitude-based observing night calculation with a simpler local-noon boundary (longitude-offset UTC), and use action.start_time instead of datetime.now() in from_action so images are always assigned to the correct night even when called after midnight or sunrise.
- Raise ValueError with helpful message when LAT-OBS/LONG-OBS/ALT-OBS are missing in __init__ and from_action, instead of an opaque KeyError - Add tests for both missing-location-key paths - Remove test_save_image_no_header_raises (header=None is a type violation) - Fix stale save_image docstring: correct header type, add sequence_counter, clarify image_directory behaviour, remove hardcoded filename format examples - Fix stale set_image_dir docstring: remove references to removed parameters
Owner
|
Sweet - works locally too. |
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.
Pull Request
Description
Replace sun-altitude-based observing night calculation with a simpler local-noon boundary (longitude-offset UTC), and use
action.start_timeinstead ofdatetime.now()infrom_actionso images are always assigned to the correct night even when called after midnight or sunrise.Related Issue
Closes #127
Changes Made
get_observing_night_date: replaced astropy sun-altitude lookup with a longitude-offset local noon boundary — times before local noon → previous night, times from local noon onward → tonightfrom_action: useaction.start_timeinstead ofdatetime.now()to anchor the observing night to when the action was scheduled, not when the handler was constructedget_default_observing_dateas it is not used in production code.How to Test
uv run pytest tests/test_image_handler.pyChecklist