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 mairanteodoro committed Oct 23, 2024
1 parent d5444af commit b4c9108
Show file tree
Hide file tree
Showing 5 changed files with 6 additions and 13 deletions.
5 changes: 1 addition & 4 deletions romancal/photom/tests/test_photom.py
Original file line number Diff line number Diff line change
Expand Up @@ -252,9 +252,7 @@ def test_photom_step_interface_spectroscopic(instrument, exptype):
wfi_image.meta.instrument.optical_element = "PRISM"

# Set photometric values for spectroscopic data
wfi_image.meta.photometry.pixel_area = (
2.31307642258977e-14 * u.steradian
).value
wfi_image.meta.photometry.pixel_area = (2.31307642258977e-14 * u.steradian).value
wfi_image.meta.photometry.conversion_megajanskys = (
-99999 * u.megajansky / u.steradian
).value
Expand All @@ -279,4 +277,3 @@ def test_photom_step_interface_spectroscopic(instrument, exptype):
assert result.meta.photometry.conversion_megajanskys is None
assert result.meta.photometry.conversion_megajanskys_uncertainty is None
assert result.meta.photometry.pixel_area is None

2 changes: 1 addition & 1 deletion romancal/resample/resample.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
from astropy import units as u
from astropy.coordinates import SkyCoord
from drizzle import cdrizzle, util
from roman_datamodels import datamodels, maker_utils, stnode
from roman_datamodels import datamodels, maker_utils
from stcal.alignment.util import compute_scale

from romancal.associations.asn_from_list import asn_from_list
Expand Down
6 changes: 2 additions & 4 deletions romancal/resample/resample_step.py
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ def _final_updates(self, model, input_models, kwargs):
# calculate the actual value of pixel_scale_ratio based on pixel_scale
# because source_catalog uses this value from the header.
model.meta.resample.pixel_scale_ratio = (
self.pixel_scale / np.sqrt((model.meta.photometry.pixel_area * 4.254517e10))
self.pixel_scale / np.sqrt(model.meta.photometry.pixel_area * 4.254517e10)
if self.pixel_scale
else self.pixel_scale_ratio
)
Expand Down Expand Up @@ -241,9 +241,7 @@ def _load_custom_wcs(asdf_wcs_file, output_shape):
def update_phot_keywords(self, model):
"""Update pixel scale keywords"""
if model.meta.photometry.pixel_area is not None:
model.meta.photometry.pixel_area *= (
model.meta.resample.pixel_scale_ratio**2
)
model.meta.photometry.pixel_area *= model.meta.resample.pixel_scale_ratio**2

def set_drizzle_defaults(self):
"""Set the default parameters for drizzle."""
Expand Down
4 changes: 1 addition & 3 deletions romancal/resample/tests/test_resample_step.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,7 @@

class MockModel:
def __init__(self, pixel_area, pixel_scale_ratio):
self.meta = MockMeta(
pixel_area, pixel_scale_ratio
)
self.meta = MockMeta(pixel_area, pixel_scale_ratio)


class MockMeta:
Expand Down
2 changes: 1 addition & 1 deletion romancal/saturation/tests/test_saturation.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
import numpy as np
import pytest
from roman_datamodels import maker_utils
from roman_datamodels.datamodels import ScienceRawModel, RampModel
from roman_datamodels.datamodels import RampModel, ScienceRawModel
from roman_datamodels.dqflags import group, pixel

from romancal.saturation import SaturationStep
Expand Down

0 comments on commit b4c9108

Please sign in to comment.