Skip to content

Commit

Permalink
[pre-commit.ci] auto fixes from pre-commit.com hooks
Browse files Browse the repository at this point in the history
for more information, see https://pre-commit.ci
  • Loading branch information
pre-commit-ci[bot] authored and schlafly committed Dec 6, 2024
1 parent d01327f commit 40fa1ca
Show file tree
Hide file tree
Showing 6 changed files with 14 additions and 17 deletions.
3 changes: 1 addition & 2 deletions romancal/flatfield/flat_field.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,8 +67,7 @@ def do_flat_field(output_model, flat_model, include_var_flat=False):
log.info("Skipping flat field - no flat reference file.")
output_model.meta.cal_step.flat_field = "SKIPPED"
else:
apply_flat_field(output_model, flat_model,
include_var_flat=include_var_flat)
apply_flat_field(output_model, flat_model, include_var_flat=include_var_flat)
output_model.meta.cal_step.flat_field = "COMPLETE"


Expand Down
4 changes: 1 addition & 3 deletions romancal/flatfield/flat_field_step.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,7 @@ def process(self, input_model):

# Do the flat-field correction
output_model = flat_field.do_correction(
input_model,
reference_file_model,
include_var_flat=self.include_var_flat
input_model, reference_file_model, include_var_flat=self.include_var_flat
)

# Close reference file
Expand Down
8 changes: 4 additions & 4 deletions romancal/flatfield/tests/test_flatfield.py
Original file line number Diff line number Diff line change
Expand Up @@ -91,14 +91,14 @@ def test_skip_var_flat():

wfi_image1 = maker_utils.mk_level2_image()
wfi_image2 = maker_utils.mk_level2_image()
del wfi_image1['var_flat']
del wfi_image2['var_flat']
del wfi_image1["var_flat"]
del wfi_image2["var_flat"]
wfi_image_model1 = ImageModel(wfi_image1)
wfi_image_model2 = ImageModel(wfi_image2)
result1 = FlatFieldStep.call(wfi_image_model1, include_var_flat=False)
result2 = FlatFieldStep.call(wfi_image_model2, include_var_flat=True)
assert not hasattr(result1, 'var_flat')
assert hasattr(result2, 'var_flat')
assert not hasattr(result1, "var_flat")
assert hasattr(result2, "var_flat")


@pytest.mark.parametrize(
Expand Down
3 changes: 1 addition & 2 deletions romancal/regtest/test_resample.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,8 +64,7 @@ def test_resample_single_file(rtdata, ignore_asdf_paths):
}"""
)
assert all(
hasattr(resample_out, x)
for x in ["data", "err", "var_poisson", "var_rnoise"]
hasattr(resample_out, x) for x in ["data", "err", "var_poisson", "var_rnoise"]
)

step.log.info(
Expand Down
7 changes: 4 additions & 3 deletions romancal/resample/resample.py
Original file line number Diff line number Diff line change
Expand Up @@ -169,8 +169,9 @@ def __init__(

with self.input_models:
models = list(self.input_models)
self.all_have_var_flat = np.all([
hasattr(model, 'var_flat') for model in models])
self.all_have_var_flat = np.all(
[hasattr(model, "var_flat") for model in models]
)

# update meta.basic
populate_mosaic_basic(self.blank_output, models)
Expand Down Expand Up @@ -204,7 +205,7 @@ def __init__(
self.input_models.shelve(m, i, modify=False)

if not self.all_have_var_flat:
del self.blank_output._instance['var_flat']
del self.blank_output._instance["var_flat"]

def do_drizzle(self):
"""Pick the correct drizzling mode based on ``self.single``."""
Expand Down
6 changes: 3 additions & 3 deletions romancal/resample/tests/test_resample.py
Original file line number Diff line number Diff line change
Expand Up @@ -591,7 +591,7 @@ def test_var_flat_presence(exposure_1, include_var_flat):
if not include_var_flat:
exposure_1 = [e.copy() for e in exposure_1]
for e in exposure_1:
del e._instance['var_flat']
del e._instance["var_flat"]
input_models = ModelLibrary(exposure_1)
resample_data = ResampleData(input_models)

Expand All @@ -600,9 +600,9 @@ def test_var_flat_presence(exposure_1, include_var_flat):
output_model = output_models.borrow(0)

if not include_var_flat:
assert not hasattr(output_model, 'var_flat')
assert not hasattr(output_model, "var_flat")
else:
assert hasattr(output_model, 'var_flat')
assert hasattr(output_model, "var_flat")

output_models.shelve(output_model, 0, modify=False)

Expand Down

0 comments on commit 40fa1ca

Please sign in to comment.