summaryrefslogtreecommitdiff
path: root/lib/stwcs/gui
diff options
context:
space:
mode:
authorNadia Dencheva <nadia.astropy@gmail.com>2016-08-07 12:23:24 -0400
committerGitHub <noreply@github.com>2016-08-07 12:23:24 -0400
commita2e16e39b0eb8ac0251a6473c60fee0d437c3a5f (patch)
tree7b6771e9c1974852eb8a283507677651078ce32a /lib/stwcs/gui
parent86d1bc5a77491770d45b86e5cf18b79ded68fb9b (diff)
parent2dc0676bc00f66a87737e78484876051633b731a (diff)
downloadstwcs_hcf-a2e16e39b0eb8ac0251a6473c60fee0d437c3a5f.tar.gz
Merge pull request #9 from nden/refactor-and-tests
restructure and add stwcs tests
Diffstat (limited to 'lib/stwcs/gui')
-rw-r--r--lib/stwcs/gui/__init__.py19
-rw-r--r--lib/stwcs/gui/apply_headerlet.help38
-rw-r--r--lib/stwcs/gui/apply_headerlet.py54
-rw-r--r--lib/stwcs/gui/archive_headerlet.py69
-rw-r--r--lib/stwcs/gui/attach_headerlet.py36
-rw-r--r--lib/stwcs/gui/delete_headerlet.py52
-rw-r--r--lib/stwcs/gui/extract_headerlet.py58
-rw-r--r--lib/stwcs/gui/headerlet_summary.py47
-rw-r--r--lib/stwcs/gui/pars/apply_headerlet.cfg10
-rw-r--r--lib/stwcs/gui/pars/apply_headerlet.cfgspc12
-rw-r--r--lib/stwcs/gui/pars/archive_headerlet.cfg14
-rw-r--r--lib/stwcs/gui/pars/archive_headerlet.cfgspc14
-rw-r--r--lib/stwcs/gui/pars/attach_headerlet.cfg4
-rw-r--r--lib/stwcs/gui/pars/attach_headerlet.cfgspc4
-rw-r--r--lib/stwcs/gui/pars/delete_headerlet.cfg6
-rw-r--r--lib/stwcs/gui/pars/delete_headerlet.cfgspc6
-rw-r--r--lib/stwcs/gui/pars/extract_headerlet.cfg7
-rw-r--r--lib/stwcs/gui/pars/extract_headerlet.cfgspc7
-rw-r--r--lib/stwcs/gui/pars/headerlet_summary.cfg8
-rw-r--r--lib/stwcs/gui/pars/headerlet_summary.cfgspc8
-rw-r--r--lib/stwcs/gui/pars/restore_headerlet.cfg10
-rw-r--r--lib/stwcs/gui/pars/restore_headerlet.cfgspc12
-rw-r--r--lib/stwcs/gui/pars/updatewcs.cfg8
-rw-r--r--lib/stwcs/gui/pars/updatewcs.cfgspc8
-rw-r--r--lib/stwcs/gui/pars/write_headerlet.cfg18
-rw-r--r--lib/stwcs/gui/pars/write_headerlet.cfgspc18
-rw-r--r--lib/stwcs/gui/restore_headerlet.help43
-rw-r--r--lib/stwcs/gui/restore_headerlet.py48
-rw-r--r--lib/stwcs/gui/updatewcs.py90
-rw-r--r--lib/stwcs/gui/write_headerlet.py80
30 files changed, 0 insertions, 808 deletions
diff --git a/lib/stwcs/gui/__init__.py b/lib/stwcs/gui/__init__.py
deleted file mode 100644
index cd21bf6..0000000
--- a/lib/stwcs/gui/__init__.py
+++ /dev/null
@@ -1,19 +0,0 @@
-""" STWCS.GUI
-
-This package defines the TEAL interfaces for public, file-based operations
-provided by the STWCS package.
-
-"""
-from __future__ import absolute_import # confidence high
-__docformat__ = 'restructuredtext'
-
-# import modules which define the TEAL interfaces
-from . import write_headerlet
-from . import extract_headerlet
-from . import attach_headerlet
-from . import delete_headerlet
-from . import headerlet_summary
-from . import archive_headerlet
-from . import restore_headerlet
-from . import apply_headerlet
-from . import updatewcs
diff --git a/lib/stwcs/gui/apply_headerlet.help b/lib/stwcs/gui/apply_headerlet.help
deleted file mode 100644
index f701b52..0000000
--- a/lib/stwcs/gui/apply_headerlet.help
+++ /dev/null
@@ -1,38 +0,0 @@
-This task applies a headerlet to a science observation to update either the
-PRIMARY WCS or to add it as an alternate WCS.
-
-filename = ""
-hdrlet = ""
-attach = True
-primary = True
-archive = True
-force = False
-wcskey = ""
-wcsname = ""
-verbose = False
-
-Parameters
-----------
-filename: string, @-file or wild-card name
- File name(s) of science observation whose WCS solution will be updated
-hdrlet: string, @-file or wild-card name
- Headerlet file(s), must match input filenames 1-to-1
-attach: boolean
- True (default): append headerlet to FITS file as a new extension.
-primary: boolean
- Specify whether or not to replace PRIMARY WCS with WCS from headerlet.
-archive: boolean
- True (default): before updating, create a headerlet with the
- WCS old solution.
-force: boolean
- If True, this will cause the headerlet to replace the current PRIMARY
- WCS even if it has a different distortion model. [Default: False]
-wcskey: string
- Key value (A-Z, except O) for this alternate WCS
- If None, the next available key will be used
-wcsname: string
- Name to be assigned to this alternate WCS
- WCSNAME is a required keyword in a Headerlet but this allows the
- user to change it as desired.
-logging: boolean
- enable file logging
diff --git a/lib/stwcs/gui/apply_headerlet.py b/lib/stwcs/gui/apply_headerlet.py
deleted file mode 100644
index d517e9f..0000000
--- a/lib/stwcs/gui/apply_headerlet.py
+++ /dev/null
@@ -1,54 +0,0 @@
-import os
-from stsci.tools import teal, parseinput
-
-import stwcs
-from stwcs.wcsutil import headerlet
-
-__taskname__ = __name__.split('.')[-1] # needed for help string
-__package__ = headerlet.__name__
-__version__ = stwcs.__version__
-#
-#### Interfaces used by TEAL
-#
-def getHelpAsString(docstring=False):
- """
- return useful help from a file in the script directory called __taskname__.help
- """
- install_dir = os.path.dirname(__file__)
- htmlfile = os.path.join(install_dir,'htmlhelp',__taskname__+'.html')
- helpfile = os.path.join(install_dir,__taskname__+'.help')
- if docstring or (not docstring and not os.path.exists(htmlfile)):
- helpString = __taskname__+' Version '+__version__+'\n\n'
- if os.path.exists(helpfile):
- helpString += teal.getHelpFileAsString(__taskname__,__file__)
- else:
- helpString = 'file://'+htmlfile
-
- return helpString
-
-def run(configObj=None):
-
- # start by interpreting filename and hdrlet inputs
- filename = parseinput.parseinput(configObj['filename'])[0]
- hdrlet = parseinput.parseinput(configObj['hdrlet'])[0]
-
- if configObj['primary']:
- # Call function with properly interpreted input parameters
- # Syntax: apply_headerlet_as_primary(filename, hdrlet, attach=True,
- # archive=True, force=False, verbose=False)
- headerlet.apply_headerlet_as_primary(filename,
- hdrlet,attach=configObj['attach'],
- archive=configObj['archive'],force=configObj['force'],
- logging=configObj['logging'])
- else:
- wcsname = configObj['wcsname']
- if wcsname in ['',' ','INDEF']: wcsname = None
- wcskey = configObj['wcskey']
- if wcskey == '': wcskey = None
- # Call function with properly interpreted input parameters
- # apply_headerlet_as_alternate(filename, hdrlet, attach=True,
- # wcskey=None, wcsname=None, verbose=False)
- headerlet.apply_headerlet_as_alternate(filename,
- hdrlet, attach=configObj['attach'],
- wcsname=wcsname, wcskey=wcskey,
- logging=configObj['logging'])
diff --git a/lib/stwcs/gui/archive_headerlet.py b/lib/stwcs/gui/archive_headerlet.py
deleted file mode 100644
index 7ad3d4d..0000000
--- a/lib/stwcs/gui/archive_headerlet.py
+++ /dev/null
@@ -1,69 +0,0 @@
-from __future__ import print_function
-import os
-
-from astropy.io import fits
-from stsci.tools import teal
-
-import stwcs
-from stwcs.wcsutil import headerlet
-
-__taskname__ = __name__.split('.')[-1] # needed for help string
-__package__ = headerlet.__name__
-__version__ = stwcs.__version__
-#
-#### Interfaces used by TEAL
-#
-def getHelpAsString(docstring=False):
- """
- return useful help from a file in the script directory called __taskname__.help
- """
- install_dir = os.path.dirname(__file__)
- htmlfile = os.path.join(install_dir,'htmlhelp',__taskname__+'.html')
- helpfile = os.path.join(install_dir,__taskname__+'.help')
- if docstring or (not docstring and not os.path.exists(htmlfile)):
- helpString = __taskname__+' Version '+__version__+'\n\n'
- if os.path.exists(helpfile):
- helpString += teal.getHelpFileAsString(__taskname__,__file__)
- else:
- helpString += headerlet.archive_as_headerlet.__doc__
-
- else:
- helpString = 'file://'+htmlfile
-
- return helpString
-
-def run(configObj=None):
-
- if configObj['hdrname'] in ['',' ','INDEF']:
- print('='*60)
- print('ERROR:')
- print(' No valid "hdrname" parameter value provided!')
- print(' Please restart this task and provide a value for this parameter.')
- print('='*60)
- return
-
- str_kw = ['wcsname','destim','sipname','npolfile','d2imfile',
- 'descrip','history','author']
-
- # create dictionary of remaining parameters, deleting extraneous ones
- # such as those above
- cdict = configObj.dict()
- # remove any rules defined for the TEAL interface
- if "_RULES_" in cdict: del cdict['_RULES_']
- del cdict['_task_name_']
- del cdict['filename']
- del cdict['hdrname']
-
- # Convert blank string input as None
- for kw in str_kw:
- if cdict[kw] == '': cdict[kw] = None
- if cdict['wcskey'].lower() == 'primary': cdict['wcskey'] = ' '
-
- # Call function with properly interpreted input parameters
- # Syntax: archive_as_headerlet(filename, sciext='SCI', wcsname=None, wcskey=None,
- # hdrname=None, destim=None,
- # sipname=None, npolfile=None, d2imfile=None,
- # author=None, descrip=None, history=None,
- # hdrlet=None, clobber=False)
- headerlet.archive_as_headerlet(configObj['filename'], configObj['hdrname'],
- **cdict)
diff --git a/lib/stwcs/gui/attach_headerlet.py b/lib/stwcs/gui/attach_headerlet.py
deleted file mode 100644
index 873c549..0000000
--- a/lib/stwcs/gui/attach_headerlet.py
+++ /dev/null
@@ -1,36 +0,0 @@
-import os
-
-from stsci.tools import teal
-
-import stwcs
-from stwcs.wcsutil import headerlet
-
-__taskname__ = __name__.split('.')[-1] # needed for help string
-__package__ = headerlet.__name__
-__version__ = stwcs.__version__
-#
-#### Interfaces used by TEAL
-#
-def getHelpAsString(docstring=False):
- """
- return useful help from a file in the script directory called __taskname__.help
- """
- install_dir = os.path.dirname(__file__)
- htmlfile = os.path.join(install_dir,'htmlhelp',__taskname__+'.html')
- helpfile = os.path.join(install_dir,__taskname__+'.help')
- if docstring or (not docstring and not os.path.exists(htmlfile)):
- helpString = __taskname__+' Version '+__version__+'\n\n'
- if os.path.exists(helpfile):
- helpString += teal.getHelpFileAsString(__taskname__,__file__)
- else:
- helpString += eval('.'.join([__package__,__taskname__,'__doc__']))
- else:
- helpString = 'file://'+htmlfile
-
- return helpString
-
-def run(configObj=None):
-
- headerlet.attach_headerlet(configObj['filename'],configObj['hdrlet'],
- configObj['logging'])
-
diff --git a/lib/stwcs/gui/delete_headerlet.py b/lib/stwcs/gui/delete_headerlet.py
deleted file mode 100644
index b3df5a7..0000000
--- a/lib/stwcs/gui/delete_headerlet.py
+++ /dev/null
@@ -1,52 +0,0 @@
-from __future__ import print_function
-import os
-
-from stsci.tools import teal
-from stsci.tools import parseinput
-
-import stwcs
-from stwcs.wcsutil import headerlet
-
-__taskname__ = __name__.split('.')[-1] # needed for help string
-__package__ = headerlet.__name__
-__version__ = stwcs.__version__
-#
-#### Interfaces used by TEAL
-#
-def getHelpAsString(docstring=False):
- """
- return useful help from a file in the script directory called __taskname__.help
- """
- install_dir = os.path.dirname(__file__)
- htmlfile = os.path.join(install_dir,'htmlhelp',__taskname__+'.html')
- helpfile = os.path.join(install_dir,__taskname__+'.help')
- if docstring or (not docstring and not os.path.exists(htmlfile)):
- helpString = __taskname__+' Version '+__version__+'\n\n'
- if os.path.exists(helpfile):
- helpString += teal.getHelpFileAsString(__taskname__,__file__)
- else:
- helpString += eval('.'.join([__package__,__taskname__,'__doc__']))
- else:
- helpString = 'file://'+htmlfile
-
- return helpString
-
-def run(configObj=None):
-
- if configObj['hdrname'] == '' and configObj['hdrext'] is None and \
- configObj['distname'] == '':
- print('='*60)
- print('ERROR:')
- print(' No valid "hdrname", "hdrext" or "distname" parameter value provided!')
- print(' Please restart this task and provide a value for one of these parameters.')
- print('='*60)
- return
- filename = parseinput.parseinput(configObj['filename'])[0]
- # Call function with properly interpreted input parameters
- # Syntax: delete_headerlet(filename, hdrname=None, hdrext=None, distname=None)
- headerlet.delete_headerlet(filename,
- hdrname = configObj['hdrname'],
- hdrext = configObj['hdrext'],
- distname = configObj['distname'],
- logging = configObj['logging'])
-
diff --git a/lib/stwcs/gui/extract_headerlet.py b/lib/stwcs/gui/extract_headerlet.py
deleted file mode 100644
index 02ecd7a..0000000
--- a/lib/stwcs/gui/extract_headerlet.py
+++ /dev/null
@@ -1,58 +0,0 @@
-from __future__ import print_function
-import os
-
-from stsci.tools import teal
-
-import stwcs
-from stwcs.wcsutil import headerlet
-
-__taskname__ = __name__.split('.')[-1] # needed for help string
-__package__ = headerlet.__name__
-__version__ = stwcs.__version__
-#
-#### Interfaces used by TEAL
-#
-def getHelpAsString(docstring=False):
- """
- return useful help from a file in the script directory called __taskname__.help
- """
- install_dir = os.path.dirname(__file__)
- htmlfile = os.path.join(install_dir,'htmlhelp',__taskname__+'.html')
- helpfile = os.path.join(install_dir,__taskname__+'.help')
- if docstring or (not docstring and not os.path.exists(htmlfile)):
- helpString = __taskname__+' Version '+__version__+'\n\n'
- if os.path.exists(helpfile):
- helpString += teal.getHelpFileAsString(__taskname__,__file__)
- else:
- helpString += eval('.'.join([__package__,__taskname__,'__doc__']))
-
- else:
- helpString = 'file://'+htmlfile
-
- return helpString
-
-def run(configObj=None):
-
- if configObj['output'] in ['',' ',None]:
- print('='*60)
- print('ERROR:')
- print(' No valid "output" parameter value provided!')
- print(' Please restart this task and provide a value for this parameter.')
- print('='*60)
- return
-
- # create dictionary of remaining parameters, deleting extraneous ones
- # such as those above
- cdict = configObj.dict()
- # remove any rules defined for the TEAL interface
- if "_RULES_" in cdict: del cdict['_RULES_']
- del cdict['_task_name_']
- del cdict['filename']
- del cdict['output']
-
- # Call function with properly interpreted input parameters
- # Syntax: extract_headerlet(filename, output, extnum=None, hdrname=None,
- # clobber=False, verbose=100)
- headerlet.extract_headerlet(configObj['filename'], configObj['output'],
- **cdict)
-
diff --git a/lib/stwcs/gui/headerlet_summary.py b/lib/stwcs/gui/headerlet_summary.py
deleted file mode 100644
index 82a3e0c..0000000
--- a/lib/stwcs/gui/headerlet_summary.py
+++ /dev/null
@@ -1,47 +0,0 @@
-import os
-from stsci.tools import teal
-
-import stwcs
-from stwcs.wcsutil import headerlet
-
-__taskname__ = __name__.split('.')[-1] # needed for help string
-__package__ = headerlet.__name__
-__version__ = stwcs.__version__
-#
-#### Interfaces used by TEAL
-#
-def getHelpAsString(docstring=False):
- """
- return useful help from a file in the script directory called __taskname__.help
- """
- install_dir = os.path.dirname(__file__)
- htmlfile = os.path.join(install_dir,'htmlhelp',__taskname__+'.html')
- helpfile = os.path.join(install_dir,__taskname__+'.help')
- if docstring or (not docstring and not os.path.exists(htmlfile)):
- helpString = __taskname__+' Version '+__version__+'\n\n'
- if os.path.exists(helpfile):
- helpString += teal.getHelpFileAsString(__taskname__,__file__)
- else:
- helpString += eval('.'.join([__package__,__taskname__,'__doc__']))
- else:
- helpString = 'file://'+htmlfile
-
- return helpString
-
-def run(configObj=None):
-
- # create dictionary of remaining parameters, deleting extraneous ones
- # such as those above
- cdict = configObj.dict()
- # remove any rules defined for the TEAL interface
- if "_RULES_" in cdict: del cdict['_RULES_']
- del cdict['_task_name_']
- del cdict['filename']
- if headerlet.is_par_blank(cdict['columns']):
- cdict['columns'] = None
- # Call function with properly interpreted input parameters
-
- # Syntax: headerlet_summary(filename,columns=None,pad=2,maxwidth=None,
- # output=None,clobber=True,quiet=False)
- headerlet.headerlet_summary(configObj['filename'],**cdict)
-
diff --git a/lib/stwcs/gui/pars/apply_headerlet.cfg b/lib/stwcs/gui/pars/apply_headerlet.cfg
deleted file mode 100644
index 06d6daf..0000000
--- a/lib/stwcs/gui/pars/apply_headerlet.cfg
+++ /dev/null
@@ -1,10 +0,0 @@
-_task_name_ = apply_headerlet
-filename = ""
-hdrlet = ""
-attach = True
-primary = True
-archive = True
-force = False
-wcskey = ""
-wcsname = ""
-logging = False
diff --git a/lib/stwcs/gui/pars/apply_headerlet.cfgspc b/lib/stwcs/gui/pars/apply_headerlet.cfgspc
deleted file mode 100644
index 648e562..0000000
--- a/lib/stwcs/gui/pars/apply_headerlet.cfgspc
+++ /dev/null
@@ -1,12 +0,0 @@
-_task_name_ = string_kw(default="apply_headerlet")
-filename = string_kw(default="", comment="Input file name")
-hdrlet = string_kw(default="", comment="Headerlet FITS filename")
-attach = boolean_kw(default=True, comment= "Append headerlet to FITS file as new extension?")
-primary = boolean_kw(default=True, triggers="_rule1_", comment="Replace PRIMARY WCS with headerlet WCS?")
-archive = boolean_kw(default=True, active_if="_rule1_", comment="Save PRIMARY WCS as new headerlet extension?")
-force = boolean_kw(default=False, active_if="_rule1_", comment="If distortions do not match, force update anyway?")
-wcskey = option_kw("A","B","C","D","E","F","G","H","I","J","K","L","M","N","P","Q","R","S","T","U","V","W","X","Y","Z","", default="", inactive_if="_rule1_", comment="Apply headerlet as alternate WCS with this letter")
-wcsname = string_kw(default="", inactive_if="_rule1_", comment="Apply headerlet as alternate WCS with this name")
-logging = boolean_kw(default=False, comment= "Enable logging to a file")
-[ _RULES_ ]
-_rule1_ = string_kw(default=True, code='tyfn={"yes":True, "no":False}; OUT = tyfn[VAL]')
diff --git a/lib/stwcs/gui/pars/archive_headerlet.cfg b/lib/stwcs/gui/pars/archive_headerlet.cfg
deleted file mode 100644
index 97cd7ef..0000000
--- a/lib/stwcs/gui/pars/archive_headerlet.cfg
+++ /dev/null
@@ -1,14 +0,0 @@
-_task_name_ = archive_headerlet
-filename = ""
-hdrname = ""
-sciext = "SCI"
-wcsname = ""
-wcskey = "PRIMARY"
-destim = ""
-sipname = ""
-npolfile = ""
-d2imfile = ""
-author = ""
-descrip = ""
-history = ""
-logging = False \ No newline at end of file
diff --git a/lib/stwcs/gui/pars/archive_headerlet.cfgspc b/lib/stwcs/gui/pars/archive_headerlet.cfgspc
deleted file mode 100644
index 03e67f0..0000000
--- a/lib/stwcs/gui/pars/archive_headerlet.cfgspc
+++ /dev/null
@@ -1,14 +0,0 @@
-_task_name_ = string_kw(default="archive_headerlet")
-filename = string_kw(default="", comment="Input file name")
-hdrname = string_kw(default="", comment="Unique name(HDRNAME) for headerlet")
-sciext = string_kw(default="SCI", comment="EXTNAME of extension with WCS")
-wcsname = string_kw(default="", comment="Name of WCS to be archived")
-wcskey = option_kw("A","B","C","D","E","F","G","H","I","J","K","L","M","N","P","Q","R","S","T","U","V","W","X","Y","Z","PRIMARY", default="PRIMARY", comment="Archive the WCS with this letter")
-destim = string_kw(default="", comment="Rootname of image to which this headerlet applies ")
-sipname = string_kw(default="", comment="Name for source of polynomial distortion keywords")
-npolfile = string_kw(default="", comment="Name for source of non-polynomial residuals")
-d2imfile = string_kw(default="", comment="Name for source of detector correction table")
-author = string_kw(default="", comment="Author name for creator of headerlet")
-descrip = string_kw(default="", comment="Short description of headerlet solution")
-history = string_kw(default="", comment="Name of ASCII file containing history for headerlet")
-logging = boolean_kw(default=False, comment= "Enable logging to a file") \ No newline at end of file
diff --git a/lib/stwcs/gui/pars/attach_headerlet.cfg b/lib/stwcs/gui/pars/attach_headerlet.cfg
deleted file mode 100644
index d131a70..0000000
--- a/lib/stwcs/gui/pars/attach_headerlet.cfg
+++ /dev/null
@@ -1,4 +0,0 @@
-_task_name_ = attach_headerlet
-filename = ""
-hdrlet = ""
-logging = False
diff --git a/lib/stwcs/gui/pars/attach_headerlet.cfgspc b/lib/stwcs/gui/pars/attach_headerlet.cfgspc
deleted file mode 100644
index bc91bca..0000000
--- a/lib/stwcs/gui/pars/attach_headerlet.cfgspc
+++ /dev/null
@@ -1,4 +0,0 @@
-_task_name_ = string_kw(default="attach_headerlet")
-filename = string_kw(default="", comment="FITS image file name")
-hdrlet = string_kw(default="", comment="Headerlet FITS filename")
-logging = boolean_kw(default=False, comment= "Enable logging to a file") \ No newline at end of file
diff --git a/lib/stwcs/gui/pars/delete_headerlet.cfg b/lib/stwcs/gui/pars/delete_headerlet.cfg
deleted file mode 100644
index d156937..0000000
--- a/lib/stwcs/gui/pars/delete_headerlet.cfg
+++ /dev/null
@@ -1,6 +0,0 @@
-_task_name_ = delete_headerlet
-filename = ""
-hdrname = ""
-hdrext = None
-distname = ""
-logging = False \ No newline at end of file
diff --git a/lib/stwcs/gui/pars/delete_headerlet.cfgspc b/lib/stwcs/gui/pars/delete_headerlet.cfgspc
deleted file mode 100644
index 43790b1..0000000
--- a/lib/stwcs/gui/pars/delete_headerlet.cfgspc
+++ /dev/null
@@ -1,6 +0,0 @@
-_task_name_ = string_kw(default="delete_headerlet")
-filename = string_kw(default="", comment="FITS image file name(s), list or wild-card")
-hdrname = string_kw(default="", comment="Delete headerlet with this HDRNAME")
-hdrext = integer_or_none_kw(default=None, comment="Delete headerlet from this extension")
-distname = string_kw(default="", comment="Delete *ALL* with this DISTNAME")
-logging = boolean_kw(default=False, comment= "Enable logging to a file")
diff --git a/lib/stwcs/gui/pars/extract_headerlet.cfg b/lib/stwcs/gui/pars/extract_headerlet.cfg
deleted file mode 100644
index 3dd0a7a..0000000
--- a/lib/stwcs/gui/pars/extract_headerlet.cfg
+++ /dev/null
@@ -1,7 +0,0 @@
-_task_name_ = extract_headerlet
-filename = ""
-output = ""
-extnum = None
-hdrname = ""
-clobber = True
-logging = False
diff --git a/lib/stwcs/gui/pars/extract_headerlet.cfgspc b/lib/stwcs/gui/pars/extract_headerlet.cfgspc
deleted file mode 100644
index b50d4bf..0000000
--- a/lib/stwcs/gui/pars/extract_headerlet.cfgspc
+++ /dev/null
@@ -1,7 +0,0 @@
-_task_name_ = string_kw(default="extract_headerlet")
-filename = string_kw(default="", comment="Input file name")
-output = string_kw(default="", comment="Output headerlet FITS filename")
-extnum = integer_or_none_kw(default=None, comment="FITS extension number of headerlet")
-hdrname = string_kw(default="", comment="Unique name(HDRNAME) for headerlet")
-clobber = boolean_kw(default=True, comment= "Overwrite existing headerlet FITS file?")
-logging = boolean_kw(default=False, comment= "Enable logging to a file")
diff --git a/lib/stwcs/gui/pars/headerlet_summary.cfg b/lib/stwcs/gui/pars/headerlet_summary.cfg
deleted file mode 100644
index 7203552..0000000
--- a/lib/stwcs/gui/pars/headerlet_summary.cfg
+++ /dev/null
@@ -1,8 +0,0 @@
-_task_name_ = headerlet_summary
-filename = ""
-columns = None
-pad = 2
-maxwidth = None
-output = ""
-clobber = True
-quiet = False
diff --git a/lib/stwcs/gui/pars/headerlet_summary.cfgspc b/lib/stwcs/gui/pars/headerlet_summary.cfgspc
deleted file mode 100644
index ce65930..0000000
--- a/lib/stwcs/gui/pars/headerlet_summary.cfgspc
+++ /dev/null
@@ -1,8 +0,0 @@
-_task_name_ = string_kw(default="headerlet_summary")
-filename = string_kw(default="", comment="FITS image file name")
-columns = string_kw(default="", comment="Headerlet keyword(s) to be reported")
-pad = integer_kw(default=2, comment="Number of spaces between output columns")
-maxwidth = integer_or_none_kw(default=None, comment="Max width for each column")
-output = string_kw(default="", comment="Name of output file for summary")
-clobber = boolean_kw(default=True, comment="Overwrite previously written summary?")
-quiet = boolean_kw(default=False, comment="Suppress output of summary to STDOUT?")
diff --git a/lib/stwcs/gui/pars/restore_headerlet.cfg b/lib/stwcs/gui/pars/restore_headerlet.cfg
deleted file mode 100644
index b0ec427..0000000
--- a/lib/stwcs/gui/pars/restore_headerlet.cfg
+++ /dev/null
@@ -1,10 +0,0 @@
-_task_name_ = restore_headerlet
-filename = ""
-archive = True
-force = False
-distname = ""
-primary = None
-sciext = "SCI"
-hdrname = ""
-hdrext = None
-logging = False \ No newline at end of file
diff --git a/lib/stwcs/gui/pars/restore_headerlet.cfgspc b/lib/stwcs/gui/pars/restore_headerlet.cfgspc
deleted file mode 100644
index df47e3f..0000000
--- a/lib/stwcs/gui/pars/restore_headerlet.cfgspc
+++ /dev/null
@@ -1,12 +0,0 @@
-_task_name_ = string_kw(default="restore_headerlet")
-filename = string_kw(default="", comment="Input file name")
-archive = boolean_kw(default=True, comment= "Create headerlets from WCSs being replaced?")
-force = boolean_kw(default=False, comment="If distortions do not match, force update anyway?")
-distname = string_kw(default="", triggers="_rule1_", comment="Restore ALL headerlet extensions with this DISTNAME")
-primary = integer_or_none_kw(default=None, inactive_if="_rule1_", comment="Headerlet extension to restore as new primary WCS")
-sciext = string_kw(default="SCI", inactive_if="_rule1_", comment="EXTNAME of extension with WCS")
-hdrname = string_kw(default="", active_if="_rule1_", comment="HDRNAME of headerlet extension to be restored")
-hdrext = integer_or_none_kw(default=None, active_if="_rule1_", comment="Extension number for headerlet to be restored")
-logging = boolean_kw(default=False, comment= "Enable logging to a file")
-[ _RULES_ ]
-_rule1_ = string_kw(default=True, code='from stwcs import wcsutil;from stwcs.wcsutil import headerlet;OUT = headerlet.is_par_blank(VAL)')
diff --git a/lib/stwcs/gui/pars/updatewcs.cfg b/lib/stwcs/gui/pars/updatewcs.cfg
deleted file mode 100644
index 35360f2..0000000
--- a/lib/stwcs/gui/pars/updatewcs.cfg
+++ /dev/null
@@ -1,8 +0,0 @@
-_task_name_ = updatewcs
-input = "*flt.fits"
-extname = "SCI"
-vacorr = True
-tddcorr = True
-npolcorr = True
-d2imcorr = True
-checkfiles = True
diff --git a/lib/stwcs/gui/pars/updatewcs.cfgspc b/lib/stwcs/gui/pars/updatewcs.cfgspc
deleted file mode 100644
index a3a3fb5..0000000
--- a/lib/stwcs/gui/pars/updatewcs.cfgspc
+++ /dev/null
@@ -1,8 +0,0 @@
-_task_name_ = string_kw(default="updatewcs")
-input = string_kw(default="", comment="Input files (name, suffix, or @list)")
-extname = string_kw(default="SCI", comment="EXTNAME of extensions to be archived")
-vacorr = boolean_kw(default=True, comment= "Apply velocity aberration correction?")
-tddcorr = boolean_kw(default=True, comment= "Apply time dependent distortion correction?")
-npolcorr = boolean_kw(default=True, comment= "Apply lookup table distortion?")
-d2imcorr = boolean_kw(default=True, comment= "Apply detector to image correction?")
-checkfiles = boolean_kw(default=True, comment= "Check format of input files?")
diff --git a/lib/stwcs/gui/pars/write_headerlet.cfg b/lib/stwcs/gui/pars/write_headerlet.cfg
deleted file mode 100644
index 9eb4592..0000000
--- a/lib/stwcs/gui/pars/write_headerlet.cfg
+++ /dev/null
@@ -1,18 +0,0 @@
-_task_name_ = write_headerlet
-filename = ""
-output = ""
-clobber = True
-hdrname = ""
-wcskey = "PRIMARY"
-wcsname = ""
-author = ""
-descrip = ""
-catalog = ""
-history = ""
-sciext = "SCI"
-destim = ""
-sipname = ""
-npolfile = ""
-d2imfile = ""
-attach = True
-logging = False \ No newline at end of file
diff --git a/lib/stwcs/gui/pars/write_headerlet.cfgspc b/lib/stwcs/gui/pars/write_headerlet.cfgspc
deleted file mode 100644
index ba28b05..0000000
--- a/lib/stwcs/gui/pars/write_headerlet.cfgspc
+++ /dev/null
@@ -1,18 +0,0 @@
-_task_name_ = string_kw(default="write_headerlet")
-filename = string_kw(default="", comment="Input file name")
-output = string_kw(default="", comment="Filename for headerlet FITS file")
-clobber = boolean_kw(default=True, comment= "Overwrite existing headerlet FITS file?")
-hdrname = string_kw(default="", comment="Unique name(HDRNAME) for headerlet[REQUIRED]")
-wcskey = option_kw("A","B","C","D","E","F","G","H","I","J","K","L","M","N","P","Q","R","S","T","U","V","W","X","Y","Z","PRIMARY", default="PRIMARY", comment="Create headerlet from WCS with this letter")
-wcsname = string_kw(default="", comment="Create headerlet from WCS with this name")
-author = string_kw(default="", comment="Author name for creator of headerlet")
-descrip = string_kw(default="", comment="Short description of headerlet solution")
-catalog = string_kw(default="", comment="Reference frame for headerlet solution")
-history = string_kw(default="", comment="Name of ASCII file containing history for headerlet")
-sciext = string_kw(default="SCI", comment="EXTNAME of extension with WCS")
-destim = string_kw(default="", comment="Rootname of image to which this headerlet applies ")
-sipname = string_kw(default="", comment="Name for source of polynomial distortion keywords")
-npolfile = string_kw(default="", comment="Name for source of non-polynomial residuals")
-d2imfile = string_kw(default="", comment="Name for source of detector correction table")
-attach = boolean_kw(default=True, comment="Create headerlet FITS extension?")
-logging = boolean_kw(default=False, comment= "Enable logging to a file") \ No newline at end of file
diff --git a/lib/stwcs/gui/restore_headerlet.help b/lib/stwcs/gui/restore_headerlet.help
deleted file mode 100644
index fe07a15..0000000
--- a/lib/stwcs/gui/restore_headerlet.help
+++ /dev/null
@@ -1,43 +0,0 @@
-Restore headerlet extension(s) as either a primary WCS or as alternate WCSs
-
-This task can restore a WCS solution stored in a headerlet extension or
-restore all WCS solutions from all headerlet extensions with the same
-distortion model.
-
-Parameters
-----------
-filename: string or HDUList
- Either a filename or PyFITS HDUList object for the input science file
- An input filename (str) will be expanded as necessary to interpret
- any environmental variables included in the filename.
-
-archive: boolean (default True)
- flag indicating if HeaderletHDUs should be created from the
- primary and alternate WCSs in fname before restoring all matching
- headerlet extensions
-
-force: boolean (default:False)
- When the distortion models of the headerlet and the primary do
- not match, and archive is False, this flag forces an update of
- the primary.
-
-distname: string
- distortion model as represented by a DISTNAME keyword
-
-primary: int or string or None
- HeaderletHDU to be restored as primary
- if int - a fits extension
- if string - HDRNAME
- if None - use first HeaderletHDU
-
-sciext: string (default: SCI)
- EXTNAME value of FITS extensions with WCS keywords
-
-hdrname: string
- HDRNAME keyword of HeaderletHDU
-
-hdrext: int or tuple
- Headerlet extension number of tuple ('HDRLET',2)
-
-logging: boolean
- enable file logging \ No newline at end of file
diff --git a/lib/stwcs/gui/restore_headerlet.py b/lib/stwcs/gui/restore_headerlet.py
deleted file mode 100644
index 7570d76..0000000
--- a/lib/stwcs/gui/restore_headerlet.py
+++ /dev/null
@@ -1,48 +0,0 @@
-import os
-
-from stsci.tools import teal
-
-import stwcs
-from stwcs.wcsutil import headerlet
-
-__taskname__ = __name__.split('.')[-1] # needed for help string
-__package__ = headerlet.__name__
-__version__ = stwcs.__version__
-#
-#### Interfaces used by TEAL
-#
-def getHelpAsString(docstring=False):
- """
- return useful help from a file in the script directory called __taskname__.help
- """
- install_dir = os.path.dirname(__file__)
- htmlfile = os.path.join(install_dir,'htmlhelp',__taskname__+'.html')
- helpfile = os.path.join(install_dir,__taskname__+'.help')
- if docstring or (not docstring and not os.path.exists(htmlfile)):
- helpString = __taskname__+' Version '+__version__+'\n\n'
- if os.path.exists(helpfile):
- helpString += teal.getHelpFileAsString(__taskname__,__file__)
- else:
- helpString = 'file://'+htmlfile
-
- return helpString
-
-def run(configObj=None):
-
- if configObj['distname'] not in ['',' ','INDEF']:
- # Call function with properly interpreted input parameters
- # Syntax: restore_all_with_distname(filename, distname, primary,
- # archive=True, sciext='SCI', verbose=False)
- headerlet.restore_all_with_distname(configObj['filename'],
- configObj['distname'],configObj['primary'],
- archive=configObj['archive'],sciext=configObj['sciext'],
- logging=configObj['logging'])
- else:
- # Call function with properly interpreted input parameters
- # restore_from_headerlet(filename, hdrname=None, hdrext=None,
- # archive=True, force=False)
- headerlet.restore_from_headerlet(configObj['filename'],
- hdrname=configObj['hdrname'],hdrext=configObj['hdrext'],
- archive=configObj['archive'], force=configObj['force'],
- logging=configObj['logging'])
-
diff --git a/lib/stwcs/gui/updatewcs.py b/lib/stwcs/gui/updatewcs.py
deleted file mode 100644
index 3dacb67..0000000
--- a/lib/stwcs/gui/updatewcs.py
+++ /dev/null
@@ -1,90 +0,0 @@
-from __future__ import print_function
-import os
-
-from astropy.io import fits
-from stsci.tools import parseinput
-from stsci.tools import fileutil
-from stsci.tools import teal
-import stwcs
-from stwcs import updatewcs
-from stwcs.wcsutil import convertwcs
-
-allowed_corr_dict = {'vacorr':'VACorr','tddcorr':'TDDCorr','npolcorr':'NPOLCorr','d2imcorr':'DET2IMCorr'}
-
-__taskname__ = __name__.split('.')[-1] # needed for help string
-__package__ = updatewcs.__name__
-__version__ = stwcs.__version__
-
-#
-#### Interfaces used by TEAL
-#
-def getHelpAsString(docstring=False):
- """
- return useful help from a file in the script directory called __taskname__.help
- """
- install_dir = os.path.dirname(__file__)
- htmlfile = os.path.join(install_dir,'htmlhelp',__taskname__+'.html')
- helpfile = os.path.join(install_dir,__taskname__+'.help')
- if docstring or (not docstring and not os.path.exists(htmlfile)):
- helpString = __taskname__+' Version '+__version__+'\n\n'
- if os.path.exists(helpfile):
- helpString += teal.getHelpFileAsString(__taskname__,__file__)
- else:
- helpString += eval('.'.join([__package__,__taskname__,'__doc__']))
-
- else:
- helpString = 'file://'+htmlfile
-
- return helpString
-
-def run(configObj=None):
-
- # Interpret primary parameters from configObj instance
- extname = configObj['extname']
- input = configObj['input']
-
- # create dictionary of remaining parameters, deleting extraneous ones
- # such as those above
- cdict = configObj.dict()
- # remove any rules defined for the TEAL interface
- if "_RULES_" in cdict: del cdict['_RULES_']
- del cdict['_task_name_']
- del cdict['input']
- del cdict['extname']
-
- # parse input
- input,altfiles = parseinput.parseinput(configObj['input'])
-
- # Insure that all input files have a correctly archived
- # set of OPUS WCS keywords
- # Legacy files from OTFR, like all WFPC2 data from OTFR, will only
- # have the OPUS WCS keywords archived using a prefix of 'O'
- # These keywords need to be converted to the Paper I alternate WCS
- # standard using a wcskey (suffix) of 'O'
- # If an alternate WCS with wcskey='O' already exists, this will copy
- # the values from the old prefix-'O' WCS keywords to insure the correct
- # OPUS keyword values get archived for use with updatewcs.
- #
- for file in input:
- # Check to insure that there is a valid reference file to be used
- idctab = fits.getval(file, 'idctab')
- if not os.path.exists(fileutil.osfn(idctab)):
- print('No valid distortion reference file ',idctab,' found in ',file,'!')
- raise ValueError
-
- # Re-define 'cdict' to only have switches for steps supported by that instrument
- # the set of supported steps are defined by the dictionary
- # updatewcs.apply_corrections.allowed_corrections
- #
- for file in input:
- # get instrument name from input file
- instr = fits.getval(file,'INSTRUME')
- # make copy of input parameters dict for this file
- fdict = cdict.copy()
- # Remove any parameter that is not part of this instrument's allowed corrections
- for step in allowed_corr_dict:
- if allowed_corr_dict[step] not in updatewcs.apply_corrections.allowed_corrections[instr]:
- fdict[step]
- # Call 'updatewcs' on correctly archived file
- updatewcs.updatewcs(file,**fdict)
-
diff --git a/lib/stwcs/gui/write_headerlet.py b/lib/stwcs/gui/write_headerlet.py
deleted file mode 100644
index e18bed8..0000000
--- a/lib/stwcs/gui/write_headerlet.py
+++ /dev/null
@@ -1,80 +0,0 @@
-from __future__ import print_function
-import os
-
-from stsci.tools import teal
-from stsci.tools import parseinput
-
-import stwcs
-from stwcs.wcsutil import headerlet
-
-__taskname__ = __name__.split('.')[-1] # needed for help string
-__package__ = headerlet.__name__
-__version__ = stwcs.__version__
-#
-#### Interfaces used by TEAL
-#
-def getHelpAsString(docstring=False):
- """
- return useful help from a file in the script directory called __taskname__.help
- """
- install_dir = os.path.dirname(__file__)
- htmlfile = os.path.join(install_dir,'htmlhelp',__taskname__+'.html')
- helpfile = os.path.join(install_dir,__taskname__+'.help')
- if docstring or (not docstring and not os.path.exists(htmlfile)):
- helpString = __taskname__+' Version '+__version__+'\n\n'
- if os.path.exists(helpfile):
- helpString += teal.getHelpFileAsString(__taskname__,__file__)
- else:
- helpString += headerlet.write_headerlet.__doc__
-
- else:
- helpString = 'file://'+htmlfile
-
- return helpString
-
-def run(configObj=None):
- flist,oname = parseinput.parseinput(configObj['filename'])
- if len(flist) == 0:
- print('='*60)
- print('ERROR:')
- print(' No valid "filename" parameter value provided!')
- print(' Please check the working directory and restart this task.')
- print('='*60)
- return
-
- if configObj['hdrname'] in ['',' ','INDEF']:
- print('='*60)
- print('ERROR:')
- print(' No valid "hdrname" parameter value provided!')
- print(' Please restart this task and provide a value for this parameter.')
- print('='*60)
- return
-
- if configObj['output'] in ['',' ','INDEF']:
- configObj['output'] = None
-
- str_kw = ['wcsname','destim','sipname','npolfile','d2imfile',
- 'descrip','history','author','output','catalog']
-
- # create dictionary of remaining parameters, deleting extraneous ones
- # such as those above
- cdict = configObj.dict()
- # remove any rules defined for the TEAL interface
- if "_RULES_" in cdict: del cdict['_RULES_']
- del cdict['_task_name_']
- del cdict['filename']
- del cdict['hdrname']
-
- # Convert blank string input as None
- for kw in str_kw:
- if cdict[kw] == '': cdict[kw] = None
- if cdict['wcskey'].lower() == 'primary': cdict['wcskey'] = ' '
-
- # Call function with properly interpreted input parameters
- # Syntax: write_headerlet(filename, hdrname, output, sciext='SCI',
- # wcsname=None, wcskey=None, destim=None,
- # sipname=None, npolfile=None, d2imfile=None,
- # author=None, descrip=None, history=None,
- # attach=True, clobber=False)
- headerlet.write_headerlet(flist, configObj['hdrname'],
- **cdict)