Skip to content

Improve pointing offset report output and add summary statistics export#19

Merged
Yong2Sheng merged 1 commit intodevelopfrom
enhance/virt_offset_statistics
Mar 18, 2026
Merged

Improve pointing offset report output and add summary statistics export#19
Yong2Sheng merged 1 commit intodevelopfrom
enhance/virt_offset_statistics

Conversation

@Yong2Sheng
Copy link
Copy Markdown
Owner

Summary

This PR expands the pointing report output for VIRTPointingReport by improving the Markdown table generated in get_offset_form() and by adding a new method, get_offset_statistics(), to summarize the pointing offset distribution across all input FITS files.

What changed

1. get_offset_form() now supports a configurable output directory

Added a new parameter:

saving_dir: Path | None = None

Behavior:

  • If saving_dir is not provided, the report is still saved next to the FITS files, which preserves the previous default behavior.
  • If saving_dir is provided, the Markdown report is written there instead.

This makes the method easier to use in notebooks, pipelines, and future automated reporting workflows.

2. Improved offset table headers and formatting

The generated Markdown table now uses more explicit column names:

  • File
  • Requested Center
  • FOV Center
  • RA Error [hms]
  • Dec Error [dms]
  • Separation [deg]

Compared with the previous version, this makes the meaning and units of each column clearer.

In addition, the angular separation is now formatted explicitly with fixed precision:

f"{sep.value:.5f}"

This makes the output table more consistent and easier to read.

3. Offset values are now stored on the instance

While generating the table in get_offset_form(), the code now stores:

  • self.dra
  • self.ddec
  • self.sep

These cached values are then reused by the new summary-statistics method.

This avoids recomputing offsets later and provides a clean bridge between the per-image report and the statistical summary.

4. Added get_offset_statistics()

This PR adds a new method:

get_offset_statistics(
    save: bool = True,
    saving_dir: Path | None = None,
) -> None

This method:

  • converts the stored RA offsets, Dec offsets, and separations into Angle objects,
  • computes the mean and sample standard deviation (ddof=1),
  • formats the results into a Markdown table,
  • stores the formatted results on the instance, and
  • optionally saves them to disk as:
Image_Offset_Report_Statistics.md

The statistics table currently reports:

  • RA Error Mean ± 1σ [hms]
  • Dec Error Mean ± 1σ [dms]
  • Separation Mean ± 1σ [deg]

Why this change is useful

Previously, the class only produced a per-image offset table. That is useful for inspection, but it is harder to quickly evaluate the overall pointing performance of a whole dataset.

With this PR, the report now supports two complementary levels of output:

  1. Per-image diagnostics via get_offset_form()
  2. Dataset-level summary statistics via get_offset_statistics()

This is especially useful for engineering reports, routine QA, and tracking pointing performance over a night or observing run.

Notes

  • get_offset_statistics() relies on the offset values populated by get_offset_form(), so get_offset_form() should be called first.
  • The implementation keeps the existing default behavior for report placement when saving_dir is not specified.

Example usage

report = VIRTPointingReport(files)
report.get_offset_form(save=True)
report.get_offset_statistics(save=True)

Or with a custom output directory:

report = VIRTPointingReport(files)
report.get_offset_form(save=True, saving_dir=output_dir)
report.get_offset_statistics(save=True, saving_dir=output_dir)

@Yong2Sheng Yong2Sheng merged commit f26fbeb into develop Mar 18, 2026
4 checks passed
@Yong2Sheng Yong2Sheng deleted the enhance/virt_offset_statistics branch March 18, 2026 00:03
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