; docformat = 'rst' ; ; NAME: ; getCameraDIT ; PURPOSE: ; Retrieve the exposure properties (start, DIT, NDIT) from FITS header ; ;+ ; :Description: ; Retrieve the exposure properties (start, DIT, NDIT) from FITS header ; ; :Categories: ; FITS, Camera ; ; :Returns: A structure with the characteristics of the exposure ; (start time, DIT, NDIT). Fields are:: ; .START: The ISO date of the start of exposure ; .DIT: The Detector Integration Time (s) ; .NDIT: The number of DIT ; ; :Params: ; head: in, required, type=string ; A FITS header from the telescope ; tel: in, optional, type=string ; The ID of the telescope (from getTelescopeID) ; cam: in, optional, type=string ; The ID of the camera (from getCameraID) ; ; :Uses: ; sxpar, getTelescopeID, getCameraID, date_conv ; ; :Author: ; B.Carry (OCA) ; ; :History: ; Change History:: ; Written in March 2014, B. Carry (IMCCE) ; 2015-Jan.: B.Carry (IMCCE) - Added iKon-2k@OHP, SPHERE@VLT ; 2015 Nov.: B.Carry (OCA) - Added idl2 compile option ; 2016 Aug.: B.Carry (OCA) - ESO split into LSO and VLT ; 2017 Apr.: B.Carry (OCA) - Corrected bug for Keck which repeated UTC at the end ; 2017 June: B.Carry (OCA) - Corrected bug for Keck, missing T between date and UT ; 2022 Nov.: B.Carry (OCA) - Added CFHT/PUEO ; 2023 Jan.: B.Carry (OCA) - Added C2PU/QHY ; 2023 Dec.: B.Carry (OCA) - Added LBTO ;- function getCameraDIT, head, tel, cam ;-----------------------------------------------------------------------------------------------; ;-----------------------------------------------------------------------------------------------; ;--- TAG --- I -- Initialization And Input Verification -----------------------; ;-----------------------------------------------------------------------------------------------; ;-----------------------------------------------------------------------------------------------; COMPILE_OPT hidden, idl2 ;--I.1-- Input Syntax Verification ---------------------------------------------------- if N_PARAMS() lt 1 then begin message, /IOERROR, 'Syntax : ID = getCameraDIT(HEAD, [telID, camID])' return, -1 endif ;--I.2-- Telescope and Camera ID ------------------------------------------------------ if not keyword_set(tel) then tel=getTelescopeID(head) if not keyword_set(cam) then cam=getCameraID(head) ;--I.3-- Output Structure ------------------------------------------------------------- out = {start:'', DIT:0., NDIT:0, delay:0.} ;-----------------------------------------------------------------------------------------------; ;-----------------------------------------------------------------------------------------------; ;--- TAG --- II -- Header Parsing and Exposure start, length, ... -----------------------; ;-----------------------------------------------------------------------------------------------; ;-----------------------------------------------------------------------------------------------; case tel of ;--II.1-- ESO-VLT Telescopes -------------------------------------------------------------- 'ESO-VLT': begin case cam of ;--II.1.1-- SPHERE/IRDIS -------------------------------------------------------------- 'SPHERE/IRDIS': begin out.start = sxpar(head,'DATE-OBS') out.DIT = lxpar(head, 'HIERARCH ESO DET SEQ1 DIT') out.delay = lxpar(head, 'HIERARCH ESO DET DITDELAY') out.NDIT = lxpar(head, 'HIERARCH ESO DET NDIT') end ;--II.1.2-- FORS2 --------------------------------------------------------------------- 'FORS2': begin out.start = sxpar(head,'DATE-OBS') out.DIT = lxpar(head, 'HIERARCH ESO DET WIN1 DIT1') out.delay = 0 out.NDIT = lxpar(head, 'HIERARCH ESO DET WIN1 NDIT') end ;--II.1.3-- ZIMPOL -------------------------------------------------------------------- 'ZIMPOL': begin out.start = sxpar(head,'DATE-OBS') out.DIT = lxpar(head, 'HIERARCH ESO DET DIT1') out.delay = 0 out.NDIT = lxpar(head, 'HIERARCH ESO DET NDIT') end ;--II.1.x-- General ESO Keywords ----------------------------------------------------- else: begin out.start = sxpar(head,'DATE-OBS') out.DIT = lxpar(head, 'HIERARCH ESO DET DIT') out.delay = lxpar(head, 'HIERARCH ESO DET DITDELAY') out.NDIT = lxpar(head, 'HIERARCH ESO DET NDIT') end end end ;--II.2-- ESO-LSO Telescopes -------------------------------------------------------------- 'ESO-LSO': begin case cam of ;--II.2.1-- EFOSC @ NTT -------------------------------------------------------------- 'EFOSC': begin out.start = sxpar(head,'DATE-OBS') out.DIT = lxpar(head, 'HIERARCH ESO DET WIN1 DIT1') out.delay = 0 out.NDIT = lxpar(head, 'HIERARCH ESO DET WIN1 NDIT') end ;--II.2.x-- Unknown ------------------------------------------------------------------ else: begin message, 'getObservationTime: Camera not known' return, -1 end end end ;--II.3-- Keck Observatory -------------------------------------------------------------- 'KeckII': begin case cam of ;--II.3.1-- NIRC2 --------------------------------------------------------------------- 'NIRC2': begin date = sxpar(head,'DATE-OBS') utc = sxpar(head,'EXPSTART',count=nbFound) if nbFound eq 0 then utc = sxpar(head,'UTC') posT = strPos( date,'T' ) if posT[0] eq -1 then out.start = strTrim(date,2)+'T'+strTrim(utc,2) $ else out.start = strtrim(date,2) out.DIT = sxpar(head, 'ITIME') out.NDIT = sxpar(head, 'COADDS') end ;--II.3.2-- NIRSPEC ---- -------------------------------------------------------------- 'NIRSPEC': begin date = sxpar(head,'DATE-OBS') utc = sxpar(head,'EXPSTART',count=nbFound) if nbFound eq 0 then utc = sxpar(head,'UTC') posT = strPos( date,'T' ) if posT[0] eq -1 then out.start = strTrim(date,2)+'T'+strTrim(utc,2) $ else out.start = strtrim(date,2) out.DIT = sxpar(head, 'ITIME') if out.DIT eq 0 then out.DIT = sxpar(head, 'ITIME2') out.NDIT = sxpar(head, 'COADD') end ;--II.3.x-- Unknown ------------------------------------------------------------------ else: begin message, 'getObservationTime: Camera not known' return, -1 end end end ;--II.4-- Gemini Observatory ------------------------------------------------------------ 'Gem-N': begin date = sxpar(head,'DATE-OBS') utc = sxpar(head,'UT') out.start = strtrim(date,2)+'T'+strtrim(utc,2) out.DIT = sxpar(head, 'EXPTIME') out.NDIT = sxpar(head, 'COADDS') if out.NDIT eq 0 then out.NDIT = 1 end ;--II.5-- Haute-Provence Observatory------------------------------------------------------ 'OHP-120': begin out.start = sxpar(head,'DATE-OBS') out.DIT = sxpar(head, 'EXPTIME') out.NDIT = 1 end ;--II.6-- ALMA -------------------------------------------------------------------------- 'ALMA': begin out.start = sxPar(head,'DATE-OBS') out.DIT = 0 out.NDIT = 1 end ;--II.7-- CFHT/PUEO --------------------------------------------------------------------- 'CFHT': begin ;- Deal with different separator for date date = strSplit( sxPar(head,'DATE-OBS'),'/', /Extract ) if size(date, /n_elements) eq 1 then date = strSplit( sxPar(head,'DATE-OBS'),'-', /Extract ) hour = strSplit( sxPar(head,'UTC-OBS'), ":", /Extract ) if size(hour, /n_elements) eq 1 then hour = strSplit( sxPar(head,'UTIME'), ':', /Extract ) ;- Deal with YYYY/MM/DD vs DD/MM/YY format if strLen(date[0]) eq 4 then begin out.start = date[0]+'-'+date[1]+'-'+date[2]+'T'+string(hour[0], format='(I02)') + ':' + string(hour[1], format='(I02)') + ':' + string(hour[2], format='(F5.2)') endif else begin out.start = '19'+date[2]+'-'+date[1]+'-'+string(date[0],format='(I02)')+'T'+string(hour[0], format='(I02)') + ':' + string(hour[1], format='(I02)') + ':' + string(hour[2], format='(F5.2)') endelse out.DIT = sxPar( head, 'INTTIME' ) out.NDIT = 1 end ;--II.8-- C2PU -------------------------------------------------------------------------- 'C2PU-Om': begin out.start = sxPar(head,'DATE-OBS') out.DIT = sxPar(head,'EXPTIME') out.NDIT = 1 end ;--II.9-- LBTO -------------------------------------------------------------------------- 'LBTO': begin out.start = sxPar(head,'UTSTART') out.DIT = sxPar(head,'EXPTIME') out.NDIT = 1 end ;--II.x-- Unknown ----------------------------------------------------------------------- else: begin message, 'getObservationTime: Telescope not known' return, -1 end end ;----- Return Start-Time ------------------------------------------------------------------- return, out end