sunpy / sunkit-instruments

A SunPy-affiliated package for solar instrument-specific tools.
https://docs.sunpy.org/projects/sunkit-instruments/
BSD 3-Clause "New" or "Revised" License
10 stars 14 forks source link

Plotting "Corrected" RHESSI Hard X-Ray emission light curve #132

Open TheNovusCoder opened 3 weeks ago

TheNovusCoder commented 3 weeks ago

Describe the feature

Hi. You can refer to the issue here in my chat with ayshih. I noticed that there is no feature in SunPy to plot the "Corrected" RHESSI Hard X-Ray emission light curve. It would be useful to have it. Thank you.

nabobalis commented 3 weeks ago

From Albert: The corrected rates are not in the FITS file, so we would need to re-implement the algorithm in Python.

ayshih commented 3 weeks ago

My description of the algorithm from the thread:

... RHESSI has attenuators that are moved in and out to moderate the incident flux. ... The normal or “uncorrected” quicklook lightcurves are merely showing the attenuators doing their job.

It is not possible to accurately correct the rates for the changing attenuator states without a spectral model, which formally requires a careful analysis of the flare spectrum and the underlying background. Instead, for quicklook rates, the “corrected” quicklook rates are calculated using a heuristic algorithm that essentially scales each lightcurve segment so that the overall result looks continuous. However, this correction approach is intended only for qualitative use because it is not scientifically robust: the algorithm can get misled if there is a real transition/burst close to an attenuator-state change, resulting in short artifacts or even long-term scaling errors.

ayshih commented 3 weeks ago

The relevant IDL code (not for the faint of heart!) is in these files:

https://hesperia.gsfc.nasa.gov/ssw/hessi/idl/qlook_archive/hsi_obs_summ_rate__define.pro https://hesperia.gsfc.nasa.gov/ssw/hessi/idl/qlook_archive/hsi_ql_atten_correct.pro https://hesperia.gsfc.nasa.gov/ssw/hessi/idl/qlook_archive/hsi_ql_front_decimation_correct.pro https://hesperia.gsfc.nasa.gov/ssw/hessi/idl/qlook_archive/hsi_ql_rear_decimation_correct.pro https://hesperia.gsfc.nasa.gov/ssw/hessi/idl/qlook_archive/hsi_old_rear_decimation_correct.pro