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
Response and GBM files #53
Comments
I believe the issue lies in FOTRAN style indexing: f_chan[i][j] = 1 implies that the first channel is the first entry (at least in GBM DRMs) Is this general or GBM specific? |
Ok, so I tried the new plugin on XRT DRMs. It worked fine and they correctly specify the first channel as zero. GBM specifies the first channel as 1. I propose making and exception when there is a broadcast error where FCN has minus one removed. In fact, in my other code I was always doing this. I can make the change and commit. @giacomov , thoughts? |
I have already corrected this a couple fo days ago and tested on a GBM matrix, probably there are different cases. Can you post somewhere the matrix which doesn't work? This part is a little tricky, because if you get it wrong you can bias your spectral results in a non-obvious way, so we need to be careful and really understand what is going on. |
Here is an RSP (from the example folder) it does not natively work. This change causes it to work:
|
@drJfunk I have fixed this already in the new OGIPLike plugin. When you have time, please port the TTE plugin to the new OGIP plugin, by making it inherit from there instead of the old GenericOGIPLike plugin, and update the example as needed. I already updated the basic_example.ipynb notebook for your reference. The new plugin solves a lot of issues of the old one, and it is much cleaner and short. |
yeah, I wanted to discuss with you what you would like to have in the parent class (OGIPLike) and what is instead specific to the GBM. The plan is to retire GBMLike (or make it just another name of OGIPLike) as it is really confused and bug-prone. The new class features different statistics which are selectable (although the plugin decide by itself what is appropriate depending on the POISSERR keywords in the files). It is also way less confused. At the moment there is only one method that we should definitely port, which is view_counts_spectrum. Anything else which is important for any PHA spectrum, so it should be in the parent class? |
I just realized what has happened and am taking a look at the TTElike. For the moment, I see the TTElike being similar to Veritas or HAWC or LAT because it has some additional functionality that is specific to the data type. I think TTELike can be the best GBM plugin because it enables more flexibility and just keeping an OGIPlike as an option is fine. I like some of the gammapy response functions because they allow users to explore the DRMs which can be useful. Besides that, I think OGIPLike is flexible enough on its own (the data prep is always done outside the frame work). People can build more advanced plugins that do the data prep and ultimately pass through to OGIPLike in the end. Does it make sense? |
However, the OGIPLike constructor isn't suitable for the TTE data. It will need to be virtualized, or the constructor will need to have the ability to customize the file type outside of PHA. We had the same problem originally, what path do you want to take @giacomov ? |
I think the most sensitive would be to add a static method like "from_counts" to the OGIPLike class, so essentially you can build an instance on the fly without having to go through a .pha and a .bak file. Would this be sufficient? |
Yes. I think I get the idea. Not to convolute the issue, but perhaps an EVENT class is warranted? This could be a solution that is general enough for other similar data types? Sent my iPhone
|
I like it. An EventList class which provides a get_pha method to get a PHA on the fly (as well as other things). Are you going to work on this, or should I? |
I can grab it. Have you a suggestion of another data type outside of GBM tte that I can look at so that I don't make it too GBM specific? /J. Michael Sent my iPhone
|
I'd make a constructor which gets simple numpy arrays, and then you can make static methods like from_TTE to specialize to specific file formats (like pandas does with DataFrame and other containers). Each mission is going to need a reader for their specific format, and at some point we will also need to support the universal format that the gammapy people are defining. |
Cool. This leads into my next question which is related to your early comments. Will we go for Like plugins or use the more general instance? If there is a static method that takes TTE it means that at some point there will need to be modifications for future instruments. Perhaps it is better to use an inheritance scheme /J. Michael Sent my iPhone
|
Well, it turns out that GBM does not use the TLMIN keyword (at least not universally):
Therefore, the response code cannot read the file. |
I've added a way around this by assuming TLMIN = 1 when it cannot find it and will be committed with this entire update |
There seems to be an issue with the reading of GBM DRMs (similar to what I have seen with gammapy)
The text was updated successfully, but these errors were encountered: