JohannesBuchner / BXA

Bayesian X-ray analysis (nested sampling for Xspec and Sherpa)
https://johannesbuchner.github.io/BXA/
GNU General Public License v3.0
57 stars 19 forks source link

Using PCA backgrounds in Sherpa changes the default behaviour of plots #34

Open ruizca opened 2 years ago

ruizca commented 2 years ago

After using the auto_background function in Sherpa, the data and fit plots use counts in the y axis. Since the default behavior of Sherpa is using count rates, this change after calculating PCA models can be quite annoying. It is something easy to fix by the user, but it can take some time to realize what happen.

As far as I understand this is caused by the following line in the fit method of the PCAFitter class: https://github.com/JohannesBuchner/BXA/blob/5a6ee5fafbaf7bc609a29dafadae48d27aba50aa/bxa/sherpa/background/pca.py#L359

It would be helpful if a note is included in the documentation so the users are aware of that change when using PCA models.

Ideally, the best would be to recover the initial behavior of Sherpa after running a PCA fit. I can give it a try, if you think is something worth it.

JohannesBuchner commented 2 years ago

Yes, that sounds like a good idea. IIRC one also should not set any energy limits yet at that point.

JohannesBuchner commented 2 years ago

I added a line at https://johannesbuchner.github.io/BXA/pca-background-models.html