Skip to content
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

Fix bug of identity response matrices for PCA background models in Sherpa #55

Merged

Conversation

ruizca
Copy link
Contributor

@ruizca ruizca commented May 25, 2024

There seems to be a problem in the identity response matrices created for fitting the PCA background models with Sherpa. While they work fine with the PCA model itself, when applied to a gaussian model they return null values for all channels. This causes that any additional gaussian components included into the baseline PCA model are always rejected.

This PR fixes this issue, by using the create_delta_rmf and create_arf functions included in Sherpa. I have tested the new code with XMM, Chandra, Swift, Suzaku, NuSTAR and eROSITA data, and everything seems to work ok. The new script test_auto_background.py runs a battery of test: first, they check that the PCA model parameters obtained without including additional gaussian lines are the same as in the original code (the original values are stored in json files in the corresponding folders); second, a high count excess is injected into the background spectrum at a given channel and check that the new code is able to model that excess with a gaussian line.

@JohannesBuchner JohannesBuchner merged commit b3ecaa4 into JohannesBuchner:master May 26, 2024
5 of 7 checks passed
@JohannesBuchner
Copy link
Owner

Thank you, Angel. This should be fixed now and there is a new release of BXA (4.1.4). Please test it and let me know if it works.

@ruizca
Copy link
Contributor Author

ruizca commented May 28, 2024

I've tested the new BXA version and everything seems to work fine.

I was wondering if it should be mentioned somewhere that if you update, and run again an old fit, things could change (the new auto_background code could find significant lines in the background spectrum that were previously rejected). It is possible to recover the old results if you run the auto_background function with max_lines=0.

@JohannesBuchner
Copy link
Owner

Good point. I added it to the Release notes https://johannesbuchner.github.io/BXA/history.html

@ruizca ruizca deleted the sherpa_pcabkg_gaussian branch May 28, 2024 09:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants