StingraySoftware / stingray

Anything can happen in the next half hour (including spectral timing made easy)!
https://stingray.science/stingray
MIT License
166 stars 137 forks source link

Fix property setting from astropy #814

Closed matteobachetti closed 3 months ago

matteobachetti commented 3 months ago

Resolve #813

codecov[bot] commented 3 months ago

Codecov Report

All modified and coverable lines are covered by tests :white_check_mark:

Project coverage is 96.43%. Comparing base (e4e477c) to head (775ec31).

Additional details and impacted files ```diff @@ Coverage Diff @@ ## main #814 +/- ## ======================================= Coverage 96.43% 96.43% ======================================= Files 45 45 Lines 9027 9034 +7 ======================================= + Hits 8705 8712 +7 Misses 322 322 ```

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

matteobachetti commented 3 months ago

Our methods to read event lists from FITS files make choices about what information to read in the file. This is done by specifying "ogip" as the format. When fmt="fits", we read FITS files with Astropy's default reader (so, no interpretation on what an EventList should contain on our side), and everything gets read, including the header keyword EXPOSURE. Then, our code tries to update the exposure attribute of EventList, which is instead calculated internally in StingrayTimeseries, through a special method called a property, and fails. This PR just avoids this failure and warns the user that that keyword is not being saved.