NuSTAR / nustar-gen-utils

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

make_straylight_arf #90

Closed bwgref closed 2 years ago

bwgref commented 2 years ago

Fails incorrectly when filter file is not found


NameError Traceback (most recent call last) Input In [9], in 4 filt_ev = os.path.join(obs.evdir, f'nu10402007001B01_cl_srcB.evt') 5 reg_file = os.path.join(obs.evdir, f'srcB.reg') ----> 6 utils.make_straylight_arf(det1expo, reg_file, filt_ev, mod, obs=obs) 8 # This produces an ARF in obs.out_path 9 10 # You also need to know what the illuminated area is. Do that here: 11 area = utils.straylight_area(det1expo, reg_file, filt_ev)

File ~/science/local/git/nustar-gen-utils/nustar_gen/utils.py:288, in make_straylight_arf(det1im, regfile, filt_file, mod, obs) 283 assert os.path.isfile(det1im), \ 284 f'straylight_area: DET1 exposure map not found: {det1im}' 285 assert os.path.isfile(regfile), \ 286 f'straylight_area: Region file not found: {regfile}' 287 assert os.path.isfile(filt_file), \ --> 288 f'straylight_area: Event file not found: {evf}' 290 outdir = obs.out_path 292 out_arf = os.path.join(outdir, os.path.splitext(os.path.basename(filt_file))[0]+'.arf')

NameError: name 'evf' is not defined

...should be trying to find filt_file and not evf in the assert on line 288