Closed bwgref closed 6 years ago
Ping @danielrwik
Okay, so I don't like that this script is rebuilding nuproducts from the ground up. I think this gets people out of the habit of using the FTOOL version of the products, even though this basically just reproduces about half of what's going on.
What we really need is to get the amount of time that a region spent on each detector, right? Once we have this then we can apply the detabs as you've done here.
One thing I realized is that we do need an uncompressed RMF in order to multiply the detabs parameters onto it. I see that a chunk of getspecrmf actually handles this.
For safety we can force cmprmf=no in the nuproducts call so that we don't end up with a compressed RMF. That leaves us with a huge gangly RMF after the fact, so I think we do need to recompress it after the fact.
We can get the time spent on each detector for free in two ways using nuproducts so long as we produce an RMF. This is good because this tracks the relative exposure as a function of time (not that it'll matter for what we're doing here, but since we have the tools...).
(1) If the region only touches one detector, then the header information in the MATRIX extension has a keyword called "DETNAME" that looks like "DET2" or something. Then we can just grab the detabs values from the CALDB and we're done.
(2) If the region touches multiple detectors then addrmf is called. Fortunately, addrmf is smart because it adds HISTORY keywords to the RMF file that give the path to various RMF files that are added together. Unfortunately, addrmf is dumb and doesn't notice that it's trying to add in really long file names to the HISTORY column, so in my run to test this the HISTORY keywords are useless.
However, we can parse the logfile in this case. If we force people to use a wrapper script to run nuproducts on the background files then we can dump the log output into bgd and then parse that to figure out which detectors are combined together.
Once I get this solved I think we can release a "0.2" version that is more or less complete.
...or I can just read your actual notes and see that addabs2rmf.pro already does this. So...yeah...
Hey @bwgref - Right, so addabs2rmf.pro is an extra step that is needed now that nuabs has been phased out. Extracting spectra through IDL was convenient for me and had an aesthetic appeal, but I'm happy to leave as much to nuproducts as possible so I don't accidentally add any dumb bugs.
BTW, thanks for migrating this version to the master copy and cleaning up the github (removing the other nuskybgd copy nested in nustar-idl) -- I had been meaning to do this but just could never get around to it. Let me know if there are specific updates to nuskybgd you need, documentation- or otherwise -- actually I see all the issues you've pointed out now. I'll try to take a look at them when I can, but email me about any more urgent ones.
Yeah, on a cleanup kick now that Cas A is submitted. Trying to cross off some of my long term To Do items.
If you could add an example of how to use addabs2rmf.pro in the ABC markdown file that would be great.
On Sep 15, 2016, at 12:13 PM, danielrwik notifications@github.com<mailto:notifications@github.com> wrote:
Hey @bwgrefhttps://github.com/bwgref - Right, so addabs2rmf.pro is an extra step that is needed now that nuabs has been phased out. Extracting spectra through IDL was convenient for me and had an aesthetic appeal, but I'm happy to leave as much to nuproducts as possible so I don't accidentally add any dumb bugs.
BTW, thanks for migrating this version to the master copy and cleaning up the github (removing the other nuskybgd copy nested in nustar-idl) -- I had been meaning to do this but just could never get around to it. Let me know if there are specific updates to nuskybgd you need, documentation- or otherwise.
You are receiving this because you were mentioned. Reply to this email directly, view it on GitHubhttps://github.com/NuSTAR/nuskybgd/issues/6#issuecomment-247423413, or mute the threadhttps://github.com/notifications/unsubscribe-auth/AASvtg6rZxl0VCj_aRmpKweDRm3mLE8hks5qqZiTgaJpZM4JxFNi.
...right now it's not really clear how it's supposed to be called, since the example nuskybgd.pro script has not been updated to include calls to this script.