pypeit / PypeIt

The Python Spectroscopic Data Reduction Pipeline
BSD 3-Clause "New" or "Revised" License
163 stars 104 forks source link

pypeit_chk_flexure #1844

Closed debora-pe closed 2 months ago

debora-pe commented 2 months ago

As title. New simple script to check the flexure (both spatial and spectral) applied to the science data.

Some examples of how the script works:

pypeit_chk_flexure spec1d_DE.20141021.3*.fits --spec
[INFO]    :: Checking fluxure for file: spec1d_DE.20141021.34721-GOODSS_DEIMOS_20141021T093833.706.fits
          NAME          global_spec_shift local_spec_shift total_spec_shift
----------------------- ----------------- ---------------- ----------------
SPAT0038-SLIT0052-MSC01             0.137            0.000            0.137
SPAT0172-SLIT0162-MSC01             0.070            0.000            0.070
SPAT0231-SLIT0224-MSC01             0.073            0.000            0.073
(...)

[INFO]    :: Checking fluxure for file: spec1d_DE.20141021.35719-GOODSS_DEIMOS_20141021T095514.045.fits
          NAME          global_spec_shift local_spec_shift total_spec_shift
----------------------- ----------------- ---------------- ----------------
SPAT0162-SLIT0162-MSC01             0.032            0.000            0.032
SPAT0221-SLIT0224-MSC01             0.037            0.000            0.037
SPAT0249-SLIT0265-MSC01             0.151            0.000            0.151
(...)
pypeit_chk_flexure spec2d_DE.20141021.34721-GOODSS_DEIMOS_20141021T093833.706.fits --spec
[INFO]    :: Checking fluxure for file: spec2d_DE.20141021.34721-GOODSS_DEIMOS_20141021T093833.706.fits

================================================== MSC01 ================================================
spat_id global_spec_shift
------- -----------------
     52             0.137
    103             0.000
    162             0.070
(...)

================================================== MSC02 ================================================
spat_id global_spec_shift
------- -----------------
     25             0.102
     70             0.075
    210             0.130
(...)
 pypeit_chk_flexure spec2d_DE.20141021.34721-GOODSS_DEIMOS_20141021T093833.706.fits --spat
[INFO]    :: Checking fluxure for file: spec2d_DE.20141021.34721-GOODSS_DEIMOS_20141021T093833.706.fits

================================================== MSC01 ================================================
Spat shift: None

================================================== MSC02 ================================================
Spat shift: None

================================================== MSC03 ================================================
Spat shift: None

================================================== MSC04 ================================================
Spat shift: None
codecov-commenter commented 2 months ago

:warning: Please install the 'codecov app svg image' to ensure uploads and comments are reliably processed by Codecov.

Codecov Report

Attention: Patch coverage is 14.49275% with 59 lines in your changes missing coverage. Please review.

Project coverage is 38.18%. Comparing base (df30133) to head (2388003).

Files Patch % Lines
pypeit/core/flexure.py 7.89% 35 Missing :warning:
pypeit/scripts/chk_flexure.py 20.00% 24 Missing :warning:

:exclamation: Your organization needs to install the Codecov GitHub app to enable full functionality.

Additional details and impacted files ```diff @@ Coverage Diff @@ ## develop #1844 +/- ## =========================================== - Coverage 38.21% 38.18% -0.03% =========================================== Files 208 209 +1 Lines 48419 48487 +68 =========================================== + Hits 18504 18516 +12 - Misses 29915 29971 +56 ```

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

debora-pe commented 2 months ago

Looks good! Three requests/questions:

  • Add a comment in the release doc
  • Can we use msgs.info instead of print?
  • Is it necessary to collect and return the tables from all the input files?

-Thanks @kbwestfall for the reminder to add to the release doc (I always forget!) -I changed one print to msgs.info for one information message, but in general, I prefer to leave print, since it not a really a PypeIt message, it's just printing something. And also, most of them are table, so I think they look better.

debora-pe commented 2 months ago

@kbwestfall I followed your suggestion to move the flexure checking code to a function that is then called by pypeit_chk_flexure. Let me know what you think.

debora-pe commented 2 months ago

Thanks @badpandabear and @kbwestfall for the quick reviews. I'm merging now.