Skip to content

Feat/improved autofocuser#129

Open
dgegen wants to merge 6 commits intoppp-one:mainfrom
dgegen:feat/improved-autofocuser
Open

Feat/improved autofocuser#129
dgegen wants to merge 6 commits intoppp-one:mainfrom
dgegen:feat/improved-autofocuser

Conversation

@dgegen
Copy link
Copy Markdown
Collaborator

@dgegen dgegen commented Mar 19, 2026


name: Pull request
about: Create a pull request


Description
Improves the Autofocuser class with a shared run_timestamp property so all output files from a single autofocus run share a consistent timestamp-based naming scheme. Also simplify the focus record handling to use only the in-memory record, and adds logging for the observatory subclass type at startup.

Changes Made

  • Log name of subclass during observatory startup
  • Add run_timestamp property to Autofocuser that lazily generates a single timestamp (format YYYYMMDD_HHMMSS) shared across all output files of one run
  • Add _output_path() helper that builds consistent output paths using run_timestamp
  • Refactor make_summary_plot() and save_result() to use _output_path() instead of ad-hoc timestamp/CSV-derived filenames
  • Remove fallback CSV-reading logic in make_summary_plot() — the in-memory focus_record is now the only source; failures emit warnings and return early
  • Also save the focus record DataFrame as CSV via make_summary_plot() using the shared timestamp
  • Log observatory subclass name at startup (observatory.py)
  • Fix self.observatory.error(...)self.observatory.logger.error(...) call
  • Bump astrafocus dependency to 0.1.2. This fixes a few small bugs that propagated into Astra, especially when using secondary focus measure operators.

Checklist

  • Code follows project style guidelines
  • Tests added/updated
  • Documentation updated (if needed)
  • All checks pass

Copilot AI review requested due to automatic review settings March 19, 2026 18:23

This comment was marked as resolved.

@dgegen dgegen force-pushed the feat/improved-autofocuser branch from b70600c to 8069d43 Compare March 24, 2026 10:21
except Exception as e:
field_of_view = np.array([np.nan, np.nan])
self.observatory.error(
self.observatory.logger.error(
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

warning, instead?

dgegen added 2 commits March 27, 2026 17:25
Upgrades astrafocus from 0.1.2 to 0.1.3, which fixes autofocus runs
crashing with "Input must be a 2D array" when an exposure fails mid-sweep
(e.g. due to weather); the new version catches focus measure exceptions
and records NaN instead of aborting.

Also adds documentation (docstring and FIELD_DESCRIPTIONS) clarifying when
to prefer non-parametric operators (fft, normalized_variance) for coarse
searches vs. analytic operators (HFR) for fine tuning near the focus peak.
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.

3 participants