Skip to content

Commit

Permalink
Remove unnecessary code.
Browse files Browse the repository at this point in the history
  • Loading branch information
mairanteodoro committed Dec 11, 2024
1 parent c2747fc commit 60b0642
Showing 1 changed file with 15 additions and 3 deletions.
18 changes: 15 additions & 3 deletions romancal/resample/resample_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -419,16 +419,28 @@ def resample_range(data_shape, bbox=None):


def add_var_sky_array(input_models: ModelLibrary):
"""
Add sky variance array to each input model.
Parameters
----------
input_models : ModelLibrary
A library of models or a single model to which the sky variance array will be added.
Returns
-------
None
"""
input_models = (
input_models
if isinstance(input_models, ModelLibrary)
else ModelLibrary([input_models])
)
with input_models:
ref_img = input_models.borrow(index=0)
var_sky = np.zeros_like(ref_img.data)
input_models.shelve(model=ref_img, index=0)
for i, img in enumerate(input_models):
var_sky += img.var_rnoise + img.var_poisson / img.data * np.median(img.data)
img["var_sky"] = var_sky
img["var_sky"] = img.var_rnoise + img.var_poisson / img.data * np.median(
img.data
)
input_models.shelve(img, i, modify=True)

0 comments on commit 60b0642

Please sign in to comment.