diff options
author | embray <embray@stsci.edu> | 2011-11-08 10:47:46 -0500 |
---|---|---|
committer | embray <embray@stsci.edu> | 2011-11-08 10:47:46 -0500 |
commit | 8e1d663c91b501c8e71eeba430de049a299f937c (patch) | |
tree | 16b746c35c1a20b1157ced03d8a282a840858b42 /lib/stwcs/updatewcs/utils.py | |
parent | 40377535c7738b8022fda859228520918a99b0ff (diff) | |
download | stwcs_hcf-8e1d663c91b501c8e71eeba430de049a299f937c.tar.gz |
Updates the HeaderletHDU class to use PyFITS's new FitsHDU class as its base.
This works mostly the same way as the old implementation. The differences are
as follows:
* The headerlet data is no longer needlessly encapsulated in a tar file;
instead it's included directly as an embedded FITS file which should work
fine for most FITS readers (though most won't know what to do with it, and
will just treat it as raw data).
* A few new keywords are included in the HeaderletHDU's header--these keywords
(the XINDn keywords) give the offsets of each HDU embedded in the
HeaderletHDU. Howver, this information is not currently used.
* In addition to the `.headerlet` property the `.hdulist` property is
provided, which returns the HeaderletHDU's contents as a normal `HDUList`
object instead of a `Headerlet` object.
git-svn-id: http://svn.stsci.edu/svn/ssb/stsci_python/stsci_python/trunk/stwcs@13979 fe389314-cf27-0410-b35b-8c050e845b92
Diffstat (limited to 'lib/stwcs/updatewcs/utils.py')
-rw-r--r-- | lib/stwcs/updatewcs/utils.py | 32 |
1 files changed, 16 insertions, 16 deletions
diff --git a/lib/stwcs/updatewcs/utils.py b/lib/stwcs/updatewcs/utils.py index 0e7d77b..460ddb3 100644 --- a/lib/stwcs/updatewcs/utils.py +++ b/lib/stwcs/updatewcs/utils.py @@ -4,19 +4,19 @@ import os from stsci.tools import fileutil def diff_angles(a,b): - """ + """ Perform angle subtraction a-b taking into account - small-angle differences across 360degree line. + small-angle differences across 360degree line. """ - + diff = a - b - + if diff > 180.0: diff -= 360.0 if diff < -180.0: diff += 360.0 - + return diff def getBinning(fobj, extver=1): @@ -34,13 +34,13 @@ def extract_rootname(kwvalue,suffix=""): If a non-valid value (any of ['','N/A','NONE','INDEF',None]) is input, simply return a string value of 'NONE' - + This function will also replace any 'suffix' specified with a blank. """ # check to see whether a valid kwvalue has been provided as input if kwvalue.strip() in ['','N/A','NONE','INDEF',None]: return 'NONE' # no valid value, so return 'NONE' - + # for a valid kwvalue, parse out the rootname # strip off any environment variable from input filename, if any are given if '$' in kwvalue: @@ -58,11 +58,11 @@ def extract_rootname(kwvalue,suffix=""): return rootname.strip() def construct_distname(fobj,wcsobj): - """ - This function constructs the value for the keyword 'DISTNAME'. + """ + This function constructs the value for the keyword 'DISTNAME'. It relies on the reference files specified by the keywords 'IDCTAB', - 'NPOLFILE', and 'D2IMFILE'. - + 'NPOLFILE', and 'D2IMFILE'. + The final constructed value will be of the form: <idctab rootname>-<npolfile rootname>-<d2imfile rootname> and have a value of 'NONE' if no reference files are specified. @@ -71,22 +71,22 @@ def construct_distname(fobj,wcsobj): suffix='_idc') if idcname is None and wcsobj.sip is not None: idcname = 'UNKNOWN' - + npolname = build_npolname(fobj) if npolname is None and wcsobj.cpdis1 is not None: npolname = 'UNKNOWN' - + d2imname = build_d2imname(fobj) if d2imname is None and wcsobj.det2im is not None: d2imname = 'UNKNOWN' - + sipname = build_sipname(fobj) distname = build_distname(sipname,npolname,d2imname) return {'DISTNAME':distname,'SIPNAME':sipname} def build_distname(sipname,npolname,d2imname): - """ + """ Core function to build DISTNAME keyword value without the HSTWCS input. """ @@ -137,4 +137,4 @@ def build_d2imname(fobj): d2imfile = 'UNKNOWN' else: d2imfile = 'NOMODEL' - return d2imfile
\ No newline at end of file + return d2imfile |