renecotyfanboy / jaxspec

jaxspec is an X-ray spectra Bayesian analysis package, relying on JAX to enable just in time compilation
https://jaxspec.readthedocs.io/en/latest/
MIT License
29 stars 2 forks source link

"ValueError: The HDUCLAS3=RATE keyword in the PHA file is not supported.Please open an issue if this is required." #185

Open matteobachetti opened 2 months ago

matteobachetti commented 2 months ago

As the message in title recommends ;)

First of all, thanks a lot for this great piece of software, I'm experimenting using it these days after finding the paper in the arXiv.

I'm dealing with spectra obtained by a likelihood analysis, which have non-integer values for the counts, so they don't comply with the HDUCLAS3=COUNTS specification. If jaxspec supported the RATE format it would be great!

renecotyfanboy commented 2 months ago

Hi Matteo, thank you very much for your feedback and for trying jaxspec!

Could you detail a bit more about the processes for building these spectra?

The straightforward solution I see would be simply to multiply this spectrum by the exposure, and rounding it to the closest integer so that it could be dropped in a Poisson likelihood. However, if this spectrum is a result of a fit or so, I am not sure that a Poisson statistic would be representative. Does the .pha file has values for STAT_ERR or SYS_ERR ? If not, the previous solution might work, and I'll look forward to implementing it

matteobachetti commented 2 months ago

@renecotyfanboy they're basically covariance spectra, obtained in the time domain. Their error bars are Gaussian, so I'm using STAT_ERR. I'm figuring your software could be really useful for people doing this kind of spectral timing and want a Python-only, robust fitting work flow. If you have time, it would be great!

renecotyfanboy commented 2 months ago

@matteobachetti I'll start working on it this week. Would it be possible for you to share with me a .pha formatted like this so that I can test the implementation on my own? I could also add it to the HEACIT database that way. (You can directly share it in this conversation or send by mail to sdupourque[at]irap.omp.eu)

Extra question, do you use .pha2 formatted files in time series analysis? Or do you deal with a bunch of individual .pha ? I still have to implement support for .pha2 files in jaxspec

renecotyfanboy commented 1 month ago

@matteobachetti Getting back to you on this topic, do you know where I can find such a spectrum ?

matteobachetti commented 1 month ago

@renecotyfanboy sorry for the slow response, I have two pending deadlines. I'll send you a spectrum early next week