From 56dbcca502bcf39cab07a905b295b79fc7015237 Mon Sep 17 00:00:00 2001 From: James Davies Date: Mon, 29 Mar 2021 11:51:06 -0400 Subject: [PATCH] Remove unused SubtractImagesStep --- CHANGES.rst | 5 +++ jwst/background/__init__.py | 4 +- jwst/background/subtract_images.py | 42 ------------------ jwst/background/subtract_images_step.py | 59 ------------------------- jwst/pipeline/subtract_images.cfg | 3 -- jwst/step.py | 2 - jwst/stpipe/integration.py | 1 - 7 files changed, 7 insertions(+), 109 deletions(-) delete mode 100644 jwst/background/subtract_images.py delete mode 100755 jwst/background/subtract_images_step.py delete mode 100644 jwst/pipeline/subtract_images.cfg diff --git a/CHANGES.rst b/CHANGES.rst index c1f37d75397..3f5b6459f5c 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -26,6 +26,11 @@ associations PUPIL value (cross filter) when matching direct images with grism images in NIRISS WFSS observations. [#5896] +background +---------- + +- Remove unused ``SubtractImagesStep`` [#5919] + cube_build ---------- diff --git a/jwst/background/__init__.py b/jwst/background/__init__.py index 93f1a0ca043..ef3c2f1a841 100644 --- a/jwst/background/__init__.py +++ b/jwst/background/__init__.py @@ -1,4 +1,4 @@ -from .subtract_images_step import SubtractImagesStep from .background_step import BackgroundStep -__all__ = ['SubtractImagesStep', 'BackgroundStep'] + +__all__ = ['BackgroundStep'] diff --git a/jwst/background/subtract_images.py b/jwst/background/subtract_images.py deleted file mode 100644 index a36d4bc33da..00000000000 --- a/jwst/background/subtract_images.py +++ /dev/null @@ -1,42 +0,0 @@ -import numpy as np - -import logging -log = logging.getLogger(__name__) -log.setLevel(logging.DEBUG) - - -def subtract(model1, model2): - """ - Short Summary - ------------- - Subtract one data model from another - - Parameters - ---------- - model1: JWST data model - input data model on which subtraction will be performed - - model2: JWST data model - input data model that will be subtracted from the first model - - Returns - ------- - output: JWST data model - subtracted data model - """ - - # Create the ouput model as a copy of the first input - output = model1.copy() - - # Subtract the SCI arrays - output.data = model1.data - model2.data - - # Combine the ERR arrays in quadrature - # NOTE: currently stubbed out until ERR handling is decided - # output.err = np.sqrt(model1.err**2 + model2.err**2) - - # Combine the DQ flag arrays using bitwise OR - output.dq = np.bitwise_or(model1.dq, model2.dq) - - # Return the subtracted model - return output diff --git a/jwst/background/subtract_images_step.py b/jwst/background/subtract_images_step.py deleted file mode 100755 index 01e8c0eb5f5..00000000000 --- a/jwst/background/subtract_images_step.py +++ /dev/null @@ -1,59 +0,0 @@ -#! /usr/bin/env python - -from ..stpipe import Step -from .. import datamodels -from . import subtract_images - - -class SubtractImagesStep(Step): - """ - SubtractImagesStep: Subtract two exposures from one - another to accomplish background subtraction. - """ - - spec = """ - """ - - def process(self, input1, input2): - """ - Subtract the background signal from a JWST data model by - subtracting a background image from it. - - Parameters - ---------- - input1: JWST data model - input science data model to be background-subtracted - - input2: JWST data model - background data model - - Returns - ------- - result: JWST data model - background-subtracted science data model - """ - - # Open the first input - model1 = datamodels.open(input1) - - if isinstance(model1, datamodels.CubeModel): - self.log.debug('Input is a CubeModel') - elif isinstance(model1, datamodels.ImageModel): - self.log.debug('Input is an ImageModel') - elif isinstance(model1, datamodels.MultiSlitModel): - self.log.debug('Input is a MultiSlitModel') - - # Assume that the second input model is always an ImageModel - model2 = datamodels.ImageModel(input2) - - # Call the subtraction routine - result = subtract_images.subtract(model1, model2) - - # Set the step status indicator in the output model - result.meta.cal_step.back_sub = 'COMPLETE' - - # We're done. Close the models and return the result. - model1.close() - model2.close() - - return result diff --git a/jwst/pipeline/subtract_images.cfg b/jwst/pipeline/subtract_images.cfg deleted file mode 100644 index 6d0e5afd0a4..00000000000 --- a/jwst/pipeline/subtract_images.cfg +++ /dev/null @@ -1,3 +0,0 @@ -name = "subtract_images" -class = "jwst.background.SubtractImagesStep" - diff --git a/jwst/step.py b/jwst/step.py index 5cba2640467..cd4e1ff36f7 100644 --- a/jwst/step.py +++ b/jwst/step.py @@ -3,7 +3,6 @@ from .ami.ami_normalize_step import AmiNormalizeStep from .assign_mtwcs.assign_mtwcs_step import AssignMTWcsStep from .assign_wcs.assign_wcs_step import AssignWcsStep -from .background.subtract_images_step import SubtractImagesStep from .background.background_step import BackgroundStep from .barshadow.barshadow_step import BarShadowStep from .combine_1d.combine_1d_step import Combine1dStep @@ -64,7 +63,6 @@ "AmiNormalizeStep", "AssignMTWcsStep", "AssignWcsStep", - "SubtractImagesStep", "BackgroundStep", "BarShadowStep", "Combine1dStep", diff --git a/jwst/stpipe/integration.py b/jwst/stpipe/integration.py index 6c136a19604..ebc9cbcf10b 100644 --- a/jwst/stpipe/integration.py +++ b/jwst/stpipe/integration.py @@ -36,7 +36,6 @@ def get_steps(): ("jwst.step.AmiNormalizeStep", None, False), ("jwst.step.AssignMTWcsStep", None, False), ("jwst.step.AssignWcsStep", None, False), - ("jwst.step.SubtractImagesStep", None, False), ("jwst.step.BackgroundStep", None, False), ("jwst.step.BarShadowStep", None, False), ("jwst.step.Combine1dStep", None, False),