Skip to content

Commit

Permalink
Add DeprecationWarnings to all remaining fov_grid methods
Browse files Browse the repository at this point in the history
  • Loading branch information
teutoburg committed Dec 18, 2023
1 parent 10fc1e6 commit 3983fe5
Show file tree
Hide file tree
Showing 8 changed files with 37 additions and 5 deletions.
8 changes: 5 additions & 3 deletions scopesim/effects/apertures.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
"""Effects related to field masks, including spectroscopic slits."""

from pathlib import Path
import logging
import warnings
import yaml

import numpy as np
Expand Down Expand Up @@ -126,7 +125,8 @@ def apply_to(self, obj, **kwargs):
# Outdated. Remove when removing all old FOVManager code from effects
def fov_grid(self, which="edges", **kwargs):
"""Return a header with the sky coordinates."""
logging.warning("DetectorList.fov_grid will be depreciated in v1.0")
warnings.warn("The fov_grid method is deprecated and will be removed "
"in a future release.", DeprecationWarning, stacklevel=2)
if which == "edges":
self.meta.update(kwargs)
return self.header
Expand Down Expand Up @@ -440,6 +440,8 @@ def apply_to(self, obj, **kwargs):

def fov_grid(self, which="edges", **kwargs):
"""See parent docstring."""
warnings.warn("The fov_grid method is deprecated and will be removed "
"in a future release.", DeprecationWarning, stacklevel=2)
return self.current_slit.fov_grid(which=which, **kwargs)

def change_slit(self, slitname=None):
Expand Down
5 changes: 3 additions & 2 deletions scopesim/effects/detector_list.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
"""TBA."""

import logging
import warnings

import numpy as np
from astropy import units as u
Expand Down Expand Up @@ -158,7 +158,8 @@ def apply_to(self, obj, **kwargs):

def fov_grid(self, which="edges", **kwargs):
"""Return an ApertureMask object. kwargs are "pixel_scale" [arcsec]."""
logging.warning("DetectorList.fov_grid will be depreciated in v1.0")
warnings.warn("The fov_grid method is deprecated and will be removed "
"in a future release.", DeprecationWarning, stacklevel=2)
aperture_mask = None
if which == "edges":
self.meta.update(kwargs)
Expand Down
6 changes: 6 additions & 0 deletions scopesim/effects/metis_lms_trace_list.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
"""SpectralTraceList and SpectralTrace for the METIS LM spectrograph."""

from copy import deepcopy
import warnings
import numpy as np
from scipy.interpolate import RectBivariateSpline

Expand Down Expand Up @@ -205,6 +206,11 @@ def fov_grid(self):
`x_max`, `y_max`. Spatial limits refer to the sky and are given in
arcsec.
"""
# TODO: Specify in the warning where the functionality should go!
warnings.warn("The fov_grid method is deprecated and will be removed "
"in a future release. The functionality should be moved"
" somewhere else.", DeprecationWarning, stacklevel=2)

aperture = self._file["Aperture list"].data[self.meta["slice"]]
x_min = aperture["left"]
x_max = aperture["right"]
Expand Down
7 changes: 7 additions & 0 deletions scopesim/effects/psfs.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import warnings
import numpy as np
from scipy.signal import convolve
from scipy.interpolate import RectBivariateSpline
Expand Down Expand Up @@ -118,6 +119,8 @@ def apply_to(self, obj, **kwargs):

def fov_grid(self, which="waveset", **kwargs):
"""See parent docstring."""
warnings.warn("The fov_grid method is deprecated and will be removed "
"in a future release.", DeprecationWarning, stacklevel=2)
waveset = []
if which == "waveset":
if self._waveset is not None:
Expand Down Expand Up @@ -210,6 +213,8 @@ def __init__(self, **kwargs):

def fov_grid(self, which="waveset", **kwargs):
"""See parent docstring."""
warnings.warn("The fov_grid method is deprecated and will be removed "
"in a future release.", DeprecationWarning, stacklevel=2)
if which == "waveset":
self.meta.update(kwargs)
self.meta = utils.from_currsys(self.meta)
Expand Down Expand Up @@ -312,6 +317,8 @@ def __init__(self, diameter, **kwargs):

def fov_grid(self, which="waveset", **kwargs):
"""See parent docstring."""
warnings.warn("The fov_grid method is deprecated and will be removed "
"in a future release.", DeprecationWarning, stacklevel=2)
wavelengths = []
if which == "waveset" and \
"waverange" in kwargs and \
Expand Down
5 changes: 5 additions & 0 deletions scopesim/effects/shifts.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import warnings
import numpy as np
from astropy import units as u
from astropy.table import Table
Expand All @@ -24,6 +25,8 @@ def apply_to(self, obj, **kwargs):

def fov_grid(self, which="shifts", **kwargs):
"""See parent docstring."""
warnings.warn("The fov_grid method is deprecated and will be removed "
"in a future release.", DeprecationWarning, stacklevel=2)
if which == "shifts":
col_names = ["wavelength", "dx", "dy"]
waves, dx, dy = [self.get_table(**kwargs)[col]
Expand Down Expand Up @@ -222,6 +225,8 @@ def apply_to(self, fov, **kwargs):

def fov_grid(self, which="shifts", **kwargs):
"""See parent docstring."""
warnings.warn("The fov_grid method is deprecated and will be removed "
"in a future release.", DeprecationWarning, stacklevel=2)
kwargs.update(self.meta)
if "quick_adc" in self.meta:
ad = AtmosphericDispersion(**self.meta)
Expand Down
3 changes: 3 additions & 0 deletions scopesim/effects/spectral_trace_list_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
"""

import logging
import warnings

import numpy as np

Expand Down Expand Up @@ -94,6 +95,8 @@ def fov_grid(self):
Spatial limits are determined by the `ApertureMask` effect
and are not returned here.
"""
warnings.warn("The fov_grid method is deprecated and will be removed "
"in a future release.", DeprecationWarning, stacklevel=2)
aperture_id = self.meta["aperture_id"]
lam_arr = self.table[self.meta["wave_colname"]]

Expand Down
3 changes: 3 additions & 0 deletions scopesim/effects/surface_list.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
"""TBA."""

import warnings
import numpy as np
from astropy import units as u

Expand All @@ -26,6 +27,8 @@ def __init__(self, **kwargs):
self._emission = None

def fov_grid(self, which="waveset", **kwargs):
warnings.warn("The fov_grid method is deprecated and will be removed "
"in a future release.", DeprecationWarning, stacklevel=2)
wave_edges = []
if which == "waveset":
self.meta.update(kwargs)
Expand Down
5 changes: 5 additions & 0 deletions scopesim/effects/ter_curves.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
"""Transmission, emissivity, reflection curves."""

import warnings
import logging
from collections.abc import Collection

Expand Down Expand Up @@ -407,6 +408,8 @@ def __init__(self, **kwargs):
self.table["transmission"][mask] = 0

def fov_grid(self, which="waveset", **kwargs):
warnings.warn("The fov_grid method is deprecated and will be removed "
"in a future release.", DeprecationWarning, stacklevel=2)
if which == "waveset":
self.meta.update(kwargs)
self.meta = from_currsys(self.meta)
Expand Down Expand Up @@ -580,6 +583,8 @@ def apply_to(self, obj, **kwargs):
return self.current_filter.apply_to(obj, **kwargs)

def fov_grid(self, which="waveset", **kwargs):
warnings.warn("The fov_grid method is deprecated and will be removed "
"in a future release.", DeprecationWarning, stacklevel=2)
return self.current_filter.fov_grid(which=which, **kwargs)

def change_filter(self, filtername=None):
Expand Down

0 comments on commit 3983fe5

Please sign in to comment.