Skip to content

Commit

Permalink
Merge pull request #491 from lsst/tickets/DM-41926
Browse files Browse the repository at this point in the history
DM-41926: Add "NONE" physical_filter for LSSTCam data
  • Loading branch information
jchiang87 committed Dec 5, 2023
2 parents 9e04ac5 + 0fe264d commit 46dde25
Show file tree
Hide file tree
Showing 4 changed files with 274 additions and 7 deletions.
24 changes: 17 additions & 7 deletions python/lsst/obs/lsst/filters.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,18 @@ def addFilter(filter_dict, band, physical_filter):
)


EmptyFilter = FilterDefinition(physical_filter="empty", band="white",
alias={"no_filter", "open"})
# Collection to handle the distinct cases where no filter is being used.
NoFilterCollection = FilterDefinitionCollection(
# For this case, no filter is being used and the optical path to
# the focal plane is unoccluded.
FilterDefinition(physical_filter="empty", band="white",
alias={"no_filter", "open"}),
# For this case, all filters are returned to the carousel and the
# auto-changer partially occludes the focal plane. See Tony
# Johnson's comment at https://jira.lsstcorp.org/browse/DM-41675.
FilterDefinition(physical_filter="none", band="white",
alias={"no_filter", "open"}),
)

# Generic filters used by PhoSim and UCDCam
LsstCamFiltersGeneric = FilterDefinitionCollection(
Expand Down Expand Up @@ -167,7 +177,7 @@ def addFilter(filter_dict, band, physical_filter):
}

CCOBFilters = []
for lsst_filter_def in (EmptyFilter, *LsstCamFiltersBaseline):
for lsst_filter_def in (*NoFilterCollection, *LsstCamFiltersBaseline):
lsstcam_filter = lsst_filter_def.physical_filter
if lsstcam_filter == "empty":
lsstcam_filter = ""
Expand Down Expand Up @@ -198,14 +208,14 @@ def addFilter(filter_dict, band, physical_filter):
# for all the BOT composite filters (i.e. "u~ND_OD1.0")
#
LSSTCAM_FILTER_DEFINITIONS = FilterDefinitionCollection(
EmptyFilter,
*NoFilterCollection,
*LsstCamFiltersBaseline,
*BOTFilters,
*CCOBFilters,
)

GENERIC_FILTER_DEFINITIONS = FilterDefinitionCollection(
EmptyFilter,
*NoFilterCollection,
*LsstCamFiltersGeneric,
)

Expand All @@ -218,7 +228,7 @@ def addFilter(filter_dict, band, physical_filter):
FilterDefinition(physical_filter="550CutOn")]

TS3_FILTER_DEFINITIONS = FilterDefinitionCollection(
EmptyFilter,
*NoFilterCollection,
*LsstCamFiltersGeneric,
*TS3Filters,
)
Expand All @@ -231,7 +241,7 @@ def addFilter(filter_dict, band, physical_filter):
FilterDefinition(physical_filter="550CutOn")]

TS8_FILTER_DEFINITIONS = FilterDefinitionCollection(
EmptyFilter,
*NoFilterCollection,
*LsstCamFiltersGeneric,
*LsstCamFiltersBaseline,
*TS8Filters,
Expand Down
3 changes: 3 additions & 0 deletions python/lsst/obs/lsst/translators/lsst.py
Original file line number Diff line number Diff line change
Expand Up @@ -673,6 +673,9 @@ def to_physical_filter(self):
if not joined:
joined = "unknown"

# Replace instances of "NONE" with "none".
joined = joined.replace("NONE", "none")

return joined

@cache_translation
Expand Down
253 changes: 253 additions & 0 deletions tests/headers/lsstCam_MC_C_20231125_000600_R12_S10.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,253 @@
SIMPLE: true
EXTEND: true
DATE: '2023-11-25T20:13:38.625'
MJD: 60273.842808159534
RUNNUM: '13593'
CCD_MANU: E2V
CCD_TYPE: CCD250
TESTTYPE: FLAT
IMGTYPE: FLAT
EXPTIME: 15.0
FILENAME: MC_C_20231125_000600_R12_S10.fits
BINX: 1
BINY: 1
CCDGAIN: 1.0
CCDNOISE: 10.0
DATE-OBS: '2023-11-25T20:13:20.472'
MJD-OBS: 60273.84259805549
DATE-TRG: '2023-11-25T20:13:38.616'
MJD-TRG: 60273.84280805569
IMAGETAG: 363e2b435c38c823
CCDSLOT: S10
RAFTBAY: R12
FIRMWARE: 3139500e
PLATFORM: ir2-camera
CONTNUM: 18ee2c4a
DAQVERS: R5-V6.9 2023-09-11T17:05:01Z (9eb7c3ed)
DAQPART: camera
DAQFOLD: raw
OBSANNOT: ''
OBSID: MC_C_20231125_000600
CAMCODE: MC
CONTRLLR: C
DAYOBS: '20231125'
SEQNUM: 600
HEADVER: 2
INSTRUME: lsstCam
TELESCOP: LSST
TSTAND: BOT
SEQFILE: FP_E2V_2s_ir2_v26.seq
SEQCKSUM: '1010041586'
LSST_NUM: E2V-CCD250-244
CCD_SERN: 16012-24-04
REBNAME: LCA-13574-027
RAFTNAME: LCA-11021_RTM-009
DARKTIME: 18.1514
TSEQNUM: 409
FPVERS: 1.2.5-SNAPSHOT
IHVERS: 1.1.5-SNAPSHOT
DATE-BEG: '2023-11-25T20:13:20.472'
MJD-BEG: 60273.84259805549
DATE-END: '2023-11-25T20:13:38.623'
MJD-END: 60273.84280813672
TIMESYS: TAI
FILTER: NONE
FILTER1: null
FILTER2: null
TEMPLED1: 35.0476
TEMPLED2: 34.3367
TEMPBRD: 38.4913
CCOBLED: uv
CCOBCURR: 0.273
CCOBADC: 8.8437
CCOBFLST: 14.1701
PROJTIME: 18.0383
CCOBFLUX: 75819.0
DATEPBEG: '2023-11-25T20:13:20.546'
MJDPBEG: 60273.84259891184
DATEPEND: '2023-11-25T20:13:38.584'
MJDPEND: 60273.842807685025
CATKW101: null
CATKW102: null
CATKW103: null
CATKW104: null
CATKW105: null
CATKW106: null
CATKW107: null
CATKW108: null
CATKW109: null
CATKW10A: null
CATKW10B: null
CATKW10C: null
CATKW10D: null
CATKW10E: null
CATKW10F: null
CATKW110: null
CATKW111: null
CATKW112: null
CATKW113: null
CATKW114: null
CATKW115: null
CATKW116: null
CATKW117: null
CATKW118: null
CATKW119: null
CATKW11A: null
CATKW11B: null
CATKW11C: null
CATKW11D: null
CATKW11E: null
CATKW11F: null
CATKW120: null
CATKW121: null
CATKW122: null
CATKW123: null
CATKW124: null
CATKW125: null
CATKW126: null
CATKW127: null
CATKW128: null
CATKW129: null
CATKW12A: null
CATKW12B: null
CATKW12C: null
CATKW12D: null
CATKW12E: null
CATKW130: null
CATKW131: null
CATKW132: null
XTENSION: BINTABLE
BITPIX: 8
NAXIS: 2
NAXIS1: 8
NAXIS2: 2048
PCOUNT: 1608930
GCOUNT: 1
TFIELD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CDELT1F: 1.0
CDELT2F: 1.0
CRPIX1F: 0.0
CRPIX2F: 0.0
CRVAL1F: 21052.5
CRVAL2F: 26000.0
WCSNAMEE: FP_SERPAR
CTYPE1E: FP_S
CTYPE2E: FP_P
PC1_1E: -1.0
PC1_2E: 0.0
PC2_1E: 0.0
PC2_2E: -1.0
CDELT1E: 1.0
CDELT2E: 1.0
CRPIX1E: 0.0
CRPIX2E: 0.0
CRVAL1E: 26000.0
CRVAL2E: 21052.5
WCSNAMEB: CCD_SERPAR
CTYPE1B: CCD_S
CTYPE2B: CCD_P
PC1_1B: -1.0
PC1_2B: 0.0
PC2_1B: 0.0
PC2_2B: -1.0
CDELT1B: 1.0
CDELT2B: 1.0
CRPIX1B: 0.0
CRPIX2B: 0.0
CRVAL1B: 523.0
CRVAL2B: 4005.0
WCSNAMEQ: RAFT_SERPAR
CTYPE1Q: RAFT_S
CTYPE2Q: RAFT_P
PC1_1Q: -1.0
PC1_2Q: 0.0
PC2_1Q: 0.0
PC2_2Q: -1.0
CDELT1Q: 1.0
CDELT2Q: 1.0
CRPIX1Q: 0.0
CRPIX2Q: 0.0
CRVAL1Q: 600.0
CRVAL2Q: 8352.5
BSCALE: 1.0
BZERO: 0.0
ZDATASUM: '299891638'
CHECKSUM: YlAKbi7KZiAKai5K
DATASUM: '887980064'
1 change: 1 addition & 0 deletions tests/test_filter_defs.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ def test_lsstCam_filterdefs(self):
"lsstCam-MC_C_20190319_000001_R22_S21.yaml",
"lsstCam-MC_C_20190322_000002_R10_S22.yaml",
"lsstCam-MC_C_20190406_000643_R10_S00.yaml",
"lsstCam_MC_C_20231125_000600_R12_S10.yaml",
)
for filename in test_data:
with self.subTest(f"Testing {filename}"):
Expand Down

0 comments on commit 46dde25

Please sign in to comment.