sunpy / sunkit-spex

:construction: Under Development :construction: A package for solar X-ray spectroscopy
BSD 3-Clause "New" or "Revised" License
22 stars 26 forks source link

Applying a gain correction #147

Open KriSun95 opened 3 months ago

KriSun95 commented 3 months ago

Provide a general description of the issue or problem.

It turns out that the gain correction (if applied) being performed in fitting_legacy is not being done in the same way as XSPEC, it was doing it more like another package (see gainshift in here).

XSPEC will gain shift the photon energy grid of the spectral response. This is done by defining a new energy grid with the equation $E{new}=E{old}/G{slope} - G{offset}$ for the photon axis of the SRM then evaluating the photon model at these new energies and interpolating the effective areas (if present) to the $E_{new}$.

The way fitting_legacy does it at the minute is by defining a new energy grid with the same equation but on the output count axis grid. The output model is then interpolated to the $E_{new}$ and compared to the data.

One thing to figure out is which way is the correct way to gain shift.

At the minute, this only affects fitting_legacy but has implications on how things may need to be implemented/made available during the refactor.

I expect this to turn into a discussion and more should be added, but this is maybe a good start! (although it seemed to have started a while ago elsewhere)