Skip to content

Commit

Permalink
Merge pull request #363 from AstarVienna/fh/depends
Browse files Browse the repository at this point in the history
Some small dependency- and version-related changes
  • Loading branch information
teutoburg committed Feb 7, 2024
2 parents b98f39f + 17a3396 commit 00c9922
Show file tree
Hide file tree
Showing 11 changed files with 53 additions and 395 deletions.
62 changes: 27 additions & 35 deletions poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 5 additions & 5 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,9 @@ more-itertools = "^10.1.0"
tqdm = "^4.66.1"

synphot = "^1.2.1"
skycalc_ipy = "^0.3.0"
anisocado = "^0.3.0"
astar-utils = {version = "^0.2.0b1", allow-prereleases = true}
skycalc_ipy = ">=0.4.0"
anisocado = ">=0.3.0"
astar-utils = ">=0.2.0"

[tool.poetry.group.dev]
optional = true
Expand All @@ -50,7 +50,7 @@ ipykernel = "^6.24.0"
[tool.poetry.group.test.dependencies]
pytest = "^7.4.3"
pytest-cov = "^4.1.0"
scopesim_templates = "^0.5.0"
scopesim_templates = ">=0.5.1"
# Just so that readthedocs doesn't include the tests module - yes it's hacky
skycalc_cli = "*"
ipykernel = "^6.24.0"
Expand All @@ -65,7 +65,7 @@ jupyter-sphinx = "^0.2.3"
sphinxcontrib-apidoc = "^0.4.0"
nbsphinx = "^0.9.3"
numpydoc = "^1.6.0"
scopesim_templates = "^0.5.0"
scopesim_templates = ">=0.5.1"
ipykernel = "^6.24.0"

[tool.poetry.urls]
Expand Down
2 changes: 1 addition & 1 deletion scopesim/commands/user_commands.py
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ class UserCommands:
Attributes
----------
cmds : SystemDict
cmds : NestedMapping
Built from the ``properties`` dictionary of a yaml dictionary. All
values here are accessible globally by all ``Effects`` objects in an
``OpticalTrain`` once the ``UserCommands`` has been passed to the
Expand Down
4 changes: 2 additions & 2 deletions scopesim/effects/effects.py
Original file line number Diff line number Diff line change
Expand Up @@ -312,13 +312,13 @@ def __getitem__(self, item):
if isinstance(item, str) and item.startswith("#"):
if len(item) > 1:
if item.endswith("!"):
key = item[1:-1]
key = item.removeprefix("#").removesuffix("!")
if len(key) > 0:
value = from_currsys(self.meta[key], self.cmds)
else:
value = from_currsys(self.meta, self.cmds)
else:
value = self.meta[item[1:]]
value = self.meta[item.removeprefix("#")]
else:
value = self.meta
else:
Expand Down
7 changes: 3 additions & 4 deletions scopesim/optics/image_plane_utils.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
# -*- coding: utf-8 -*-

from typing import Tuple
from itertools import product
from collections.abc import Iterable

Expand Down Expand Up @@ -157,7 +156,7 @@ def _make_bounding_header_for_tables(*tables, pixel_scale=1*u.arcsec):

def create_wcs_from_points(points: np.ndarray,
pixel_scale: float,
wcs_suffix: str = "") -> Tuple[WCS, np.ndarray]:
wcs_suffix: str = "") -> tuple[WCS, np.ndarray]:
"""
Create `astropy.wcs.WCS` instance that fits all points inside.
Expand Down Expand Up @@ -1034,7 +1033,7 @@ def _get_unit_from_headers(*headers, wcs_suffix: str = "") -> str:
def det_wcs_from_sky_wcs(sky_wcs: WCS,
pixel_scale: float,
plate_scale: float,
naxis=None) -> Tuple[WCS, np.ndarray]:
naxis=None) -> tuple[WCS, np.ndarray]:
"""
Create detector WCS from celestial WCS using pixel and plate scales.
Expand Down Expand Up @@ -1081,7 +1080,7 @@ def det_wcs_from_sky_wcs(sky_wcs: WCS,
def sky_wcs_from_det_wcs(det_wcs: WCS,
pixel_scale: float,
plate_scale: float,
naxis=None) -> Tuple[WCS, np.ndarray]:
naxis=None) -> tuple[WCS, np.ndarray]:
"""
Create celestial WCS from detector WCS using pixel and plate scales.
Expand Down
4 changes: 2 additions & 2 deletions scopesim/optics/optical_train.py
Original file line number Diff line number Diff line change
Expand Up @@ -132,8 +132,8 @@ def load(self, user_commands):

self.cmds = user_commands
# FIXME: Setting rc.__currsys__ to user_commands causes many problems:
# UserCommands used SystemDict internally, but is itself not an
# instance or subclas thereof. So rc.__currsys__ actually
# UserCommands used NestedMapping internally, but is itself not
# an instance or subclas thereof. So rc.__currsys__ actually
# changes type as a result of this line. On one hand, some other
# code relies on this change, i.e. uses attributes from
# UserCommands via rc.__currsys__, but on the other hand some
Expand Down
4 changes: 2 additions & 2 deletions scopesim/rc.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

from copy import deepcopy

from .system_dict import SystemDict, UniqueList
from astar_utils import NestedMapping, UniqueList

__pkg_dir__ = Path(__file__).parent

Expand All @@ -21,7 +21,7 @@
pass


__config__ = SystemDict(dicts)
__config__ = NestedMapping(dicts, title="SystemDict")
__currsys__ = deepcopy(__config__)

# Order matters!
Expand Down
20 changes: 10 additions & 10 deletions scopesim/server/example_data_utils.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
# -*- coding: utf-8 -*-
"""
Store the example data functions here instead of polluting database.py
"""
"""Store the example data functions here instead of polluting database.py."""

import shutil
from pathlib import Path
from typing import List, Optional, Union, Iterable
from typing import Optional, Union
from collections.abc import Iterable

import httpx
import bs4
Expand All @@ -14,9 +13,10 @@

from scopesim import rc

def get_server_elements(url: str, unique_str: str = "/") -> List[str]:

def get_server_elements(url: str, unique_str: str = "/") -> list[str]:
"""
Returns a list of file and/or directory paths on the HTTP server ``url``
Return a list of file and/or directory paths on the HTTP server ``url``.
Parameters
----------
Expand Down Expand Up @@ -52,9 +52,9 @@ def get_server_elements(url: str, unique_str: str = "/") -> List[str]:

def list_example_data(url: Optional[str] = None,
return_files: bool = False,
silent: bool = False) -> List[str]:
silent: bool = False) -> list[str]:
"""
List all example files found under ``url``
List all example files found under ``url``.
Parameters
----------
Expand Down Expand Up @@ -102,9 +102,9 @@ def print_file_list(the_files, loc=""):
def download_example_data(file_path: Union[Iterable[str], str],
save_dir: Optional[Union[Path, str]] = None,
url: Optional[str] = None,
from_cache: Optional[bool] = None) -> List[Path]:
from_cache: Optional[bool] = None) -> list[Path]:
"""
Downloads example fits files to the local disk
Download example fits files to the local disk.
Parameters
----------
Expand Down
Loading

0 comments on commit 00c9922

Please sign in to comment.