Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

HLA-1208 Removing TEAL GUI #1759

Open
wants to merge 15 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ number of the code change for that issue. These PRs can be viewed at:
3.7.1 (unreleased)
=====================

- Removed options allowing the TEAL GUI interface. [#1759]

- Skycell added to flt(c) and drz(c) science headers for the pipeline and svm products. [#1729]


Expand Down
17 changes: 16 additions & 1 deletion doc/ADRs.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,4 +25,19 @@ The second column of a poller file is now reserved (for WFPC2) for passing the a

## Consequences

Caution must be taken is using variations of the poller file while processing WFPC2 data.
Caution must be taken is using variations of the poller file while processing WFPC2 data.


# Primary Drizzlepac Module run functions 02/29/24

## Context

The primary modules for drizzlepac have main functions named "run". This comes from the TEAL interface's need to identify modules. There are also a number of cases when the primary function of a module is unclear (e.g. ablot.py)

## Decision

The primary function in the drizzlepac modules will be renamed to 'main()'. Any user interface will be renamed to 'user_main()'. Exceptions are commonly used standalone tools like Tweakback, Tweakreg, and Astrodrizzle.

## Consequences

Calls of just "main" may be confusing if the function is loaded from any module. Calls to "main" should be left in their associated namespaces e.g. createMedian.main() not main().
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ Alternative Usage
>>> runastrodriz.process(inputFilename,force=False,newpath=None,inmemory=False)


GUI Usage under Python (Legacy only)
====================================
GUI Usage under Python (no longer supported)
============================================

>>> python
>>> from stsci.tools import teal
Expand Down
4 changes: 1 addition & 3 deletions doc/source/user_reprocessing/image_registration.rst
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,7 @@ for IRAF's ``tweakshifts``, currently named ``TweakReg``, along
with tasks for updating the WCS in HST images and performing
photometry equalization for WFPC2 data.

These pages describe how to run the new ``TEAL``-enabled task,
as well as use the classes in the task to generate catalogs interactively
for any chip and work with that catalog. The current implementation of this
The current implementation of this
code relies on a very basic source finding algorithm loosely patterned
after the DAOFIND algorithm and does not provide all the same features
or outputs found in DAOFIND. The fitting algorithm also reproduces the
Expand Down
8 changes: 0 additions & 8 deletions drizzlepac/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -84,14 +84,6 @@
from . import align
from . import runastrodriz

# These lines allow TEAL to print out the names of TEAL-enabled tasks
# upon importing this package.
from stsci.tools import teal


teal.print_tasknames(__name__, os.path.dirname(__file__),
hidden=['adrizzle','ablot','buildwcs'])


def help():
msg = \
Expand Down
7 changes: 0 additions & 7 deletions drizzlepac/ablot.help
Original file line number Diff line number Diff line change
Expand Up @@ -158,10 +158,3 @@ command line, using the default parameter settings:
>>> ablot.blot('adriz_aligned_wcs_f814w_med.fits','j8c0d1bwq_flc.fits[sci,1]',
'aligned_f814w_sci1_blot.fits',configObj=blotobj)

or

>>> a = teal.teal('ablot')
# set data = adriz_aligned_wcs_f814w_med.fits
# set reference = j8c0d1bwq_flc.fits[sci,1]
# set outdata = aligned_f814w_sci1_blot.fits

10 changes: 2 additions & 8 deletions drizzlepac/ablot.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
import os
import sys
import numpy as np
from stsci.tools import fileutil, teal, logutil
from stsci.tools import fileutil, logutil
from . import outputimage
from . import wcs_functions
from . import processInput
Expand All @@ -37,10 +37,6 @@
log = logutil.create_logger(__name__, level=logutil.logging.NOTSET)


#
#### User level interface run from TEAL
#

def blot(data, reference, outdata, configObj=None, wcsmap=wcs_functions.WCSMap,
editpars=False, **input_dict):
if input_dict is None:
Expand All @@ -49,9 +45,7 @@ def blot(data, reference, outdata, configObj=None, wcsmap=wcs_functions.WCSMap,
input_dict['reference'] = reference
input_dict['outdata'] = outdata

# If called from interactive user-interface, configObj will not be
# defined yet, so get defaults using EPAR/TEAL.
#
# gets configObj defaults using EPAR/TEAL.
# Also insure that the input_dict (user-specified values) are folded in
# with a fully populated configObj instance.
configObj = util.getDefaultConfigObj(__taskname__, configObj,
Expand Down
11 changes: 3 additions & 8 deletions drizzlepac/adrizzle.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
from . import util
import numpy as np
from astropy.io import fits
from stsci.tools import fileutil, logutil, mputil, teal
from stsci.tools import fileutil, logutil, mputil
from . import outputimage, wcs_functions
import stwcs
from stwcs import distortion
Expand Down Expand Up @@ -60,9 +60,7 @@ def drizzle(input, outdata, wcsmap=None, editpars=False, configObj=None, **input
input_dict['input'] = input
input_dict['outdata'] = outdata

# If called from interactive user-interface, configObj will not be
# defined yet, so get defaults using EPAR/TEAL.
#
# gets configObj defaults using EPAR/TEAL.
# Also insure that the input_dict (user-specified values) are folded in
# with a fully populated configObj instance.
configObj = util.getDefaultConfigObj(__taskname__, configObj, input_dict, loadOnly=(not editpars))
Expand All @@ -73,11 +71,8 @@ def drizzle(input, outdata, wcsmap=None, editpars=False, configObj=None, **input
run(configObj, wcsmap=wcsmap)


#
# ### User level interface to run drizzle tasks from TEAL
#
def run(configObj, wcsmap=None):
""" Interface for running ``wdrizzle`` from TEAL or Python command-line.
""" Interface for running ``wdrizzle`` from Python command-line.

This code performs all file ``I/O`` to set up the use of the drizzle code for
a single exposure to replicate the functionality of the original ``wdrizzle``.
Expand Down
15 changes: 5 additions & 10 deletions drizzlepac/astrodrizzle.help
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,7 @@ configobj : ConfigObjPars, ConfigObj, dict (Default = None)
settings. When ``configobj`` is ``defaults``, default parameter values are
loaded from the user local configuration file usually located in
``~/.teal/astrodrizzle.cfg`` or a matching configuration file in the
current directory. This configuration file stores most recent
settings that an user used when running ``AstroDrizzle`` through the
`TEAL <https://stscitools.readthedocs.io/en/latest/teal_guide.html>`_
interface. When ``configobj`` is ``None``, ``AstroDrizzle``
current directory. When ``configobj`` is ``None``, ``AstroDrizzle``
parameters not provided explicitly will be initialized with their
default values as described in the "Other Parameters" section.

Expand All @@ -44,8 +41,7 @@ input_dict : dict, optional
be used to override the defaults.

.. note:: This list of parameters **can** include the ``updatewcs``
parameter, even though this parameter no longer can be set through
the ``TEAL`` GUI.
parameter.

.. note:: This list of parameters **can** contain parameters specific
to the ``AstroDrizzle`` task itself described here in the
Expand Down Expand Up @@ -74,8 +70,8 @@ output : str (Default = '')
will be used for the output file name.

mdriztab : bool (Default = False)
This button will immediately update the parameter values in the ``TEAL``
GUI based on those provided by the ``MDRIZTAB`` reference table referenced
This button will immediately update the parameter values based on those provided
by the ``MDRIZTAB`` reference table referenced
in the first input image. This requires that the ``MDRIZTAB`` reference
file be available locally.

Expand Down Expand Up @@ -1021,8 +1017,7 @@ Run the task from Python using the command line. ::

>>> astrodrizzle.AstroDrizzle('*flt.fits', configobj='myparam.cfg')

Help can be accessed via the "Help" pulldown menu in the ``TEAL`` GUI.
It can also be accessed from the Python command-line and saved
Help can be accessed from the Python command-line and saved
to a text file:

>>> from drizzlepac import astrodrizzle
Expand Down
32 changes: 5 additions & 27 deletions drizzlepac/astrodrizzle.py
Original file line number Diff line number Diff line change
Expand Up @@ -87,9 +87,7 @@ def AstroDrizzle(input=None, mdriztab=False, editpars=False, configobj=None,
configobj['updatewcs'] = input_dict['updatewcs']
del input_dict['updatewcs']

# If called from interactive user-interface, configObj will not be
# defined yet, so get defaults using EPAR/TEAL.
#
# gets configObj defaults using EPAR/TEAL.
# Also insure that the input_dict (user-specified values) are folded in
# with a fully populated configObj instance.
try:
Expand All @@ -116,31 +114,11 @@ def AstroDrizzle(input=None, mdriztab=False, editpars=False, configobj=None,
# If 'editpars' was set to True, util.getDefaultConfigObj() will have
# already called 'run()'.
if not editpars:
run(configObj, wcsmap=wcsmap)

##############################
# Interfaces used by TEAL #
##############################
@util.with_logging
def run(configobj, wcsmap=None):
"""
Initial example by Nadia ran MD with configobj EPAR using:
It can be run in one of two ways:

from stsci.tools import teal

1. Passing a config object to teal
main(configObj, wcsmap=wcsmap)

teal.teal('drizzlepac/pars/astrodrizzle.cfg')


2. Passing a task name:

teal.teal('astrodrizzle')

The example config files are in drizzlepac/pars

"""
@util.with_logging
def main(configobj, wcsmap=None):
# turn on logging, redirecting stdout/stderr messages to a log file
# while also printing them out to stdout as well
# also, initialize timing of processing steps
Expand Down Expand Up @@ -220,7 +198,7 @@ def run(configobj, wcsmap=None):
# _dbg_dump_virtual_outputs(imgObjList)

# create the median images from the driz sep images
createMedian.createMedian(imgObjList, configobj, procSteps=procSteps)
createMedian.main(imgObjList, configobj, procSteps=procSteps)

# blot the images back to the original reference frame
ablot.runBlot(imgObjList, outwcs, configobj, wcsmap=wcsmap,
Expand Down
4 changes: 1 addition & 3 deletions drizzlepac/buildmask.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,9 +55,7 @@
def run(configObj=None, input_dict={}, loadOnly=False):
""" Build DQ masks from all input images, then apply static mask(s).
"""
# If called from interactive user-interface, configObj will not be
# defined yet, so get defaults using EPAR/TEAL.
#
# gets configObj defaults using EPAR/TEAL.
# Also insure that the input_dict (user-specified values) are folded in
# with a fully populated configObj instance.
configObj = util.getDefaultConfigObj(__taskname__,configObj,input_dict,loadOnly=loadOnly)
Expand Down
3 changes: 0 additions & 3 deletions drizzlepac/buildwcs.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,6 @@
model_attrs = ['cpdis1','cpdis2','det2im','det2im1','det2im2',
'ocx10','ocx11','ocy10','ocy11','sip']

#
#### User level interface run from TEAL
#

def buildwcs(outwcs, configObj=None,editpars=False,**input_dict):
if input_dict is None:
Expand Down
30 changes: 9 additions & 21 deletions drizzlepac/createMedian.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,8 @@

from stsci.imagestats import ImageStats
from stsci.image import numcombine
from stsci.tools import iterfile, teal, logutil
from stsci.tools import iterfile, logutil

from . import imageObject
from . import util
from .minmed import min_med
from . import processInput
Expand All @@ -34,7 +33,7 @@


# this is the user access function
def median(input=None, configObj=None, editpars=False, **inputDict):
def user_main(input=None, configObj=None, **inputDict):
"""
Create a median image from the seperately drizzled images.
"""
Expand All @@ -43,28 +42,17 @@
else:
raise ValueError("Please supply an input image")

configObj = util.getDefaultConfigObj(__taskname__, configObj, inputDict,
loadOnly=(not editpars))
configObj = util.getDefaultConfigObj(__taskname__, configObj, inputDict)

Check warning on line 45 in drizzlepac/createMedian.py

View check run for this annotation

Codecov / codecov/patch

drizzlepac/createMedian.py#L45

Added line #L45 was not covered by tests

if configObj is None:
return

if not editpars:
run(configObj)
raise ValueError("No configuration object found.")

Check warning on line 48 in drizzlepac/createMedian.py

View check run for this annotation

Codecov / codecov/patch

drizzlepac/createMedian.py#L48

Added line #L48 was not covered by tests

imgObjList, outwcs = processInput.setCommonInput(configObj, createOutwcs=False)
main(imgObjList, configObj)

Check warning on line 51 in drizzlepac/createMedian.py

View check run for this annotation

Codecov / codecov/patch

drizzlepac/createMedian.py#L50-L51

Added lines #L50 - L51 were not covered by tests

# this is the function that will be called from TEAL
def run(configObj):
imgObjList, outwcs = processInput.setCommonInput(
configObj,
createOutwcs=False
) # outwcs is not needed here
createMedian(imgObjList, configObj)


# ###################################################
# ## Top-level interface from inside AstroDrizzle ##
# ###################################################
def createMedian(imgObjList, configObj, procSteps=None):
def main(imgObjList, configObj, procSteps=None):
""" Top-level interface to createMedian step called from top-level
AstroDrizzle.

Expand Down Expand Up @@ -472,6 +460,6 @@
return pf


median.__doc__ = util._def_help_functions(
main.__doc__ = util._def_help_functions(
locals(), module_file=__file__, task_name=__taskname__, module_doc=__doc__
)
3 changes: 1 addition & 2 deletions drizzlepac/drizCR.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
import numpy as np
from scipy import signal
from astropy.io import fits
from stsci.tools import fileutil, logutil, mputil, teal
from stsci.tools import fileutil, logutil, mputil


from . import quickDeriv
Expand Down Expand Up @@ -45,7 +45,6 @@ def drizCR(input=None, configObj=None, editpars=False, **inputDict):
run(configObj)


# this is the function that will be called from TEAL
def run(configObj):
# outwcs is not neaded here
imgObjList, outwcs = processInput.setCommonInput(configObj,
Expand Down
2 changes: 0 additions & 2 deletions drizzlepac/imagefindpars.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@
:License: :doc:`/LICENSE`

"""
import os, string
from stsci.tools import teal
from . import util
from . import __version__

Expand Down
3 changes: 0 additions & 3 deletions drizzlepac/mapreg.py
Original file line number Diff line number Diff line change
Expand Up @@ -1063,9 +1063,6 @@ def _check_FITS_extensions(img, extensions):
return all_present


#--------------------------
# TEAL Interface functions
#--------------------------
def run(configObj):
MapReg(input_reg = configObj['input_reg'],
images = configObj['images'],
Expand Down
7 changes: 4 additions & 3 deletions drizzlepac/mdriz.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,13 +34,14 @@

# read options
help = False
editpars = False
editpars = False # deprecated parameter left over from TEAL

Check warning on line 37 in drizzlepac/mdriz.py

View check run for this annotation

Codecov / codecov/patch

drizzlepac/mdriz.py#L37

Added line #L37 was not covered by tests
long_help = False
for opt, value in optlist:
if opt == '-h':
help = True
elif opt == '-g':
editpars = True
# editpars = True
raise ValueError('The -g option and TEAL GUI are no longer supported.')

Check warning on line 44 in drizzlepac/mdriz.py

View check run for this annotation

Codecov / codecov/patch

drizzlepac/mdriz.py#L44

Added line #L44 was not covered by tests
elif opt == '-?':
long_help = True

Expand All @@ -50,7 +51,7 @@
if help:
print('Syntax: mdriz.py -[h|g|?] [name=value,...]')
print(' Options: -h: help')
print(' -g: edit parameters with TEAL')
# print(' -g: deprecated parameter left over from TEAL')
print(' -?: extended help message')
print(' Parameters should be given as "name=value" pairs for all parameters')
print(' understood by MultiDrizzle. These values will ALWAYS override')
Expand Down
Loading