Closed nyctophile-aayu closed 3 months ago
@nyctophile-aayu You can rebin the PHAII data along the energy axis using the rebin_energy method.
Similarly, you can rebin the response using the rebin method.
In order to perform a spectral fit on rebinned data, you the bins of the PHA data must match up with the energy channels in the response.
@AdamGoldstein-USRA Even if I manage to do so, then PHAII files show the changes while plotting the energy spectrum. However, response matrix gives me error.
Also, while doing the energy binning for the tte.fit file, I need to make sure background is similarly binned; otherwise, background will plot with the regular binning only. Or do I not need to do the background binning at all?
@nyctophile-aayu The order of operations should be:
Phaii
Pha
and Bak
objectsPha
(s), background model(s), and rebinned response(s).If you are receiving an error when following this procedure, please post an example + error log or attach a notebook of your approach that replicates the error.
@AdamGoldstein-USRA I am sharing the notebook in which I have performed all these steps except for the last one. Since I am getting an error in recreating the pha file after re-binning by energy channels. In this notebook, pha file is re-binning by energy channels.
If I am not doing energy binning and just going with the time binning only then those 5 columns are present in the pha2 file: in the Spectrum extension: Counts, Exposure, Quality, Time, Endtime.
However, after the time binning and energy binning process, when I try to re-writed pha file, only 3 columns are present which are also different: Channel, counts, quality. Although this file is re-binned by energy channels.
I am not sure if this is correct or am I doing something wrong. Can you please guide me through?
Also, can you take a look at the rsp steps if it is doing correct rebin? PhaExport.tar.gz
@nyctophile-aayu It appears you are trying to rebin a GbmRsp2 object. If you look at the documentation you will see that there is not a method to rebin GbmRsp2. You need to extract (or interpolate) a GbmRsp object, and that can be rebinned (see here).
Hi, I am writing this issue to know if there is any way to apply energy binning for modelfit plot?
from gdt.core.plot.model import ModelFit
initialize with your spectral fitter once the fit is done
modelplot = ModelFit(fitter=specfitter, interactive=True)
Do I need to insert any attribute here to club data & model points here? Or is there any other way to do so like we do in fermipy using step: sed = gta.sed('CTA 102', loge_bins=gta.log_energies[::2])
I have tried applying this step: rebinned_energy = phaii.rebin_energy(combine_by_factor, 2) while converting TTE.fit file to TTE.pha2 file for time binning but it is not binning background and detector response files. Do I need to bin background and detector response files too? If yes, then how?
Even after I proceed with energy binned TTE.pha2 file then still no result is shown while plotting energy spectrum or while doing spectral analysis. Is there any way to do it?
Can anybody please help me with this? I am stuck at these issues for months now. :( :( :(