Skip to content

Commit

Permalink
Add SDSS_65mm filter options to grating slot for LATISS.
Browse files Browse the repository at this point in the history
  • Loading branch information
edennihy authored and Snyder005 committed Oct 11, 2023
1 parent c9a3079 commit 4218d2b
Showing 1 changed file with 45 additions and 22 deletions.
67 changes: 45 additions & 22 deletions python/lsst/obs/lsst/filters.py
Original file line number Diff line number Diff line change
Expand Up @@ -234,6 +234,23 @@ def addFilter(filter_dict, band, physical_filter):

# LATISS filters include a grating in the name so we need to construct
# filters for each combination of filter+grating.

# This set of filters can be installed in either the grating or filter wheel,
# so we define them here to avoid duplication.
sdss65mm_filters = [FilterDefinition(physical_filter="SDSSu_65mm",
band="u"),
FilterDefinition(physical_filter="SDSSg_65mm",
band="g"),
FilterDefinition(physical_filter="SDSSr_65mm",
band="r"),
FilterDefinition(physical_filter="SDSSi_65mm",
band="i"),
FilterDefinition(physical_filter="SDSSz_65mm",
band="z"),
FilterDefinition(physical_filter="SDSSy_65mm",
band="y"),
]

_latiss_filters = (
FilterDefinition(physical_filter="empty",
band="white",
Expand Down Expand Up @@ -279,25 +296,15 @@ def addFilter(filter_dict, band, physical_filter):
band="r"),
FilterDefinition(physical_filter="SDSSi",
band="i"),
FilterDefinition(physical_filter="SDSSu_65mm",
band="u"),
FilterDefinition(physical_filter="SDSSg_65mm",
band="g"),
FilterDefinition(physical_filter="SDSSr_65mm",
band="r"),
FilterDefinition(physical_filter="SDSSi_65mm",
band="i"),
FilterDefinition(physical_filter="SDSSz_65mm",
band="z"),
FilterDefinition(physical_filter="SDSSy_65mm",
band="y"),
FilterDefinition(physical_filter="collimator",
band="white"),
FilterDefinition(physical_filter="cyl_lens",
band="white"),
*sdss65mm_filters,
)

# Form a new set of filter definitions from all the explicit gratings
# Form a new set of filter definitions from all the explicit gratings, and add
# sdss65mm_filter set.
_latiss_gratings = ("ronchi90lpmm",
"ronchi170lpmm",
"empty",
Expand Down Expand Up @@ -325,6 +332,7 @@ def addFilter(filter_dict, band, physical_filter):
"pinhole_2_4_0500",
"pinhole_2_4_0200",
"pinhole_2_4_0100",
*sdss65mm_filters,
)

# Include the filters without the grating in case someone wants
Expand All @@ -338,17 +346,32 @@ def addFilter(filter_dict, band, physical_filter):
if filter.physical_filter == "diffuser":
continue

# FilterDefinition is a frozen dataclass
new_name = FILTER_DELIMITER.join([filter.physical_filter, grating])
# If the grating is a FilterDefinition, use the band and alias
# attributes defined in the grating for the new, combined
# FilterDefinition. In addition, filter out any combinations that do
# not use the "empty" filter in combination with a grating that is a
# FitlerDefintion as we should never combine multiple filters in real
# observations.
if isinstance(grating, FilterDefinition):
if filter.physical_filter != "empty":
continue

new_name = FILTER_DELIMITER.join([filter.physical_filter, grating.physical_filter])
new_aliases = {FILTER_DELIMITER.join([filter.physical_filter, a]) for a in grating.alias}

combo = FilterDefinition(physical_filter=new_name,
band=grating.band,
afw_name=grating.afw_name,
alias=new_aliases)
else:
new_name = FILTER_DELIMITER.join([filter.physical_filter, grating])
new_aliases = {FILTER_DELIMITER.join([a, grating]) for a in filter.alias}

# Also need to update aliases
new_aliases = {FILTER_DELIMITER.join([a, grating]) for a in filter.alias}
combo = FilterDefinition(physical_filter=new_name,
band=filter.band,
afw_name=filter.afw_name,
alias=new_aliases)

# For gratings set the band to the band of the filter
combo = FilterDefinition(physical_filter=new_name,
band=filter.band,
afw_name=filter.afw_name,
alias=new_aliases)
_latiss_filter_and_grating.append(combo)


Expand Down

0 comments on commit 4218d2b

Please sign in to comment.