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

Don't fail on uncritical nonexisting item #395

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft
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
11 changes: 9 additions & 2 deletions scopesim/effects/fits_headers.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,10 @@
from astropy.table import Table

from . import Effect
from ..utils import from_currsys, find_file
from ..utils import from_currsys, find_file, get_logger


logger = get_logger(__name__)


class ExtraFitsKeywords(Effect):
Expand Down Expand Up @@ -360,7 +363,11 @@
raise ValueError("An OpticsManager object must be "
"passed in order to resolve "
"#-strings")
value = optics_manager[value]
try:
value = optics_manager[value]
except ValueError as err:
logger.warning("Skipping %s, got error %s", value, err)
value = "<unavailable>"

Check warning on line 370 in scopesim/effects/fits_headers.py

View check run for this annotation

Codecov / codecov/patch

scopesim/effects/fits_headers.py#L368-L370

Added lines #L368 - L370 were not covered by tests

if isinstance(value, u.Quantity):
comment = f"[{str(value.unit)}] {comment}"
Expand Down
Loading