Commit 2fea6e4f authored by Ole Streicher's avatar Ole Streicher

Imported Upstream version 2.1.7

parent e9519c66
Metadata-Version: 1.1
Name: pyraf
Version: 2.1.6
Version: 2.1.7
Summary: Provides a Pythonic interface to IRAF that can be used in place of
the existing IRAF CL
Home-page: http://www.stsci.edu/resources/software_hardware/pyraf
......
......@@ -2,7 +2,7 @@ add your name here:
sienkiew
sontag
jtaylor2
chanley
we are on:
https://aeon.stsci.edu/ssb/svn/pyraf/trunk
Metadata-Version: 1.1
Name: pyraf
Version: 2.1.6
Version: 2.1.7
Summary: Provides a Pythonic interface to IRAF that can be used in place of
the existing IRAF CL
Home-page: http://www.stsci.edu/resources/software_hardware/pyraf
......
......@@ -821,8 +821,7 @@ required_pkgs/stsci.distutils/stsci/distutils/tests/testpackage/stsci/testpackag
required_pkgs/stsci.distutils/stsci/distutils/tests/testpackage/stsci/testpackage/package_data/1.txt
required_pkgs/stsci.distutils/stsci/distutils/tests/testpackage/stsci/testpackage/package_data/2.txt
required_pkgs/stsci.tools/LICENSE.txt
required_pkgs/stsci.tools/defsetup.py
required_pkgs/stsci.tools/distribute_setup.py
required_pkgs/stsci.tools/ez_setup.py
required_pkgs/stsci.tools/setup.cfg
required_pkgs/stsci.tools/setup.cfg.orig
required_pkgs/stsci.tools/setup.py
......@@ -897,7 +896,6 @@ required_pkgs/stsci.tools/lib/stsci/tools/tests/cdva2.fits
required_pkgs/stsci.tools/lib/stsci/tools/tests/o4sp040b0_raw.fits
required_pkgs/stsci.tools/lib/stsci/tools/tests/testStpyfits.py
required_pkgs/stsci.tools/lib/stsci/tools/tests/test_xyinterp.py
required_pkgs/stsci.tools/old_stsci/__init__.py
required_pkgs/stsci.tools/scripts/convertwaiveredfits
required_pkgs/stsci.tools/scripts/stscidocs
scripts/pyraf
......
......@@ -4,7 +4,7 @@
Checks sys.argv[0] == 'pyraf' to determine whether IRAF initialization
is done verbosely or quietly.
$Id: __init__.py 2020 2013-07-25 16:26:33Z sontag $
$Id: __init__.py 2200 2014-06-04 17:40:38Z sontag $
R. White, 2000 February 18
"""
......@@ -245,28 +245,29 @@ except ImportError :
# ok to skip this on Windows
pass
else :
def raise_limit( which, howmuch ) :
def raise_limit(which, howmuch):
# We have to know the old limit so we don't ask to go above that.
# Some systems don't let you use -1 for the max limit if the
# max limit is already set.
n = resource.getrlimit( which )
oldlims = resource.getrlimit(which)
# Raise it to the max.
if ( howmuch is None ) or ( howmuch == -1 ) :
n = ( n[1], n[1] )
if (howmuch is None) or (howmuch == -1) :
newlims = (oldlims[1], oldlims[1])
else :
n = ( howmuch, n[1] )
newlims = (howmuch, oldlims[1])
# Try to set it.
try :
resource.setrlimit( which, n )
except resource.error :
resource.setrlimit(which, newlims)
# this naughty little bit of code can raise either resource.error,
# ValueError, or OSError, depending on the Python version. Catch all.
except:
# Well, we tried; this is nothing worth killing pyraf over,
# though -- either we will get by anyway, or we will find
# out later.
pass
# Currently, we just raise the stack limit.
raise_limit( resource.RLIMIT_STACK, None )
raise_limit(resource.RLIMIT_STACK, None)
"""cl2py.py: Translate IRAF CL program to Python
$Id: cl2py.py 1945 2013-03-15 18:58:29Z sontag $
$Id: cl2py.py 2154 2014-03-11 15:30:31Z sontag $
R. White, 1999 December 20
"""
......@@ -12,7 +12,7 @@ from generic import GenericASTTraversal
from clast import AST
from cltoken import Token
import clscan, clparse
from clcache import codeCache
from clcache import codeCache, DISABLE_CLCACHING
from stsci.tools.irafglobals import Verbose
from stsci.tools.for2to3 import PY3K
......@@ -66,7 +66,7 @@ def cl2py(filename=None, string=None, parlist=None, parfile="", mode="proc",
global _parser, codeCache
if PY3K:
if PY3K or DISABLE_CLCACHING:
usecache = False # ! turn caching off until it is fully tested/worked
# when this is turned on, see corresponding PY3K note in clcache.py!
......@@ -2144,7 +2144,7 @@ class Tree2Python(GenericASTTraversal, ErrorTracker):
# The following will create/call print as a statement, but is a function
# However, there may not be a valid use case to worry about here.
if PY3K:
raise RuntimeError("Error - this code is incorrect in Py3K")
raise RuntimeError("Error - this code is incorrect in PY3K")
self.write("print ")
if node[0].type == "=":
# '= expr' version of inspect
......
"""clcache.py: Implement cache for Python translations of CL tasks
$Id: clcache.py 1772 2012-06-12 03:29:07Z sontag $
$Id: clcache.py 2206 2014-06-09 20:03:35Z sontag $
R. White, 2000 January 19
"""
......@@ -18,6 +18,10 @@ else:
import pyrafglobals
import dirshelve
# In case you wish to disable all CL script caching (for whatever reason)
DISABLE_CLCACHING = False # enable caching by default
if PY3K or 'PYRAF_NO_CLCACHE' in os.environ:
DISABLE_CLCACHING = True
# set up pickle so it can pickle code objects
......@@ -94,7 +98,7 @@ class _CodeCache:
self.useSystem = 0
if not cacheList:
self.warning("Warning: unable to open any CL script cache, "
"performance will be slow")
"performance may be slow")
elif nwrite == 0:
self.warning("Unable to open any CL script cache for writing")
......@@ -329,7 +333,7 @@ if not os.path.exists(userCacheDir):
dbfile = 'clcache'
if PY3K:
if DISABLE_CLCACHING:
# since CL code caching is turned off currently for PY3K,
# there won't be any installed there, but still play with user area
codeCache = _CodeCache([os.path.join(userCacheDir,dbfile),])
......
......@@ -5,7 +5,7 @@ The first version of this will be under-representative of the total
functionality, but tests will be added over time, as code issues are
researched and addressed.
$Id: gki_psikern_tests.py 1968 2013-04-30 18:58:26Z sontag $
$Id: gki_psikern_tests.py 2254 2014-10-13 15:48:53Z sontag $
"""
from __future__ import division # confidence high
......@@ -235,16 +235,18 @@ def run_all():
os.environ['LPDEST'] = "hp_dev_null"
os.environ['PRINTER'] = "hp_dev_null"
PSDEV = 'psi_land'
EXP2IGNORE = '.*CreationDate: .*'
for t in tsts:
preTestCleanup()
func = eval(t)
print PSDEV, ':', func.__doc__.strip()
func()
ran += 1
# this test (use of psdump kernel) is too temperamental on Linux
# the psi_land kernel seems not to be supported in default graphcap on OSX 10.9.5
if not sys.platform.lower().startswith('darwin'):
PSDEV = 'psi_land'
EXP2IGNORE = '.*CreationDate: .*'
for t in tsts:
preTestCleanup()
func = eval(t)
print PSDEV, ':', func.__doc__.strip()
func()
ran += 1
# this test (psdump kernel) is too temperamental on Linux
if not sys.platform.lower().startswith('linux'):
PSDEV = 'psdump'
EXP2IGNORE = '(NOAO/IRAF '
......
......@@ -10,7 +10,7 @@ the native file system.)
See the notes in the (standard Python) module rlcompleter.py for more
information.
$Id: irafcompleter.py 1771 2012-06-08 22:57:48Z sontag $
$Id: irafcompleter.py 2175 2014-04-30 13:58:28Z sontag $
RLW, 2000 February 13
"""
......@@ -91,6 +91,10 @@ class IrafCompleter(Completer):
readline.parse_and_bind("set bell-style none")
readline.parse_and_bind("set show-all-if-ambiguous")
self.completionChar = char
# remove dash from delimiter set (fix submitted by Joe P. Ninan 4/16/14)
delims = readline.get_completer_delims()
delims = delims.replace('-','')
readline.set_completer_delims(delims)
# load any cmd history
hfile = os.getenv('HOME','.')+os.sep+'.pyraf_history'
if os.path.exists(hfile):
......
......@@ -10,7 +10,7 @@ The exception is that iraffunctions can be used directly for modules
that must be compiled and executed early, before the pyraf module
initialization is complete.
$Id: iraffunctions.py 2012 2013-07-24 19:27:52Z stsci_sienkiew $
$Id: iraffunctions.py 2202 2014-06-04 20:59:25Z sontag $
R. White, 2000 January 20
"""
......@@ -190,12 +190,17 @@ def Init(doprint=1,hush=0,savefile=None):
arch = _os.environ['IRAFARCH']
except IOError:
raise SystemExit("""
Your iraf and IRAFARCH environment variables are not defined and could not
be determined from /usr/local/bin/cl. Before starting pyraf, define them
by doing (for example)
setenv iraf /usr/local/iraf/
setenv IRAFARCH redhat
at the Unix command line. The values will depend on your IRAF installation.
Your "iraf" and "IRAFARCH" environment variables are not defined and could not
be determined from /usr/local/bin/cl. These are needed to find IRAF tasks.
Before starting pyraf, define them by doing (for example):
setenv iraf /iraf/iraf/
setenv IRAFARCH linux
at the Unix command line. Actual values will depend on your IRAF installation,
and they are set during the IRAF user installation (see iraf.net), or via
Ureka installation (see http://ssb.stsci.edu/ureka). Also be sure to run the
"mkiraf" command to create a logion.cl (http://www.google.com/search?q=mkiraf).
""")
#stacksize problem on linux
......@@ -249,6 +254,8 @@ at the Unix command line. The values will depend on your IRAF installation.
fname = _os.path.abspath('login.cl')
elif access('home$login.cl'):
fname = 'home$login.cl'
elif access(_os.path.expanduser('~/.iraf/login.cl')):
fname = _os.path.expanduser('~/.iraf/login.cl')
elif not _irafinst.EXISTS:
fname = _irafinst.getNoIrafClFor('login.cl', useTmpFile=True)
else:
......@@ -647,7 +654,6 @@ def getTask(taskname, found=0):
taskname = _irafutils.untranslateName(taskname)
# Try assuming fully qualified name first
task = _tasks.get(taskname)
if task is not None:
if Verbose>1: print 'found',taskname,'in task list'
......@@ -655,14 +661,13 @@ def getTask(taskname, found=0):
# Look it up in the minimum-match dictionary
# Note _mmtasks.getall returns list of full names of all matching tasks
fullname = _mmtasks.getall(taskname)
if not fullname:
if found:
return None
else:
raise KeyError("Task "+taskname+" is not defined")
if len(fullname) == 1:
# unambiguous match
task = _tasks[fullname[0]]
......
"""irafpar.py -- parse IRAF .par files and create lists of IrafPar objects
$Id: irafpar.py 2080 2013-11-06 19:31:41Z sontag $
$Id: irafpar.py 2205 2014-06-09 17:44:43Z sontag $
R. White, 2000 January 7
"""
......@@ -183,16 +183,30 @@ class IrafParPset(IrafParS):
# assume there are no query or indirection pset parameters
# if parameter value has .par extension, it is a file name
# see if parameter value has .par extension, if so, it is a file name
f = self.value.split('.')
if len(f) <= 1 or f[-1] != 'par':
# must be a task name
return pyraf.iraf.getTask(self.value or self.name)
else:
if len(f) > 1 and f[-1] == 'par':
# must be a file name
from iraffunctions import IrafTaskFactory
irf_val = pyraf.iraf.Expand(self.value)
return IrafTaskFactory(taskname=irf_val.split(".")[0],
value=irf_val)
else:
# must be a task name
if self.value:
# The normal case here is that the value is a task name string
# so we get&return that task. There is a quirky case where in
# some CL scripts (e.g. ccdproc.cl), the CL script writers use
# this place as a temporarty place to store values; handle that.
if self.value.startswith('<') and self.value.endswith('>') and self.name in self.value:
# don't lookup task for self.value, it is something like:
# "<IrafCLTask ccdproc (mscsrc$ccdproc.cl) Pkg: mscred Bin: mscbin$>"
return pyraf.iraf.getTask(self.name)
# this is only a safe assumption to make in a PSET
else:
return pyraf.iraf.getTask(self.value)
else:
return pyraf.iraf.getTask(self.name)
# -----------------------------------------------------
......@@ -865,18 +879,20 @@ class IrafParList(taskpars.TaskPars):
fullkw = {}
dupl_pset_pars = []
for key in kw.keys():
# recall, kw is just simple { namestr: valstr, ... }
try:
# find par obj for this key
# (read docs for getParObjects - note the 's')
results_dict = self.getParObjects(key)
# results_dict is of form: { psetname : <IrafPar instance> }
# where results_dict may be (and most often is) empty string ''.
# if no KeyError, then there exists a top-level entry ('')
if '' not in results_dict:
raise RuntimeError('No top-level match; expected KeyError')
# assume results_dict[''].name.startswith(key) or .name==key
# recall that key might be shortened version of par's .name
param = (results_dict[''].name, '')
param = (results_dict[''].name, '') # this means (paramname, [unused])
results_dict.pop('')
# if there are others, then they are pars with the same name
......@@ -896,14 +912,22 @@ class IrafParList(taskpars.TaskPars):
raise e
# recall that key[:i] might be shortened version of par's .name
param = (self.getParObject(key[:i]).name, key[i+1:])
# here param is (pset name, par name)
if param in fullkw:
pname = param[0]
if param[1]: pname = '.'.join(param)
msg_full_pname = param[0]
if param[1]: msg_full_pname = '.'.join(param)
# at this point, msg_full_pname is fully qualified
raise SyntaxError("Multiple values given for parameter " +
pname + " in task " + self.__name)
msg_full_pname + " in task " + self.__name)
# Add it
fullkw[param] = kw[key]
# At this point, an example of fullkw might be:
# {('extname', ''): 'mef', ('long', ''): no, ('ccdtype', ''): ''}
# NOTE that the keys to this dict are EITHER in the form
# (top level par name, '') -OR- (pset name, par name)
# CDS June2014 - this is ugly - love to change this soon...
# Now add any duplicated pars that were found, both up at top level and
# down inside a PSET (saved as dupl_pset_pars list). The top level
# version has already been added to fullkw, so we add the PSET version.
......@@ -926,10 +950,23 @@ class IrafParList(taskpars.TaskPars):
# executed if we run out of non-hidden parameters
raise SyntaxError("Too many positional parameters for task " +
self.__name)
# at this point, ipar is set to index of next found non-hidden
# par in self.__pars
param = (self.__pars[ipar].name, '')
if param in fullkw:
raise SyntaxError("Multiple values given for parameter " +
param[0] + " in task " + self.__name)
# uh-oh, it was already in our fullkw list, but now we got a
# positional value for it (occurs in _ccdtool; help call #5901)
msg_full_pname = param[0]
if param[1]: msg_full_pname = '.'.join(param)
msg_val_from_kw = fullkw[param]
msg_val_from_pos = value
# let's say we only care if the 2 values are, in fact, different
if msg_val_from_kw != msg_val_from_pos:
raise SyntaxError('Both a positional value ("'+str(msg_val_from_pos)+ \
'") and a keyword value ("'+str(msg_val_from_kw)+ \
'") were given for parameter "'+msg_full_pname+ \
'" in task "'+self.__name+'"')
# else:, we'll now just overwite the old value with the same new value
fullkw[param] = value
ipar = ipar+1
......
"""module iraftask.py -- defines IrafTask and IrafPkg classes
$Id: iraftask.py 1935 2013-02-26 16:41:36Z sontag $
$Id: iraftask.py 2247 2014-09-25 19:45:34Z sontag $
R. White, 2000 June 26
......@@ -601,7 +601,7 @@ class IrafTask(irafglobals.IrafTask, taskpars.TaskPars):
try:
if paramdict._has(paramname,exact=exact):
return self._getParFromDict(paramdict, paramname, pindex,
field, native, mode=mode, prompt=prompt)
field, native, mode=mode, prompt=prompt)
except minmatch.AmbiguousKeyError, e:
# re-raise the error with a bit more info
raise IrafError("Cannot get parameter `%s'\n%s" %
......@@ -902,7 +902,7 @@ class IrafTask(irafglobals.IrafTask, taskpars.TaskPars):
if pmode == "a":
pmode = mode or self.getMode()
v = par.get(index=pindex,field=field,
native=native,mode=pmode,prompt=prompt)
native=native,mode=pmode,prompt=prompt)
if isinstance(v,str) and v[:1] == ")":
# parameter indirection: call getParam recursively
......@@ -1561,10 +1561,10 @@ class IrafPkg(IrafCLTask, irafglobals.IrafPkg):
def unlearn(self):
"""Resets parameters for all tasks in the package to their default values"""
# If package isn't loaded, just unlearn the top-level package parameters
if not self._loaded:
IrafCLTask.unlearn(self)
else:
# If package isn't loaded, just unlearn the top-level package parameters,
# otherwise unlearn top-level ones AND all sub tasks.
IrafCLTask.unlearn(self)
if self._loaded:
# Loop over all tasks in the package
for task in self._tasks.keys():
pyraf.iraf.getTask(task).unlearn()
......
......@@ -20,7 +20,7 @@ Provides this functionality:
Uses standard code module plus some ideas from cmd.py module
(and of course Perry's Monty design.)
$Id: pycmdline.py 1771 2012-06-08 22:57:48Z sontag $
$Id: pycmdline.py 2176 2014-04-30 14:00:08Z sontag $
R. White, 2000 February 20
"""
......@@ -94,6 +94,7 @@ class CmdConsole(code.InteractiveConsole):
prompt = self.ps2
else:
prompt = self.ps1
# !!! prompt = 'curpkg > '
# reset the focus to terminal if necessary
wutil.focusController.resetFocusHistory()
line = self.raw_input(prompt)
......
......@@ -7,11 +7,11 @@ __all__ = ['__version__', '__vdate__', '__svn_revision__', '__svn_full_info__',
import datetime
__version__ = '2.1.6'
__version__ = '2.1.7'
__vdate__ = 'unspecified'
__svn_revision__ = "2135"
__svn_revision__ = "2256"
__svn_full_info__ = 'unknown'
__setup_datetime__ = datetime.datetime(2014, 1, 28, 23, 55, 42, 271373)
__setup_datetime__ = datetime.datetime(2014, 10, 16, 10, 57, 20, 628430)
# what version of stsci.distutils created this version.py
stsci_distutils_version = '0.3.7'
......@@ -70,7 +70,7 @@ if '.dev' in __version__:
if pipe.returncode == 0:
stdout = stdout.decode('latin1').strip()
if stdout and stdout[0] in string.digits:
__svn_revision__ = "2135"
__svn_revision__ = "2256"
except OSError:
pass
......
......@@ -7,11 +7,11 @@ __all__ = ['__version__', '__vdate__', '__svn_revision__', '__svn_full_info__',
import datetime
__version__ = '2.1.6'
__version__ = '2.1.7'
__vdate__ = 'unspecified'
__svn_revision__ = 'Unable to determine SVN revision'
__svn_full_info__ = 'unknown'
__setup_datetime__ = datetime.datetime(2014, 1, 28, 23, 55, 36, 61914)
__setup_datetime__ = datetime.datetime(2014, 10, 16, 10, 57, 13, 301495)
# what version of stsci.distutils created this version.py
stsci_distutils_version = '0.3.7'
......
......@@ -7,11 +7,11 @@ __all__ = ['__version__', '__vdate__', '__svn_revision__', '__svn_full_info__',
import datetime
__version__ = '2.1.6'
__version__ = '2.1.7'
__vdate__ = 'unspecified'
__svn_revision__ = 'Unable to determine SVN revision'
__svn_full_info__ = 'unknown'
__setup_datetime__ = datetime.datetime(2014, 1, 28, 23, 55, 36, 61914)
__setup_datetime__ = datetime.datetime(2014, 10, 16, 10, 57, 13, 301495)
# what version of stsci.distutils created this version.py
stsci_distutils_version = '0.3.7'
......
No preview for this file type
......@@ -4,5 +4,4 @@ python:
- "3.2"
- "2.7"
- "2.6"
- "2.5"
script: python setup.py test
Introduction
==============
.. image:: https://travis-ci.org/iguananaut/d2to1.png?branch=master
.. image:: https://travis-ci.org/embray/d2to1.png?branch=master
:alt: travis build status
:target: https://travis-ci.org/iguananaut/d2to1
:target: https://travis-ci.org/embray/d2to1
d2to1 (the 'd' is for 'distutils') allows using distutils2-like setup.cfg files
for a package's metadata with a distribute/setuptools setup.py script. It
......
[metadata]
name = d2to1
version = 0.2.12.dev
version = 0.2.13.dev
author = Erik M. Bray
author-email = embray@stsci.edu
summary = Allows using distutils2-like setup.cfg files for a package's metadata with a distribute/setuptools setup.py
description-file =
README.rst
CHANGES.rst
description-file =
README.rst
CHANGES.rst
home-page = http://pypi.python.org/pypi/d2to1
requires-dist = setuptools
classifier =
Development Status :: 5 - Production/Stable
Development Status :: 5 - Production/Stable
Environment :: Plugins
Framework :: Setuptools Plugin
Intended Audience :: Developers
......@@ -23,13 +23,13 @@ classifier =
Topic :: System :: Archiving :: Packaging
[files]
packages =
d2to1
d2to1.extern
extra_files =
CHANGES.rst
LICENSE
ez_setup.py
packages =
d2to1
d2to1.extern
extra_files =
CHANGES.rst
LICENSE
ez_setup.py
[backwards_compat]
zip-safe = False
......@@ -47,8 +47,6 @@ zest.releaser.postreleaser.middle =
test-suite = nose.collector
[zest.releaser]
# These zest.releaser hooks are not installed as entry points as they are only
# used for d2to1 itself--the ones that are installed as entry points are useful
# to any project that uses d2to1
releaser.middle = d2to1.zestreleaser.releaser_middle
postreleaser.before = d2to1.zestreleaser.postreleaser_before
from __future__ import division # confidence high
import sys
PY3K = sys.version_info[0] > 2
# Don't copy this as an example - use any other package is stsci_python,
# such as sample_package
pkg = [ 'stsci', 'stsci.tools', 'stsci.tools.tests' ]
setupargs = {
'version' : '3.1',
'description' : "General Use Python Tools",
'author' : "Warren Hack, Christopher Hanley",
'author_email' : "help@stsci.edu",
'license' : "http://www.stsci.edu/resources/software_hardware/pyraf/LICENSE",
'platforms' : ["Linux","Solaris","Mac OS X","Win"],
'scripts' : ['scripts/convertwaiveredfits','scripts/stscidocs'] ,
'package_dir' : { 'stsci' : 'old_stsci', 'stsci.tools' : 'lib/stsci/tools', 'stsci.tools.tests' : 'lib/stsci/tools/tests' },
'data_files' : [ ( 'stsci/tools/tests', [ 'lib/stsci/tools/tests/*.fits' ] ) ],
}
if PY3K:
# TODO: in PY3K we get: "error: can't copy 'lib/stsci/tools/tests/*.fits' "
setupargs['data_files'] = [ ( 'stsci/tools/tests', [] ) ]
This diff is collapsed.
This diff is collapsed.
......@@ -10,7 +10,9 @@ from __future__ import division # confidence high
import fileutil as fu
import wcsutil
import pyfits
#import pyfits
import astropy
from astropy.io import fits# as pyfits
import numpy as N
import os.path, time
......@@ -59,7 +61,7 @@ def readASNTable(fname, output=None, prodonly=False):
"""
try:
f = pyfits.open(fu.osfn(fname))
f = fits.open(fu.osfn(fname))
except:
raise IOError, "Can't open file %s\n" % fname
......@@ -372,7 +374,7 @@ class ASNTable(dict):
warningmsg += "# is being replaced. #\n"
warningmsg += "# #\n"
warningmsg += "#########################################\n\n"
fasn = pyfits.HDUList()
fasn = fits.HDUList()
# Compute maximum length of MEMNAME for table column definition
_maxlen = 0
......@@ -402,17 +404,17 @@ class ASNTable(dict):
scl = [self['members'][l]['scale'] for l in self['order']]
scl.append(1.0)
memname = pyfits.Column(name='MEMNAME',format=namelen_str,array=N.char.array(mname))
memtype = pyfits.Column(name='MEMTYPE',format='14A',array=N.char.array(mtype))
memprsn = pyfits.Column(name='MEMPRSNT', format='L', array=N.array(mprsn).astype(N.uint8))
xoffset = pyfits.Column(name='XOFFSET', format='E', array=N.array(xoff))
yoffset = pyfits.Column(name='YOFFSET', format='E', array=N.array(yoff))
xdelta = pyfits.Column(name='XDELTA', format='E', array=N.array(xsh))
ydelta = pyfits.Column(name='YDELTA', format='E', array=N.array(ysh))
rotation = pyfits.Column(name='ROTATION', format='E', array=N.array(rot))
scale = pyfits.Column(name='SCALE', format='E', array=N.array(scl))
hdu = pyfits.new_table([memname,memtype,memprsn,xoffset,yoffset,xdelta,ydelta,rotation,scale],nrows=len(mname))
memname = fits.Column(name='MEMNAME',format=namelen_str,array=N.char.array(mname))
memtype = fits.Column(name='MEMTYPE',format='14A',array=N.char.array(mtype))
memprsn = fits.Column(name='MEMPRSNT', format='L', array=N.array(mprsn).astype(N.uint8))
xoffset = fits.Column(name='XOFFSET', format='E', array=N.array(xoff))
yoffset = fits.Column(name='YOFFSET', format='E', array=N.array(yoff))
xdelta = fits.Column(name='XDELTA', format='E', array=N.array(xsh))
ydelta = fits.Column(name='YDELTA', format='E', array=N.array(ysh))
rotation = fits.Column(name='ROTATION', format='E', array=N.array(rot))
scale = fits.Column(name='SCALE', format='E', array=N.array(scl))
hdu = fits.new_table([memname,memtype,memprsn,xoffset,yoffset,xdelta,ydelta,rotation,scale],nrows=len(mname))
fasn.append(hdu)
fasn.writeto(outfile, clobber=True)
fasn.close()
......@@ -421,43 +423,43 @@ class ASNTable(dict):
if refimg != None:
whdu = wcsutil.WCSObject(refimg)
whdu.createReferenceWCS(outfile,overwrite=False)
ftab = pyfits.open(outfile)
ftab['primary'].header.update('refimage', outfile+"[wcs]")
ftab = fits.open(outfile)
ftab['primary'].header['refimage'] = outfile+"[wcs]"
ftab.close()
del whdu
def buildPrimary(self, fasn, output=None):
_prihdr = pyfits.Header([pyfits.Card('SIMPLE', pyfits.TRUE,'Fits standard'),
pyfits.Card('BITPIX ', 16 ,' Bits per pixel'),
pyfits.Card('NAXIS ', 0 ,' Number of axes'),
pyfits.Card('ORIGIN ', 'NOAO-IRAF FITS Image Kernel July 1999' ,'FITS file originator'),
pyfits.Card('IRAF-TLM', '18:26:13 (27/03/2000)' ,' Time of last modification'),
pyfits.Card('EXTEND ',pyfits.TRUE ,' File may contain standard extensions'),
pyfits.Card('NEXTEND ', 1 ,' Number of standard extensions'),
pyfits.Card('DATE ', '2001-02-14T20:07:57',' date this file was written (yyyy-mm-dd)'),
pyfits.Card('FILENAME', 'hr_box_asn.fits' ,' name of file'),
pyfits.Card('FILETYPE', 'ASN_TABLE' ,' type of data found in data file'),
pyfits.Card('TELESCOP', 'HST' ,' telescope used to acquire data'),
pyfits.Card('INSTRUME', 'ACS ' ,' identifier for instrument used to acquire data'),
pyfits.Card('EQUINOX ', 2000.0 ,' equinox of celestial coord. system'),
pyfits.Card('ROOTNAME', 'hr_box ' ,' rootname of the observation set'),
pyfits.Card('PRIMESI ', 'ACS ' ,' instrument designated as prime'),
pyfits.Card('TARGNAME', 'SIM-DITHER' ,'proposer\'s target name'),
pyfits.Card('RA_TARG ', 0. ,' right ascension of the target (deg) (J2000)'),
pyfits.Card('DEC_TARG', 0. ,' declination of the target (deg) (J2000)'),
pyfits.Card('DETECTOR', 'HRC ' ,' detector in use: WFC, HRC, or SBC'),
pyfits.Card('ASN_ID ', 'hr_box ' ,' unique identifier assigned to association'),
pyfits.Card('ASN_TAB ', 'hr_box_asn.fits' ,' name of the association table')])
_prihdr = fits.Header([fits.Card('SIMPLE', True, 'Fits standard'),
fits.Card('BITPIX ', 16 ,' Bits per pixel'),
fits.Card('NAXIS ', 0 ,' Number of axes'),
fits.Card('ORIGIN ', 'NOAO-IRAF FITS Image Kernel July 1999' ,'FITS file originator'),
fits.Card('IRAF-TLM', '18:26:13 (27/03/2000)' ,' Time of last modification'),