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

Add albedo correction #128

Open samaloney opened 10 months ago

samaloney commented 10 months ago

Describe the feature

A few people have been asking if we have implemented the albedo correction similar to OSPEX

Proposed solution

No response

settwi commented 10 months ago

I think that would be an excellent addition. I believe OSPEX implements it as a “pseudo-model” but it shouldn’t be too hard to add if we look up the proper equations.

KriSun95 commented 10 months ago

This has been on my to-do list for a while, I've just never been able to get around to it properly.

I think OSPEX does it via altering the response matrix before the fit and I think the main files to look at are drm_albedo.pro and drm_correct_albedo.pro (found here with some description).

Instructions on how the user interacts with this in OSPEX and some history is here.

samaloney commented 10 months ago

Yea those sav files are nightmare fuel do we have any idea how they were generated? @KriSun95 I think you are correct about the current implementation/approach here's the relevant paper but not clear if that the best way or have a model chain physical-model->albedo-model->SRM

KriSun95 commented 9 months ago

@samaloney, I think your idea of physical-model->albedo-model->SRM makes more sense to me. I don't like the idea of editing the response any more than we really need to while having the correction as a model will help keep things transparent and make it easier to apply to different data too, I'd imagine.

samaloney commented 6 months ago

For RHESSI the albedo correction is included as part of the DRM, the logic being that it's not the observed spectrum I_O you want to fit but the emitted I_E where I_0=I_E + I_A. At the GX_SIMULATOR meeting and found out Edward/Gelu have implemented the Albedo correction as an addition to the model spectrum so we should be able to use the same approach https://github.com/Gelu-Nita/GX_SIMULATOR/blob/d772a411705ceed9db2a5b6eadfa14cd5dda190f/userslib/xray/xray_tt_albedo.pro

edkontar commented 3 days ago

Green function matrices are now available in JSON format (also as IDL SAVE files) https://github.com/edkontar/albedo

settwi commented 3 days ago

@edkontar thanks, Eduard! this will be very useful for albedo corrections going forward.

would you like to help implement the corrections in Python?

edkontar commented 2 days ago

would you like to help implement the corrections in Python?

Yes, I would be happy to help

samaloney commented 1 day ago

I have a draft PR open which uses the sav files from SSW in #161

What we eventually need is the ability to generate the "green's matrices"