Astrodrizzle crashes on start - AttributeError: deg2rad

lhoveylhovey Member Posts: 5
edited October 2015 in Image Combination
I am trying to run astrodrizzle to combine 814w wfc3 uvis images. When I run astrodrizzle in pyraf or python I get this attribute error and cannot figure this out to save my life. Any help would be appreciated.

Luke the program was started with the code below...

from numpy import unique,where,array,median,max,std,zeros,linspace,correlate,arange,log10
from pyraf import iraf
from iraf import stsdas
import os,shutil,sys
import pyfits
import drizzlepac
from drizzlepac import astrodrizzle
astrodrizzle.AstroDrizzle('@i_list', output='814w_final',final_scale=0.04, final_rot=0)

Comments

  • lhoveylhovey Member Posts: 5
    I am using AstroDrizzle Version 1.1.16, and the full error report is copied below.

    INFO:drizzlepac.util:Setting up logfile : astrodrizzle.log
    Setting up logfile : astrodrizzle.log
    INFO:drizzlepac.astrodrizzle:AstroDrizzle Version 1.1.16(30-Dec-2013) started at: 11:09:50.736 (12/10/2015)
    AstroDrizzle Version 1.1.16(30-Dec-2013) started at: 11:09:50.736 (12/10/2015)
    INFO:drizzlepac.astrodrizzle:

    INFO:drizzlepac.astrodrizzle:Version Information
    INFO:drizzlepac.astrodrizzle:--------------------
    INFO:drizzlepac.astrodrizzle:Python Version 2.7.3 (default, Aug 2 2012, 16:36:13)
    [GCC 4.2.1 (Based on Apple Inc. build 5658) (LLVM build 2336.11.00)]
    INFO:drizzlepac.astrodrizzle:numpy Version -> 1.8.1
    INFO:drizzlepac.astrodrizzle:pyfits Version -> 3.3.dev
    INFO:drizzlepac.astrodrizzle:stwcs Version -> 1.1.4.dev31123
    INFO:drizzlepac.astrodrizzle:pywcs Version -> 1.12.1.dev4012
    INFO:drizzlepac.util:==== Processing Step Initialization started at 11:09:50.741 (12/10/2015)
    ==== Processing Step Initialization started at 11:09:50.741 (12/10/2015)
    INFO:drizzlepac.processInput:Executing serially
    INFO:drizzlepac.processInput:Setting up output name: 814w_final_drc.fits
    INFO:drizzlepac.processInput:-Creating imageObject List as input for processing steps.
    INFO:drizzlepac.imageObject:Reading in MDRIZSKY of 31.4823226929
    INFO:drizzlepac.imageObject:Reading in MDRIZSKY of 31.4823226929
    WARNING:py.warnings:Need a valid header in order to calculate footprint


    ERROR:drizzlepac.astrodrizzle:##############################################################################
    ##############################################################################
    ERROR:drizzlepac.astrodrizzle:# #
    # #
    ERROR:drizzlepac.astrodrizzle:# ERROR: #
    # ERROR: #
    ERROR:drizzlepac.astrodrizzle:# AstroDrizzle Version 1.1.16 encountered a problem! Processing terminated #
    # AstroDrizzle Version 1.1.16 encountered a problem! Processing terminated #
    ERROR:drizzlepac.astrodrizzle:# at 11:09:56.668 (12/10/2015). #
    # at 11:09:56.668 (12/10/2015). #
    ERROR:drizzlepac.astrodrizzle:# #
    # #
    ERROR:drizzlepac.astrodrizzle:##############################################################################
    ##############################################################################
    INFO:drizzlepac.util:

    INFO:drizzlepac.util: -------------------- --------------------
    -------------------- --------------------
    INFO:drizzlepac.util: Step Elapsed time
    Step Elapsed time
    INFO:drizzlepac.util: -------------------- --------------------
    -------------------- --------------------
    INFO:drizzlepac.util:

    INFO:drizzlepac.util: Initialization 0.0000 sec.
    Initialization 0.0000 sec.
    INFO:drizzlepac.util: ==================== ====================
    ==================== ====================
    INFO:drizzlepac.util: Total 0.0000 sec.
    Total 0.0000 sec.
    INFO:drizzlepac.util:Trailer file written to: astrodrizzle.log
    Trailer file written to: astrodrizzle.log
    ERROR:stsci.tools.logutil.exc:An unhandled exception ocurred:
    Traceback (most recent call last):
    File "/usr/local/astro64/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/drizzlepac/util.py", line 214, in wrapper
    func(*args, **kwargs)
    File "/usr/local/astro64/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/drizzlepac/astrodrizzle.py", line 192, in run
    imgObjList, outwcs = processInput.setCommonInput(configobj)
    File "/usr/local/astro64/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/drizzlepac/processInput.py", line 183, in setCommonInput
    inmemory=virtual)
    File "/usr/local/astro64/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/drizzlepac/processInput.py", line 308, in createImageObjectList
    image.compute_wcslin(undistort=undistort)
    File "/usr/local/astro64/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/drizzlepac/imageObject.py", line 1159, in compute_wcslin
    wcslin = distortion.utils.output_wcs([chip_wcs],undistort=undistort)
    File "/usr/local/astro64/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/stwcs-1.1.4.dev31123-py2.7.egg/stwcs/distortion/utils.py", line 31, in output_wcs
    crval1,crval2 = computeFootprintCenter(fra_dec)
    File "/usr/local/astro64/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/stwcs-1.1.4.dev31123-py2.7.egg/stwcs/distortion/utils.py", line 76, in computeFootprintCenter
    alpha = np.deg2rad(edges[:,0])
    AttributeError: deg2rad
    ---------------------------------------------------------------------------
    AttributeError Traceback (most recent call last)
    /usr/local/astro64/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/drizzlepac/util.pyc in wrapper(*args, **kwargs)
    212
    213 try:
    --> 214 func(*args, **kwargs)
    215 except Exception as errorobj:
    216 pass

    /usr/local/astro64/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/drizzlepac/astrodrizzle.pyc in run(configobj, wcsmap)
    190 procSteps.addStep('Initialization')
    191 imgObjList = None
    --> 192 imgObjList, outwcs = processInput.setCommonInput(configobj)
    193 procSteps.endStep('Initialization')
    194

    /usr/local/astro64/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/drizzlepac/processInput.pyc in setCommonInput(configObj, createOutwcs)
    181 group=configObj['group'],
    182 undistort=undistort,
    --> 183 inmemory=virtual)
    184
    185 # apply context parameter

    /usr/local/astro64/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/drizzlepac/processInput.pyc in createImageObjectList(files, instrpars, group, undistort, inmemory)
    306 image = _getInputImage(img,group=group)
    307 image.setInstrumentParameters(instrpars)
    --> 308 image.compute_wcslin(undistort=undistort)
    309 if 'MTFLAG' in image._image['PRIMARY'].header:
    310 # check to see whether we are dealing with moving target observations...

    /usr/local/astro64/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/drizzlepac/imageObject.pyc in compute_wcslin(self, undistort)
    1157
    1158 # compute the undistorted 'natural' plate scale for this chip
    -> 1159 wcslin = distortion.utils.output_wcs([chip_wcs],undistort=undistort)
    1160 sci_chip.wcslin_pscale = wcslin.pscale
    1161

    /usr/local/astro64/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/stwcs-1.1.4.dev31123-py2.7.egg/stwcs/distortion/utils.pyc in output_wcs(list_of_wcsobj, ref_wcs, owcs, undistort)
    29 # This new algorithm may not be strictly necessary, but it may be more
    30 # robust in handling regions near the poles or at 0h RA.
    ---> 31 crval1,crval2 = computeFootprintCenter(fra_dec)
    32
    33 crval = np.array([crval1,crval2], dtype=np.float64) # this value is now zero-based

    /usr/local/astro64/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/stwcs-1.1.4.dev31123-py2.7.egg/stwcs/distortion/utils.pyc in computeFootprintCenter(edges)
    74 This algorithm should be more robust against discontinuities at the poles.
    75 """
    ---> 76 alpha = np.deg2rad(edges[:,0])
    77 dec = np.deg2rad(edges[:,1])
    78

    AttributeError: deg2rad

    ---------------------------------------------------------------------------
    TypeError Traceback (most recent call last)
    in ()
    6 import drizzlepac
    7 from drizzlepac import astrodrizzle
    ----> 8 astrodrizzle.AstroDrizzle('@i_list', output='814w_final',final_scale=0.04, final_rot=0)

    /usr/local/astro64/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/drizzlepac/astrodrizzle.pyc in AstroDrizzle(input, mdriztab, editpars, configobj, wcsmap, **input_dict)
    106 # already called 'run()'.
    107 if editpars == False:
    --> 108 run(configObj, wcsmap=wcsmap)
    109
    110 #

    /usr/local/astro64/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/drizzlepac/util.pyc in wrapper(*args, **kwargs)
    222 # (hope that end_logging didn't change the last exception raised)
    223 if errorobj:
    --> 224 raise
    225
    226 return wrapper

    TypeError: exceptions must be old-style classes or derived from BaseException, not NoneType
  • mack@stsci.edumack@stsci.edu Member, Institute_Staff, Moderator_DrizzlePac Posts: 28
    Hi,
    Can you give more information on the contents of your input list? Is this a list of *flt.fits images? Early on, it seems to be complaining that there is no valid header to compute the output footprint. If you did a manual CTE correction to produce *flc.fits frames, can you please confirm that the file structures are the same as the *flt.fits frames? An earlier version of this software was not preserving the header information appropriately. (It has since been corrected with the software on the WFC3 page).

    In PyRAF you could do this to check: 'catfits *flt.fits' and compare with 'catfits *flc.fits'.

    One other note is that in order to set the final_scale and the final_rot parameters, you also need to set the parameter final_wcs=True in order for these settings to be picked up.

    Jennifer
  • lhoveylhovey Member Posts: 5
    edited October 2015
    I am using flc files produced by using the ctereverse.F code for the uvis. I just downloaded the code so it is presumably the most reason. I checked the headers and the flt and associated flc file headers appear to be identical, besides the added header information for the cte correction at the bottom of the header in the flc file. The catfits command also produced identical outputs. When I tried running astrodrizzle with the ,final_wcs=True keyword, I had the same error message as posted at the beginning of the thread.
  • mack@stsci.edumack@stsci.edu Member, Institute_Staff, Moderator_DrizzlePac Posts: 28
    Luke, Thanks for verifying. Just to rule out the CTE code as the culprit, do you have the same problem if you run with the *flt.fits files? Jennifer
  • lhoveylhovey Member Posts: 5
    Yes, the same problem occurs. Is there a DMG to install this package, I am afraid there may have been a problem with the ureka installation. Other then that, I am at a loss.
  • mack@stsci.edumack@stsci.edu Member, Institute_Staff, Moderator_DrizzlePac Posts: 28
    Hi again, at this point I would agree that a reinstall would be the best bet. You can get the software here. http://ssb.stsci.edu/ureka/ Just click on the link for 'latest version'. There were a bunch of updates to astropy recently, and those were causing some crashes, so hopefully this will resolve your problem. Please let us know if you have further problems and I can put you in touch with our Ureka software team.
  • lhoveylhovey Member Posts: 5
    I have installed the newest version of ureka as per your suggestion, and when I try to install drzzlepac I get the following error:
    [hovey-3:~] lukehovey81% ur_install drizzlepac_2
    http://ssb.stsci.edu/ureka/1.5.2/Ureka_osx-6_64_1.5.2_drizzlepac_2_addon.tar.gz
    ERROR: drizzlepac_2 is not a valid addon name
  • mack@stsci.edumack@stsci.edu Member, Institute_Staff, Moderator_DrizzlePac Posts: 28
    Luke, You likely need to do a complete reinstall of Ureka, not just the drizzlepac_2 add-on. I will double check with the Ureka developer to be sure.
  • mack@stsci.edumack@stsci.edu Member, Institute_Staff, Moderator_DrizzlePac Posts: 28
    Hi again, It seems the problem you originally ran into stems from a change in numpy found in the old installation as well as a change in DrizzlePac and STWCS to keep up with the numpy change. We advise you to install the latest version of the Ureka code available, preferably from the SSBX distribution. This will install DrizzlePac v2.x instead of trying to simply graft on the new version to the old Ureka installation which would retain the old (broken) numpy.
Sign In or Register to comment.