Skip to content

Commit

Permalink
remove logging manipulation during create_gridded_psf_model (#1503)
Browse files Browse the repository at this point in the history
  • Loading branch information
braingram authored Nov 12, 2024
2 parents 088212b + 1a88241 commit 8a04f5a
Show file tree
Hide file tree
Showing 5 changed files with 2 additions and 16 deletions.
1 change: 1 addition & 0 deletions changes/1503.source_detection.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Don't restart loggers during create_gridded_psf_model.
14 changes: 1 addition & 13 deletions romancal/lib/psf.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
from photutils.psf import IterativePSFPhotometry, PSFPhotometry, SourceGrouper
from roman_datamodels.datamodels import ImageModel
from roman_datamodels.dqflags import pixel
from webbpsf import conf, gridded_library, restart_logging
from webbpsf import gridded_library

__all__ = [
"create_gridded_psf_model",
Expand Down Expand Up @@ -60,7 +60,6 @@ def create_gridded_psf_model(
sqrt_n_psfs=2,
buffer_pixels=100,
instrument_options=None,
logging_level=None,
):
"""
Compute a gridded PSF model for one SCA via
Expand Down Expand Up @@ -90,9 +89,6 @@ def create_gridded_psf_model(
For example, WebbPSF assumes Roman pointing jitter consistent with
mission specs by default, but this can be turned off with:
``{'jitter': None, 'jitter_sigma': 0}``.
logging_level : str, optional
Set logging level by name if not `None`, otherwise inherit from
the romancal logger.
Returns
-------
Expand Down Expand Up @@ -126,14 +122,6 @@ def create_gridded_psf_model(
# generate PSFs over a grid of detector positions [pix]
model_psf_centroids = [(int(x), int(y)) for y in pixel_range for x in pixel_range]

if logging_level is None:
# pass along logging level from __name__'s logger to WebbPSF:
logging_level = logging.getLevelName(log.level)

# set the WebbPSF logging level (similar to webbpsf.utils.setup_logging):
conf.logging_level = logging_level
restart_logging(verbose=False)

wfi = webbpsf.roman.WFI()
wfi.filter = filt

Expand Down
1 change: 0 additions & 1 deletion romancal/lib/tests/test_psf.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,6 @@ def setup_inputs(
webbpsf_config["detector"],
oversample=webbpsf_config["oversample"],
fov_pixels=webbpsf_config["fov_pixels"],
logging_level="ERROR",
)

return mod, webbpsf_config, psf_model
Expand Down
1 change: 0 additions & 1 deletion romancal/source_catalog/source_catalog.py
Original file line number Diff line number Diff line change
Expand Up @@ -1145,7 +1145,6 @@ def do_psf_photometry(self) -> None:
gridded_psf_model, _ = psf.create_gridded_psf_model(
filt=filt,
detector=detector,
logging_level="ERROR",
)

log.info("Fitting a PSF model to sources for improved astrometric precision.")
Expand Down
1 change: 0 additions & 1 deletion romancal/source_detection/source_detection_step.py
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,6 @@ def process(self, input):
gridded_psf_model, _ = psf.create_gridded_psf_model(
filt=filt,
detector=detector,
logging_level="ERROR",
)

log.info(
Expand Down

0 comments on commit 8a04f5a

Please sign in to comment.