Skip to content

Commit

Permalink
Avoid circular import
Browse files Browse the repository at this point in the history
  • Loading branch information
teutoburg committed Jan 31, 2024
1 parent 3f422d8 commit cfc9b89
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 13 deletions.
22 changes: 12 additions & 10 deletions scopesim/__init__.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,23 @@
"""Generalised telescope observation simulator."""

from importlib import metadata

###############################################################################
# VERSION INFORMATION #
###############################################################################

try:
__version__ = metadata.version(__package__)
except metadata.PackageNotFoundError:
__version__ = "undetermined"

Check warning on line 12 in scopesim/__init__.py

View check run for this annotation

Codecov / codecov/patch

scopesim/__init__.py#L11-L12

Added lines #L11 - L12 were not covered by tests


###############################################################################
# TURN OFF WARNINGS #
###############################################################################

import warnings
import yaml
from importlib import metadata
from astropy.utils.exceptions import AstropyWarning

warnings.simplefilter('ignore', UserWarning)
Expand Down Expand Up @@ -58,12 +69,3 @@
list_example_data, download_example_data)

from .tests.mocks.load_basic_instrument import load_example_optical_train

###############################################################################
# VERSION INFORMATION #
###############################################################################

try:
__version__ = metadata.version(__package__)
except metadata.PackageNotFoundError:
__version__ = "undetermined"
5 changes: 2 additions & 3 deletions scopesim/optics/optical_train.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,7 @@
from ..detector import DetectorArray
from ..effects import ExtraFitsKeywords
from ..utils import from_currsys, top_level_catch
from ..version import version
from .. import rc
from .. import rc, __version__


class OpticalTrain:
Expand Down Expand Up @@ -353,7 +352,7 @@ def write_header(self, hdulist):
# Primary hdu
pheader = hdulist[0].header
pheader["DATE"] = datetime.now().isoformat(timespec="seconds")
pheader["ORIGIN"] = "Scopesim " + version
pheader["ORIGIN"] = f"Scopesim {__version__}"
pheader["INSTRUME"] = from_currsys("!OBS.instrument")
pheader["INSTMODE"] = ", ".join(from_currsys("!OBS.modes"))
pheader["TELESCOP"] = from_currsys("!TEL.telescope")
Expand Down

0 comments on commit cfc9b89

Please sign in to comment.