Open phajy opened 7 months ago
I see the problem:
┌ OGIPDataset:
│ . Object : [no object]
│ . Observation ID : [no observation id]
│ . Exposure ID : [no exposure id]
│ SpectralData with 7 active channels:
│ . Chn. E (min/max) : (14.0, 195.0)
│ . Masked channels : 0 / 8
│ . Model domain size : 205
│ . Domain (min/max) : (10.0, 9000.0)
│ Primary Spectrum:
│ Spectrum: SWIFT[BAT]
│ Units : counts s^-1 keV^-1
│ . Exposure time : 2.704453e8
│ . Channels : 8
│ . Data (min/max) : (0.0, 8.4029e-07)
│ . Grouped : yes
│ . Bad channels : no
│ Response:
│ Response Matrix (8 x 204) channels:
│ . Chn. E (min/max) : (14.0, 195.0)
│ . Domain E (min/max) : (10.0, 9000.0)
│ Background: missing
│ Ancillary: missing
Specifically
│ . Data (min/max) : (0.0, 8.4029e-07)
There are some bins with zero counts and zero uncertainty, so when it tries to do a matrix inverse it seems to end up with a singular matrix and the thing blows up. I think you'd need to exclude those with a mask
I bumped into this same problem again and it wasn't obvious what was wrong. Then I remembered this thread! Made me think that perhaps we should report an error if there are data bins with zero counts and uncertainty.
UPDATE: turned out to be a dodgy dataset, but might still be worth letting the user know. (This issue is low priority!)
We've run into a problem fitting the SWIFT BAT data where the minimisation algorithm runs into an invalid matrix at some point. Here's an example using the SWIFT BAT dataset. The datasets you need to reproduce these are as follows (in a different repository)
Data: https://github.com/phajy/SWIFT_J0909/blob/main/data/swift_bat/swift_bat_157month.pha Response: https://github.com/phajy/SWIFT_J0909/blob/main/data/swift_bat/swiftbat_survey_full_157m.rsp
gives the following error
Perhaps the model explores an invalid region of parameter space of becomes zero? I need to do some more investigation but thought I'd start a thread here.
This does work for other datasets, e.g., NuSTAR.