-
Notifications
You must be signed in to change notification settings - Fork 26
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
RHESSI fits sum_flag=0 breaks code #132
Comments
I believe OSPEX only allows spectroscopy to be performed when sum_flag = fxpar (hdr, 'SUMFLAG', count=count)
if count gt 0 and sum_flag eq 0 then begin
if n_elements(str2arr(detused, ' ')) gt 1 then begin ; check for > 1 det
err_code = 1
err_msg = 'OSPEX can not handle SRM files with >1 detectors that are not summed (sum_flag=0). Aborting'
return
endif
endif Summing counts from the different RHESSI detectors is kind of fraught so that makes sense. -WS |
The Looking at it again, would this not most likely be because OSPEX can't do simultaneous fitting? I.e., it would have no idea what to do if the detectors weren't summed into a single spectrum with only one SRM. Obviously, if this is the only reason why |
Good idea! |
Describe the bug
At the moment the code returns an error and breaks when trying to load a RHESSI srm/spec fits file with sum_flag != 1 in the header. I guess @KriSun95 did this is to avoid issues of multiple detectors that aren't summed, i.e. expecting always to have a single srm and single spectrogram in each fits file. But even if there is a single srm/spec in there (say only using a single RHESSI detector) will get the error/break if sum_flag=0 in the fits header.
Short term solution is just to make sure sum_flag=1 when generating RHESSI srm/spec fits from the hsi_spectrum() in sswidl, whether summed over multiple detectors or "summed" over a single detector.
Longer term might want a smarter way to deal with this? Maybe @settwi might have some ideas given your work on loading in RHESSI spec/srm.
To Reproduce
Load in a RHESSI spec/srm fits file where have a single detector spectrogram/srm but sum_flag=0 in the header, i.e. https://github.com/ianan/rhessi_spectra/blob/main/mfstats9_fits/20030725_082642_srm_org_d1.fits https://github.com/ianan/rhessi_spectra/blob/main/mfstats9_fits/20030725_082642_spec_org_d1.fits
from sunkit_spex.sunxspex_fitting.fitter import Fitter
spec = Fitter(pha_file="20030725_082642_spec_org_d1.fits", srm_file="20030725_082642_srm_org_d1")
Gives error/breaks in sunxspex_fitting/instruments.py:662 with warning:
"Apparently spectrum file's SUMFLAG should be one and I don't know what to do otherwise at the moment."
Screenshots
No response
System Details
No response
Installation method
No response
The text was updated successfully, but these errors were encountered: