Skip to content

Commit

Permalink
Merge pull request #532 from lsst/tickets/DM-43568
Browse files Browse the repository at this point in the history
DM-43568: Add support for can_see_sky metadata translation
  • Loading branch information
timj authored Jun 26, 2024
2 parents cbcdee4 + eb11eb9 commit c8eeb7c
Show file tree
Hide file tree
Showing 10 changed files with 977 additions and 0 deletions.
1 change: 1 addition & 0 deletions python/lsst/obs/lsst/translators/comCamSim.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ class LsstComCamSimTranslator(LsstCamTranslator):

_const_map = {
"instrument": "LSSTComCamSim",
"has_simulated_content": True,
}

cameraPolicyFile = 'policy/comCamSim.yaml'
Expand Down
24 changes: 24 additions & 0 deletions python/lsst/obs/lsst/translators/lsst.py
Original file line number Diff line number Diff line change
Expand Up @@ -969,6 +969,7 @@ def to_has_simulated_content(self):
# true value implies that something in the data is simulated.
for k, v in self._header.items():
if "SIMULATE" in k and v:
self._used_these_cards(k)
return True

# If the controller is H, P, S, or Q then the data are simulated.
Expand All @@ -994,6 +995,7 @@ def to_pressure(self):
key = "PRESSURE"
if self.is_key_ok(key):
value = self._header[key]
self._used_these_cards(key)
# There has been an inconsistency in units for the pressure reading
# so we need to adjust for this.
if value > 10_000:
Expand All @@ -1008,5 +1010,27 @@ def to_pressure(self):
def to_temperature(self):
key = "AIRTEMP"
if self.is_key_ok(key):
self._used_these_cards(key)
return self._header[key] * u.deg_C
return None

@cache_translation
def to_can_see_sky(self) -> bool | None:
key = "SHUTTIME"
if self.is_key_ok(key) and self._header[key] == 0.0:
# Shutter never opened so impossible to see sky.
self._used_these_cards(key)
return False

key = "VIGN_MIN"
if self.is_key_ok(key):
self._used_these_cards(key)
vignetted = self._header[key]
if vignetted == "FULLY":
return False
return True

# Fallback to using the observation type if the key is missing.
# May not want to allow this for non-simulated cameras after
# comcam goes on sky.
return super().to_can_see_sky()
1 change: 1 addition & 0 deletions python/lsst/obs/lsst/translators/lsstCamSim.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ class LsstCamSimTranslator(LsstCamTranslator):

_const_map = {
"instrument": "LSSTCamSim",
"has_simulated_content": True,
}

cameraPolicyFile = "policy/lsstCamSim.yaml"
Expand Down
1 change: 1 addition & 0 deletions python/lsst/obs/lsst/translators/lsst_ucdcam.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ class LsstUCDCamTranslator(LsstBaseTranslator):
"relative_humidity": None,
"temperature": None,
"pressure": None,
"can_see_sky": False,
}

_trivial_map = {
Expand Down
1 change: 1 addition & 0 deletions python/lsst/obs/lsst/translators/ts3.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ class LsstTS3Translator(LsstBaseTranslator):
"temperature": None,
"pressure": None,
"detector_name": _DETECTOR_NAME, # Single sensor
"can_see_sky": False,
}

_trivial_map = {
Expand Down
1 change: 1 addition & 0 deletions python/lsst/obs/lsst/translators/ts8.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ class LsstTS8Translator(LsstBaseTranslator):
"relative_humidity": None,
"temperature": None,
"pressure": None,
"can_see_sky": False,
}

_trivial_map = {
Expand Down
269 changes: 269 additions & 0 deletions tests/headers/latiss-AT_O_20240624_000106_R00_S00-patched.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,269 @@
# Patched header to declare this is a normal science observation that
# was fully vignetted.
SIMPLE: true
EXTEND: true
CCD_MANU: ITL
CCD_TYPE: 3800C
BINX: 1
BINY: 1
CCDGAIN: 1.0
CCDNOISE: 10.0
CCDSLOT: S00
RAFTBAY: R00
FIRMWARE: '11394008'
PLATFORM: auxtel
CONTNUM: 189216ee
DAQVERS: R5-V8.1 2023-12-05T02:49:12Z (5acbb461)
DAQPART: lat
DAQFOLD: raw
SEQFILE: FP_ITL_2s_ir2_v26_no_RG.seq
SEQNAME: FP_ITL_2s_ir2_v26_no_RG.seq
SEQCKSUM: '1477162166'
LSST_NUM: ITL-3800C-068
CCD_SERN: '20862'
REBNAME: Unknown
RAFTNAME: AuxTel-Raft
FPVERS: 1.2.7
IHVERS: 1.1.5
STUTTER ROWS: 0
STUTTER DELAY: 0.0
STUTTER NSHIFTS: 0
FILTPOS: null
CCDTEMP: -101.024
COMMENT: '---- Checksums ----'
DATE: '2024-06-25T01:28:25.400'
MJD: 60486.06140509248
IMGTYPE: OBJECT
DATE-OBS: '2024-06-25T01:27:55.160'
MJD-OBS: 60486.06105509261
DATE-TRG: '2024-06-25T01:28:25.395'
MJD-TRG: 60486.061405034736
OBSID: AT_O_20240624_000106
DATE-BEG: '2024-06-25T01:27:55.160'
MJD-BEG: 60486.06105509261
DATE-END: '2024-06-25T01:28:25.400'
MJD-END: 60486.06140509248
GROUPID: 2024-06-25T01:26:31.895#1
BUNIT: adu
TIMESYS: TAI
INSTRUME: LATISS
TELESCOP: LSST AuxTelescope
OBS-LONG: -70.7476862
OBS-LAT: -30.2447889
OBS-ELEV: 2663.0
OBSGEO-X: 1819093.52
OBSGEO-Y: -5208408.1
OBSGEO-Z: 3195186.45
FACILITY: Vera C. Rubin Observatory
RA: 223.77366208333333
DEC: -20.01348777777778
RASTART: 223.77379669301
DECSTART: -20.013429451065846
RAEND: 223.77382195537703
DECEND: -20.013749612906178
ROTPA: 98.63385126206754
ROTCOORD: sky
HASTART: 0.042468393994478826
ELSTART: 79.85583534052326
AZSTART: -3.3659773360866496
AMSTART: 1.0156209056522223
AHAEND: null
AELEND: null
AAZEND: null
AAMEND: null
TRACKSYS: null
RADESYS: ICRS
FOCUSZ: 0.742219865322113
OBJECT: HD 131586
INSTPORT: 2
ATM3PORT: null
DOMEAZ: 358.96
SHUTLOWR: 0.0
SHUTUPPR: 100.0
VIGNETTE: 'FULLY'
VIGN_MIN: 'FULLY'
WCSAXES: null
CTYPE1: null
CTYPE2: null
CUNIT1: null
CUNIT2: null
CRVAL1: null
CRVAL2: null
CRPIX1: null
CRPIX2: null
CD1_1: null
CD1_2: null
CD2_1: null
CD2_2: null
EQUINOX: null
TESTTYPE: CWFS
CAMCODE: AT
CONTRLLR: O
DAYOBS: '20240624'
SEQNUM: 106
PROGRAM: cwfs
REASON: INTRA
CURINDEX: 1
MAXINDEX: 1
TSTAND: null
IMAGETAG: 419350febde047ef
OBSANNOT: ''
TEMP_SET: -104.15
GRATING: empty_1
GRATBAND: EMPTY
GRATSLOT: 0
LINSPOS: 67.0
FILTBAND: r
FILTER: SDSSr_65mm
FILTSLOT: 2
EXPTIME: 30.0
DARKTIME: 30.2407
SHUTTIME: 30.0
AIRTEMP: 1.5750000476837158
PRESSURE: 73880.0
HUMIDITY: 40.650001525878906
WINDSPD: 12.593400001525879
WINDDIR: 21.05498504638672
SEEING: null
FILENAME: AT_O_20240624_000106_R00_S00.fits
HEADVER: 2
SIMULATE ATMCS: null
SIMULATE ATHEXAPOD: 0
SIMULATE ATPNEUMATICS: null
SIMULATE ATDOME: 0
SIMULATE ATSPECTROGRAPH: 0
XTENSION: BINTABLE
BITPIX: 8
NAXIS: 2
NAXIS1: 8
NAXIS2: 2048
PCOUNT: 886992
GCOUNT: 1
TFIELDS: 1
TTYPE1: COMPRESSED_DATA
TFORM1: 1PB(458)
ZIMAGE: true
ZTILE1: 576
ZTILE2: 1
ZCMPTYPE: RICE_1
ZNAME1: BLOCKSIZE
ZVAL1: 32
ZNAME2: BYTEPIX
ZVAL2: 4
ZTENSION: IMAGE
ZBITPIX: 32
ZNAXIS: 2
ZNAXIS1: 576
ZNAXIS2: 2048
ZPCOUNT: 0
ZGCOUNT: 1
ZHECKSUM: PIS7SFP4PFP4PFP4
CHANNEL: 1
EXTNAME: Segment10
CCDSUM: 1 1
DATASEC: '[4:512,1:2000]'
DETSEC: '[509:1,1:2000]'
DETSIZE: '[1:4072,1:4000]'
DTV1: 513
DTV2: 0
DTM1_1: -1.0
DTM2_2: 1.0
DTM1_2: 0.0
DTM2_1: 0.0
WCSNAMEA: AMPLIFIER
CTYPE1A: Seg_X
CTYPE2A: Seg_Y
PC1_1A: 0.0
PC1_2A: -1.0
PC2_1A: -1.0
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: 0.0
PC2_2Q: -1.0
CDELT1Q: 1.0
CDELT2Q: 1.0
CRPIX1Q: 0.0
CRPIX2Q: 0.0
CRVAL1Q: 602.0
CRVAL2Q: 4126.0
BSCALE: 1.0
BZERO: 0.0
INHERIT: true
ZDATASUM: '257174252'
CHECKSUM: CSPVCPMVCPMVCPMV
DATASUM: '1979613654'
Loading

0 comments on commit c8eeb7c

Please sign in to comment.