Skip to content

Commit 09dbddc

Browse files
Merge pull request #134 from lsst-sitcom/tickets/DM-47888
DM-47888: Add bandpass corrections for ComCam and rename function to be accurate
2 parents 2cf903f + 610c80c commit 09dbddc

File tree

2 files changed

+65
-8
lines changed

2 files changed

+65
-8
lines changed

python/lsst/summit/utils/utils.py

Lines changed: 45 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@
3333
from astropy.coordinates.earth import EarthLocation
3434
from astropy.time import Time
3535
from dateutil.tz import gettz
36+
from deprecated.sphinx import deprecated
3637
from matplotlib.patches import Rectangle
3738
from scipy.ndimage import gaussian_filter
3839

@@ -85,7 +86,8 @@
8586
"obsInfoToDict",
8687
"getFieldNameAndTileNumber",
8788
"getAirmassSeeingCorrection",
88-
"getFilterSeeingCorrection",
89+
"getFilterSeeingCorrection", # deprecated
90+
"getBandpassSeeingCorrection",
8991
"getCdf",
9092
"getQuantiles",
9193
"digitizeData",
@@ -975,9 +977,34 @@ def getAirmassSeeingCorrection(airmass: float) -> float:
975977
return airmass ** (-0.6)
976978

977979

980+
@deprecated(
981+
reason=". Will be removed after v28.0.",
982+
version="v27.0",
983+
category=FutureWarning,
984+
)
978985
def getFilterSeeingCorrection(filterName: str) -> float:
979986
"""Get the correction factor for seeing due to a filter.
980987
988+
Parameters
989+
----------
990+
filterName : `str`
991+
The name of the filter, e.g. 'SDSSg_65mm'.
992+
993+
Returns
994+
-------
995+
correctionFactor : `float`
996+
The correction factor to apply to the seeing.
997+
998+
Raises
999+
------
1000+
ValueError raised for unknown filters.
1001+
"""
1002+
return getBandpassSeeingCorrection(filterName)
1003+
1004+
1005+
def getBandpassSeeingCorrection(filterName: str) -> float:
1006+
"""Get the correction factor for seeing due to a filter.
1007+
9811008
Parameters
9821009
----------
9831010
filterName : `str`
@@ -993,16 +1020,28 @@ def getFilterSeeingCorrection(filterName: str) -> float:
9931020
ValueError raised for unknown filters.
9941021
"""
9951022
match filterName:
996-
case "SDSSg_65mm":
1023+
case "SDSSg_65mm": # LATISS
9971024
return (474.41 / 500.0) ** 0.2
998-
case "SDSSr_65mm":
1025+
case "SDSSr_65mm": # LATISS
9991026
return (628.47 / 500.0) ** 0.2
1000-
case "SDSSi_65mm":
1027+
case "SDSSi_65mm": # LATISS
10011028
return (769.51 / 500.0) ** 0.2
1002-
case "SDSSz_65mm":
1029+
case "SDSSz_65mm": # LATISS
10031030
return (871.45 / 500.0) ** 0.2
1004-
case "SDSSy_65mm":
1031+
case "SDSSy_65mm": # LATISS
10051032
return (986.8 / 500.0) ** 0.2
1033+
case "u_02": # ComCam
1034+
return (370.697 / 500.0) ** 0.2
1035+
case "g_01": # ComCam
1036+
return (476.359 / 500.0) ** 0.2
1037+
case "r_03": # ComCam
1038+
return (619.383 / 500.0) ** 0.2
1039+
case "i_06": # ComCam
1040+
return (754.502 / 500.0) ** 0.2
1041+
case "z_03": # ComCam
1042+
return (866.976 / 500.0) ** 0.2
1043+
case "y_04": # ComCam
1044+
return (972.713 / 500.0) ** 0.2
10061045
case _:
10071046
raise ValueError(f"Unknown filter name: {filterName}")
10081047

tests/test_utils.py

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,18 +42,19 @@
4242
from lsst.obs.base.makeRawVisitInfoViaObsInfo import MakeRawVisitInfoViaObsInfo
4343
from lsst.obs.lsst import Latiss
4444
from lsst.obs.lsst.translators.latiss import AUXTEL_LOCATION
45+
from lsst.summit.utils.utils import getFilterSeeingCorrection # deprecated
4546
from lsst.summit.utils.utils import (
4647
calcEclipticCoords,
4748
computeCcdExposureId,
4849
computeExposureId,
4950
fluxesFromFootprints,
5051
getAirmassSeeingCorrection,
52+
getBandpassSeeingCorrection,
5153
getCurrentDayObs_datetime,
5254
getCurrentDayObs_humanStr,
5355
getCurrentDayObs_int,
5456
getExpPositionOffset,
5557
getFieldNameAndTileNumber,
56-
getFilterSeeingCorrection,
5758
getQuantiles,
5859
quickSmooth,
5960
)
@@ -189,7 +190,24 @@ def test_getAirmassSeeingCorrection(self):
189190

190191
def test_getFilterSeeingCorrection(self):
191192
for filterName in ("SDSSg_65mm", "SDSSr_65mm", "SDSSi_65mm"):
192-
correction = getFilterSeeingCorrection(filterName)
193+
with self.assertWarns(FutureWarning):
194+
correction = getFilterSeeingCorrection(filterName)
195+
self.assertGreater(correction, 0.5)
196+
self.assertLess(correction, 1.5)
197+
198+
def test_getBandpassSeeingCorrection(self):
199+
for filterName in (
200+
"SDSSg_65mm",
201+
"SDSSr_65mm",
202+
"SDSSi_65mm",
203+
"u_02",
204+
"g_01",
205+
"r_03",
206+
"i_06",
207+
"z_03",
208+
"y_04",
209+
):
210+
correction = getBandpassSeeingCorrection(filterName)
193211
self.assertGreater(correction, 0.5)
194212
self.assertLess(correction, 1.5)
195213

0 commit comments

Comments
 (0)