Skip to content
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

Crashing in TWOZONE when BACKCORR=OMIT #183

Open
lmiller20 opened this issue Apr 29, 2021 · 0 comments
Open

Crashing in TWOZONE when BACKCORR=OMIT #183

lmiller20 opened this issue Apr 29, 2021 · 0 comments
Labels

Comments

@lmiller20
Copy link

When the XTRACTALG = TWOZONE and BACKCORR = OMIT, CalCOS will crash with the following error:

---------------------------------------------------------------------------
UnboundLocalError                         Traceback (most recent call last)
<ipython-input-10-05b2f5b03a8b> in <module>()
----> 1 calcos.calcos('ldwd01hfq_rawtag_a.fits')~/anaconda/envs/astroconda_3/lib/python3.6/site-packages/calcos/calcos.py in calcos(asntable, outdir, verbosity, find_target, create_csum_image, raw_csum_coords, only_csum, binx, biny, compress_csum, compression_parameters, shift_file, save_temp_files, stimfile, livetimefile, burstfile)
    432 
    433     wav_status = cal.allWavecals()
--> 434     sci_status = cal.allScience()
    435     if sci_status:                      # bad value for aperture keyword
    436         return sci_status~/anaconda/envs/astroconda_3/lib/python3.6/site-packages/calcos/calcos.py in allScience(self)
   2852                                      obs.info)
   2853                     if obs.switches["x1dcorr"] == "PERFORM":
-> 2854                         self.extractSpectrum(obs.filenames)
   2855                         any_x1dcorr = "PERFORM"
   2856                         any_spectroscopic = "PERFORM"~/anaconda/envs/astroconda_3/lib/python3.6/site-packages/calcos/calcos.py in extractSpectrum(self, filenames)
   2920         find_target = self.assoc.cl_args["find_target"]
   2921         extract.extract1D(input, incounts, output,
-> 2922                           find_target=find_target)
   2923 
   2924         # Copy keywords from input (the flt file) to corrtag.~/anaconda/envs/astroconda_3/lib/python3.6/site-packages/calcos/extract.py in extract1D(input, incounts, output, update_input, location, extrsize, find_target)
    205         doExtract(ifd_e, ifd_c, ofd, nelem,
    206                   segments, info, switches, reffiles, is_wavecal,
--> 207                   location, extrsize, local_find_targ)
    208         if switches["fluxcorr"] == "PERFORM":
    209             # Convert net count rate to flux.~/anaconda/envs/astroconda_3/lib/python3.6/site-packages/calcos/extract.py in doExtract(ifd_e, ifd_c, ofd, nelem, segments, info, switches, reffiles, is_wavecal, location, extrsize, local_find_targ)
    645                                             info, wavelength, is_wavecal,
    646                                             user_xdisp_locn, user_xdisp_size,
--> 647                                             local_find_targ)
    648             else:
    649                 cosutil.printMsg("Unknown extraction method, defaulting to", \~/anaconda/envs/astroconda_3/lib/python3.6/site-packages/calcos/extract.py in extractSegmentTwozone(e_data, c_data, e_dq_data, ofd_header, segment, x_offset, sdqflags, sdqouter, snr_ff, exptime, backcorr, axis, hdr, xtract_info, shift2, proftab_info, info, wavelength, is_wavecal, user_xdisp_locn, user_xdisp_size, find_target)
   1551         term1_i = 0.0
   1552     term2_i = np.zeros(ncols, dtype=np.float32)
-> 1553     goodcolumns = np.where(nrows_c_bkg_i > 0)
   1554     term2_i[goodcolumns] = (flat_correction[goodcolumns])**2 * exptime \
   1555         * (total_ccounts[goodcolumns] + \UnboundLocalError: local variable 'nrows_c_bkg_i' referenced before assignment

Rather than having an unhelpful error, we should have CalCOS exit instead with a reason why it is exiting (crash gracefully).
 

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants