Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

remove logging manipulation during create_gridded_psf_model #1503

Merged
merged 2 commits into from
Nov 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading