NuSTAR / nustar-gen-utils

Repository for (hopefully) useful NuSTAR python tools
MIT License
9 stars 9 forks source link

Event file list (obs.evtfiles) empty when not using event_cl #64

Closed mckinley-brumback closed 3 years ago

mckinley-brumback commented 3 years ago

Within the Straylight Wrapper Example Notebook, event files are specified as by calling obs.evtfiles. Evtfiles appears to typically contain the list of *_cl.evt files within event_cl, and so a particular file can be specified (i.e. evf = obs.evtfiles['A'][0]).

This breaks if the user has run the NuSTAR pipeline with outdir set to something other than event_cl, even if the user has specified their alternative obs.evdir. As an example, I ran nupipeline with 'outdir=./out 'and then ran:

from nustar_gen import wrappers, info, utils import os

here = os.getcwd()+'/' obs = info.Observation(seqid='30361002002', path=here, evdir=here+'./30361002002/out', out_path='./30361002002/SL_products')

evfA = obs.evtfiles['A'][0] det1A_file = wrappers.make_det1_image(evfA, elow=3, ehigh=20)

And found the following error: evfA = obs.evtfiles['A'][0] IndexError: list index out of range

In this case, trying to print obs.evtfiles returns an empty list.

I was able to work around this issue by changing the line 'evfA = obs.evtfiles['A'][0]' to define the desired event file explicitly: evfA = here+'./30361002002/out/nu30361002002A01_cl.evt'

I also found that, if I reran the NuSTAR pipeline with 'outdir=./event_cl', the code ran as expected. For example:

from nustar_gen import wrappers, info, utils import os

here = os.getcwd()+'/' obs = info.Observation(seqid='30361002002', path=here, out_path='./30361002002/tstevcl_SL_products')

evfA = obs.evtfiles['A'][0] det1A_file = wrappers.make_det1_image(evfA, elow=3, ehigh=20)

This ran with no errors, and printing obs.evtfiles produced a list of all *_cl.evt event files within event_cl.

bwgref commented 3 years ago

Closed with #66