Skip to content

Commit 5fa1452

Browse files
braingramtapastro
andauthored
Remove unnecessary casts (#9825)
Co-authored-by: Tyler Pauly <[email protected]>
1 parent f2e3490 commit 5fa1452

File tree

6 files changed

+5
-6
lines changed

6 files changed

+5
-6
lines changed

changes/9825.group_scale.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Remove cast (which consumed 3x the data array size) to improve memory usage.

changes/9825.linearity.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Remove cast (which consumed 3x the data array size) to reduce memory usage.

changes/9825.superbias.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Remove cast (which used 3x the data array size) to reduce memory usage.

jwst/group_scale/group_scale.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,8 +40,6 @@ def do_correction(model):
4040

4141
# Apply the rescaling to the entire data array
4242
scale = float(frame_divisor) / nframes
43-
if not isinstance(type(model.data), float):
44-
model.data = (model.data).astype(float)
4543
model.data *= scale
4644
model.meta.cal_step.group_scale = "COMPLETE"
4745

jwst/linearity/linearity.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ def do_correction(output_model, lin_model):
3838
gdq = output_model.groupdq
3939
# If the input data does not have an expanded DQ array, create one
4040
if len(output_model.groupdq) == 0:
41-
gdq = (output_model.data * 0).astype(np.uint32)
41+
gdq = np.zeros(output_model.data.shape, dtype=np.uint32)
4242

4343
# Obtain linearity coefficients and dq array from reference file
4444
if reffile_utils.ref_matches_sci(output_model, lin_model):

jwst/superbias/bias_sub.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -63,12 +63,10 @@ def subtract_bias(output, bias):
6363
Bias-subtracted science data
6464
"""
6565
# combine the science and superbias DQ arrays
66-
output.pixeldq = np.bitwise_or(output.pixeldq, bias.dq)
66+
output.pixeldq |= bias.dq
6767

6868
# Subtract the superbias image from all groups and integrations
6969
# of the science data
70-
if not isinstance(type(output.data), float):
71-
output.data = (output.data).astype(float)
7270
output.data -= bias.data
7371

7472
# If ZEROFRAME is present, subtract the super bias. Zero values

0 commit comments

Comments
 (0)