Skip to content

Improve visibility API - #63

Merged
AndreaBulgarelli merged 21 commits into
developfrom
62-notebook-source-visibility
Oct 6, 2025
Merged

Improve visibility API#63
AndreaBulgarelli merged 21 commits into
developfrom
62-notebook-source-visibility

Conversation

@gabriele-panebianco-inaf

@gabriele-panebianco-inaf gabriele-panebianco-inaf commented Oct 6, 2025

Copy link
Copy Markdown
Collaborator

Close #12

Close #26

Close #62

Problem
The Off-axis angle of a source was computed in a confusing way with the "Engineering API", which is the ensemble of the following classes:

  • AGEngAgileOffaxisVisibility, with the goal to compute the AGILE off-axis angle. Issues:
    • No YAML configuration was defined
    • Timestamps of the off-axis angles were not saved
    • Bug on the MJD computation: mjd=mjd_to_tt(tt) instead of mjd=tt_to_mjd(tt)
    • Plotting with matplotlib, not plotly as the rest of agilepy
  • AGEngAgileFermiOffAxisVisibilityComparison, with the goal to compute the Fermi off-axis angle. Issues:
    • No YAML configuration was defined
    • Timestamps of the off-axis angles were not saved
    • Class basically empty, just a wrapper on "external" packages contained in agilepy/external_packages/ap and agilepy/external_packages/offaxis directories.
  • AGEngDisplayComparison: with the goal to "compare" AGILE and Fermi data. Issues:
    • Input and Output not defined
    • Mixes information on Ratemeters, Off-axis angle, Aperture Photometry
    • Too specific on input format, execution (matplotlib), output. Probably developed for one specific plot in one specific paper. Classes should be more general
    • Not integrated with the rest of agilepy, which defines all plotting tools in PlottingUtils class.
  • APDisplayAGILEFermiComparison with the goal to "compare" AGILE and Fermi data. Issues:
    • Located in agilepy/external_packages/ap, not integrated with the rest of agilepy.
    • Mehtods have very similar purposes to AGEngDisplayComparison: mixing results of AP, off-axis and ratemeters time series with a common time axis.
  • agilepy/external_packages/offaxis, with other duplicated methods on computing and plotting the AGILE and Fermi offaxis angles.

None of this was tested. All tests were deactived due to calling files from a local archive (/ASDC2/etc)

Solution of this MR

  • Replace the "Engineering API" with ONE class to compute the off-axis angle: AGVisibility:
    • The class extracts the AGILE pointing RA, DEC from the log files, stores them in a Table, then computes the off-axis angle of a desired source with a one-line command thanks to astropy SkyCoord: pointings.separation(target_coordinates).
    • The same can be done, optionally, with Fermi, if a spacecraft file is provided in input.
  • Plotting function integrated with Agilepy PlottingUtils and plotly as every other class.
  • Add unit tests
  • Add tutorial notebook
  • Add documentation

Advantages

  • One class doing all the relevant operations and plots of the off-axis analysis.
  • The imprecise "Engineering API" term is replaced with a more scientific term: Visibility
  • Input and Output clearly defined and integrated with agilepy workflow.
  • The information extracted is the same as before: AGILE position from ATTITUDE_RA_Y and ATTITUDE_DEC_Y, Fermi position from RA_SCZ, DEC_SCZ columns. The code is much less than before and much more clear.
  • Output report spacecraft position, so that offaxis angle to any source can be computed.
  • Standard and complete output file (.csv): table with time, spacecraft coordinates, off-axis angle.
  • All utilities are reported for legacy purposes in the agilepy/external_packages/ directory.
  • No methods which mix inputs and outputs of several analyses. Agilepy classes should provide their own results. If one needs to plot together ratemeters, AP light curve and off-axis angle (which require separate inputs and provide independent outputs), the user should use AGRatemeters, AGAnalysis.aperturePhotometry(), AGVisibility to obtain the time series, then create its own plotting function as most appropriate to their paper.

@gabriele-panebianco-inaf gabriele-panebianco-inaf added bug Something isn't working enhancement New feature or request labels Oct 6, 2025
@gabriele-panebianco-inaf gabriele-panebianco-inaf moved this to Verification in v2.0.0 Oct 6, 2025
@gabriele-panebianco-inaf gabriele-panebianco-inaf added this to the 1.7.0 milestone Oct 6, 2025
@gabriele-panebianco-inaf gabriele-panebianco-inaf linked an issue Oct 6, 2025 that may be closed by this pull request
@gabriele-panebianco-inaf gabriele-panebianco-inaf changed the title 62 notebook source visibility 62 Improve visibility API Oct 6, 2025
@gabriele-panebianco-inaf gabriele-panebianco-inaf linked an issue Oct 6, 2025 that may be closed by this pull request
@gabriele-panebianco-inaf gabriele-panebianco-inaf linked an issue Oct 6, 2025 that may be closed by this pull request
@gabriele-panebianco-inaf gabriele-panebianco-inaf moved this from Verification to Validation in v2.0.0 Oct 6, 2025
@gabriele-panebianco-inaf gabriele-panebianco-inaf changed the title 62 Improve visibility API Improve visibility API Oct 6, 2025
@gabriele-panebianco-inaf gabriele-panebianco-inaf mentioned this pull request Oct 6, 2025
9 tasks
@gabriele-panebianco-inaf
gabriele-panebianco-inaf marked this pull request as ready for review October 6, 2025 10:23
@gabriele-panebianco-inaf gabriele-panebianco-inaf added documentation Improvements or additions to documentation testing Improve testing capabilities labels Oct 6, 2025
@AndreaBulgarelli
AndreaBulgarelli merged commit 0d62eec into develop Oct 6, 2025
7 of 8 checks passed
@github-project-automation github-project-automation Bot moved this from Validation to Done in v2.0.0 Oct 6, 2025
@gabriele-panebianco-inaf
gabriele-panebianco-inaf deleted the 62-notebook-source-visibility branch October 6, 2025 19:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working documentation Improvements or additions to documentation enhancement New feature or request testing Improve testing capabilities

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

Class and Notebook review: Source Visibility Test instabilities TODOs on Plot2 notebook

2 participants