STScI Logo

Release Notes for stsci_python
stsci_python 2.4 Release Notes

13 November 2006

This release includes new versions of PyRAF, MultiDrizzle and related tasks. A couple of new data analysis tasks have been added; namely,

  • SSHIFT and  STISNOISE have been moved from STSDAS to the STISTOOLS package.
  • MKTRACE and WX2D have been added to the STISTOOLS package.
  • GFIT and LINEFIT have been added to the PyTOOLS package.
  • WCSUTIL and FILEUTIL have been moved from PyDrizzle to the PyTOOLS package.

This distribution now also includes proper LICENSE information for reference.

Last Release that uses numarray

This release will also be the last release which uses numarray.  The next release (V2.5, expected in spring 2007) will include software which relies on numpy instead. numpy is a 3rd-generation array package for Python that includes all of numarray's features and capabilities (and more) though with some changes in the user interface. The next release will present details on what will change. We will also post on the numarray web site in a few months details to aid users of numarray in the switchover to numpy.

The switch to numpy will unify the Python scientific community in the use of a common array package. This is a very desirable outcome despite the inconvenience in making the switch.

Support for numarray will start to be phased out after the next stsci_python release.  Currently numarray is  being maintained and any major problems found will be fixed. No more significant enhancements are being made. By V2.7 we will completely stop support for numarray. PyFITS 1.1 will support both numarray and numpy (beta versions have long been available). The dual support will end when support for numarray is stopped.

Platform Support

Normally, platform support issues do not apply to Python tasks, as most Python code will run on all platforms on which Python has been installed. This distribution was tested to correctly support installation on Linux, Mac OS X, and Solaris, while also being provided for installation under Windows. The single exception is that the text-based epar functionality now available in PyRAF (in addition to the already existing GUI-based epar) is not available under Solaris, and likely will never be.


Documentation for these tasks has been consolidated into a single location complete with a index viewable as a local web page. The documentation includes any available user guides and API documentation generated using 'EPYDOC' for the modules or packages. This index can be accessed using:

--> import stscidocs
--> stscidocs.viewdocs()

This will automatically bring up the default web browser application to display the index page. All the available documentation for software packaged with this distribution can be accessed through this interface, as this documentation resides locally upon installation.

Python Environment

Python 2.3 or later is required.

PyRAF 1.3

This version includes the following enhancements and bugfixes:


Support for the IPython shell environment. IPython a great many shell enhancements than are provided by the PyRAF interactive shell. This includes all the PyRAF shell features and such things such as:

  • syntax highlighting
  • many magic and file-level commands (e.g., cd, ls, rm, etc.)
    • includes ability to define ones own magic commands
  • extensive history features
  • extensive help features
  • debugging support (pdb mode)
  • the ability to work with several differnt GUI toolkits
There is extensive documentation for IPython. It can be started by typing:

pyraf --ipython

It is our plan to eventually make this the default mode for pyraf.   See pyraf/docs/ipython_notes.txt for more information on using IPython with PyRAF.

Pyraf now has an alternate parameter editor: tpar.  tpar is:
  • text/keyboard rather than Tk GUI based
  • suitable for low bandwidth network links
  • similar in flavor but not identical to IRAF's CL epar
  • vi or emacs keybindings driven by the "editor" environment variable
  • invoked just like epar:    tpar <taskname>
  • not supported under Solaris.

installation requirements:
   using IPython requires installation of IPython version 0.7.2 or greater found here:
   using tpar requires the installation of the text widget package urwid version 0.9.4 or greater found here:


See the PyRAF Trac site for more details

Trac number:   Description
52      PyRAF imaccess function returns True for a filename with spaces only
53      scan and fscan can't eval objects in iraf namespace
54      PyRAF aborts on startup if history command in or
55      PyRAF traceback handling broken under Python 2.5
56      imaccess() returns 1 for a filename with empty brackets

PyFITS 1.0.1

The version of PyFITS that is included in this release is the same as that for the previous stsci_python release. We had desired to release PyFITS v1.1 in this release that included support for both numarray and numpy, but since numpy 1.0 was released too late to completely test PyFITS v1.1 with it, it has not been included. We expect to release PyFITS v1.1 shortly (with a month or so) separately.

numarray 1.5.2

This is a very modest release which primarily consists of bug fixes to
numarray's implementation of the numpy array interface.

Related Source Forge Tracker Items

1545988 Added numpy ndim attribute
1469418 Array interface fails on views
1545971 Array interface memory leak
1540639 Added __array_struct__ to masked arrays
1495660 numarray: segfault in rich compare
1492157 bug in choose in recent numarray versions
1488863 Two bugs in memap
1484133 putmask byteswapped array
1476288 Problems with initialization of 1-element string fields

numdisplay 1.1

Same as version in stsci_python 2.3


This package includes tasks with general utility, including the following new utility modules:
  • wcsutil
    • This module provides the ability to read in the WCS keywords from a FITS or STSCI Geis formatted image header and perform some operations, such as coordinate transformations. This module originated with PyDrizzle package, but was moved out for use by MultiDrizzle and other image analysis tasks.
  • fileutil
    • This module supports access of HST association tables and HST distortion coefficient reference tables, while also providing many more general file I/O and FITS/GEIS header operations.  It also includes support for IRAF-style environment variable interpretation through a Python-only version of osfn which removes the dependency on IRAF or PyRAF. MultiDrizzle still uses this module, as it was moved out of the PyDrizzle package to support more general access to HST and IRAF-generated images without requiring IRAF itself.
  • gfit
    • This module provides gauss fitting capabilities for 1-D data.
  • linefit
    • This modules performs weighted linear fitting.



This version of MultiDrizzle has not changed much in and of itself, rather most of the differences in results come from modifications to the underlying PyDrizzle (see below).  However, one primary bug was fixed to better support operations on NICMOS data:
  • The units for NICMOS data now get properly accounted for by MultiDrizzle, converting to electrons correctly regardless of the input units or exposure time.


This version of PyDrizzle (and therefore, MultiDrizzle) finally achieves agreement with the results produced by the IRAF tasks 'drizzle' and 'wdrizzle' with one caveat:
  • The definition of the reference pixel for the input image has been set to a floating point value of (naxis1/2.0 + 1.0, naxis2/2.0+1.0), instead of the integer value of (naxis1/2 + 1, naxis2/2 + 1).  This change in convention only affects the callable version of 'drizzle' used by MultiDrizzle and PyDrizzle.  Unfortunately, there was not enough time to achieve complete agreement with the integer definition prior to this release.  This only generates differences from the IRAF version of 'drizzle' for input images which have odd (not evenly divisible by 2) dimensions, such as some subarray readouts, and does not affect general use.

The set of bugs fixed for this version include:
  • The coefficients translated from the IDCTAB now get written out using the 'refpix' convention of 'drizzle', eliminating the need to perform any interpolation of the coefficients to match up the reference pixel of the model with the image frame assumed by 'drizzle'.
  • Application of the velocity aberration within PyDrizzle has been turned off.  PyDrizzle now assumes that the WCS keywords in the input images have already been corrected for this affect as performed by makewcs.
  • Numerous internal changes were made to make the computations more consistent with those performed by the underlying 'drizzle' code.
  • Problems introduced by specifying an incomplete set of WCS values (RA,Dec, scale, orientation) for the desired output frame were corrected.
  • A new parameter, debug,  was added to the method to enable updating of the product WCS keywords from those computed by 'drizzle' as opposed to those computed by PyDrizzle. This can be used to verify that the output WCS was computed in a consistent manner.


A number of changes have been made to this task since its original (alpha) release.

Parameter changes:
  • The units of histbinwidth were changed so they match the units of the SAA persistence model image.
  • The name of the parameter histclip was changed to nclip
  • The darkpath parameter is now used to find the reference files only if the SAADFILE keyword is not set in the post-SAA exposure header, or if the file specified there cannot be found.
  • Two additional diagnostic files are now created if the alldiags parameter is set. The diag_filenameroot_hist.txt file contains the version of the SAA persistence image histogram data that is actually fit. The diag_filenameroot_gp_iters.txt contains the sequence of coefficients for each iteration in the gausspoly fit.

    Algorithmic changes:
  • Imagestats is no longer used to determine the domain threshold; instead, a gaussian-polynomial fit is performed to the SAA persistence image histogram (after some data massaging, as in the original IDL prototype). This produces a more robust estimate of the threshold. The final coefficients for the fit are printed to stdout.  Note: This update changes the recommended values for parameters histbinwidth and nclip in the IRAF task parameters.
  • The value of the SCNAPPLD keyword in the targimage is now checked to ensure the correction is not applied twice to the same file. Text messages inform the user that this is not a good idea.
  • The procedure for constructing the persistence model was changed to use a straight median, rather than a sigma-clipped median.
  • The exception logic was changed for the case when the high-signal domain contains too few pixels; instead of raising an exception, a warning is now given and the task fails over to use the low-signal domain calculations only.

  • Corrected handling of the case when the specified calcimage is not the same as the targimage.
  • Corrected number of pixels in each domain printed to diagnostic file.
  • Corrected bug in reading the previously-existing SAA persistence model file (if readsaaper is set)


This package contains the data analysis tasks developed for post-pipeline processing of STIS data.  New tasks include:
  • WX2D
    This task uses wavelets to resample a 2-D spectral image.  The output is resampled in the cross-dispersion direction so that the spectral trace will be at a constant row number.  Unlike the 'x2d' task, however, the output from 'wx2d' will not be resampled in the dispersion direction.
    The  purpose  of  the  ctestis  task  is to correct signal levels of point-like sources in  photometry  tables  measured  from  STIS CCD images  for  charge loss due to imperfect Charge Transfer Efficiency (CTE). The algorithm used to correct for CTE-induced signal loss  is the  one  published in Goudfrooij, Bohlin, Maiz-Apellaniz, & Kimble, 2006, PASP, October 2006 edition (astro-ph/0608349).  The values of CTE  loss  derived  using this algorithm should be accurate to about 3% RMS (tested for data taken between March 1997 and  August  2004).
    This task refines the traces in a trace table based on a science spectrum and its grating and central wavelength.A  trace is generated from a science file by fitting a gaussian to each column.  The two traces bracketing the computed  trace center are  extracted from the trace table and interpolated. The correction is computed as the difference between the linear fit to the science trace and the interpolated trace. The correction is applied to all traces in the trace table with  that  particular OPT_ELEM and  CENWAVE.  An updated trace table is then written out to the current  directory.

The Python code for the tasks SSHIFT and STISNOISE were moved from the STIS package to the STSCI_PYTHON tree.  This allows the tasks to be distributed and run separately from IRAF or STSDAS, as they have no inherent dependencies on either environment.  These tasks still retain their IRAF interfaces in the STIS STSDAS package.