Skip to content

Commit

Permalink
JP-2944: Limit major axis expansion for MIRI shower flagging (#123)
Browse files Browse the repository at this point in the history
* Update jump.py

* Update jump.py

* Update jump.py

* Update jump.py

* Update jump.py

* Update jump.py

* Update jump.py

* Update jump.py

* Update jump.py

* Update CHANGES.rst

* Update jump.py

* Update jump.py

* Update jump.py

* Update CHANGES.rst

Co-authored-by: Howard Bushouse <[email protected]>
  • Loading branch information
mwregan2 and hbushouse authored Oct 14, 2022
1 parent dc44c77 commit dd7cb2c
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 7 deletions.
13 changes: 10 additions & 3 deletions CHANGES.rst
Original file line number Diff line number Diff line change
@@ -1,6 +1,13 @@
1.2.1 (unreleased)
==================

Bug Fixes
---------

jump
~~~~
- Changes to limit the expansion of MIRI shower ellipses to be the same
number of pixels for both the major and minor axis. JP-2944 [#123]

1.2.0 (2022-10-07)
==================
Expand All @@ -18,11 +25,11 @@ jump
~~~~

- Changes to flag both NIR snowballs and MIRI showers
for JP-#2645. [#118]
for JP-#2645. [#118]

- Early in the step, the object arrays are converted from DN to electrons
by multiplying by the gain. The values need to be reverted back to DN
at the end of the step. [#116]
by multiplying by the gain. The values need to be reverted back to DN
at the end of the step. [#116]

1.1.0 (2022-08-17)
==================
Expand Down
16 changes: 12 additions & 4 deletions src/stcal/jump/jump.py
Original file line number Diff line number Diff line change
Expand Up @@ -407,11 +407,19 @@ def extend_ellipses(plane, ellipses, sat_flag, jump_flag, expansion=1.1):
for ellipse in ellipses:
ceny = ellipse[0][0]
cenx = ellipse[0][1]
majaxis = ellipse[1][0] * expansion
minaxis = ellipse[1][1] * expansion
# Expand the ellipse by the expansion factor. The number of pixels added to both axes is
# the number of pixels added to the minor axis. This prevents very large flagged ellipses
# with high axis ratio ellipses. The major and minor axis are not always the same index.
# Therefore, we have to test to find which is actually the minor axis.
if ellipse[1][1] < ellipse[1][0]:
axis1 = ellipse[1][0] + (expansion - 1.0) * ellipse[1][1]
axis2 = ellipse[1][1] * expansion
else:
axis1 = ellipse[1][0] * expansion
axis2 = ellipse[1][1] + (expansion - 1.0) * ellipse[1][0]
alpha = ellipse[2]
image = cv.ellipse(image, (round(ceny), round(cenx)), (round(majaxis / 2),
round(minaxis / 2)), alpha, 0, 360, (0, 0, 4), -1)
image = cv.ellipse(image, (round(ceny), round(cenx)), (round(axis1 / 2),
round(axis2 / 2)), alpha, 0, 360, (0, 0, 4), -1)
jump_ellipse = image[:, :, 2]
saty, satx = np.where(sat_pix == 2)
jump_ellipse[saty, satx] = 0
Expand Down

0 comments on commit dd7cb2c

Please sign in to comment.