Closed nyctophile-aayu closed 3 months ago
Hi @nyctophile-aayu:
When you bin TTE in time using the to_phaii()
method, it creates a Phaii
object (also called Cspec
or Ctime
for the two different types of GBM Phaii
objects). This is a fundamentally different datatype than TTE. TTE is an event list, where the time and channel number for each count is recorded. When you bin in time, it is no longer an event list. It is a time series of spectra. That is what a PHA2 file is (and what a Phaii
object represents).
When you integrate a TTE or Phaii
object over time, you get a Pha
object. What distinguishes a Pha
object from Phaii
is that Pha
is only a single spectrum (because you integrated over time), while Phaii
contains a time series of spectra.
The first problem you mention is due to the fact that you binned TTE in time and created a PHA2 file, therefore it won't have the individual count information. The second problem you mention is because you integrated the PHA2 over time to produce a PHA file, which will have different columns than a PHA2 file.
I encourage you to look at some of the documentation to clear up some of these issues. PHA documentation PHAII documentation TTE documentation
Hi, I have tried the following notebook to generate to process following steps:
I have tried re-write into .fit, .pha2 files both.
But the issue is: in the original .fit file, in the
events
extension,Time
&Pha
columns are listed, which should be there in the re-written .fit file. But in the re-written tte.fit file there is noEvents
extension present, instead in theSpectrum
extension,Channel
,Counts
,Quality
columns are present. This updated file when processed for the spectral study, using:n0 = Cspec.open('data1/glg_tte_n0_bn220627890_v00.fit')
generating error:
KeyError: "Key 'ENDTIME' does not exist."
Also, in the previously converted .pha2 file from GBM tools used to process for spectral analysis using:
n0 = Cspec.open('data1/glg_tte_n0_bn220627890_v00.pha2')
works fine. But that file is not energy binned. But if I process the .fit file for both time and energy binning and the re-write into .pha2 file then also inspite of having columns:
Counts
,Exposure
,Quality
,Time
,Endtime
, in theSpectrum
extension, againChannel
,Counts
,Quality
columns are present in theSpectrum
extension. This updated file when again process for spectral study then it is causing the same error.Is there a way to obtain these columns:
Counts
,Exposure
,Quality
,Time
,Endtime
, in theSpectrum
extension in the updated .pha2 or .fit file? If yes, please suggest how?I am attaching the files for your reference. pha_files.zip