;+ ; NAME: ; shortlognight ; PURPOSE: (one line) ; Read a night of NIRES and make a short log ; DESCRIPTION: ; Read a night of NIRES and organize it into a list of sets (a short log) ; Write a table of slit offsets ; tables/YYMMDD_1_slitoffset.txt ; CATEGORY: ; NIRES reduction ; CALLING SEQUENCE: ; shortlognight, datestr, sets, nset ; INPUTS: ; datestr: string (YYMMDD) ; KEYWORD INPUT PARAMETERS: ; noprint: if set, do not print out a short log to the terminal ; OUTPUTS: ; sets: array of set structures ; nset: number of sets ; SIDE EFFECTS: ; optionally prints a short log ; RESTRICTIONS: ; tables directory must exist ; PROCEDURE: ; frames in a set have the same DATEOBS, OBJECT, OBSTYPE, TARGRA, ; TARGDEC, TARGNAME, ITIME, COADDS, NUMFS, ROTMODE ; and successive frames are taken within 1800 seconds of each other. ; MODIFICATION HISTORY: ; Written 2021 Dec 30, by Leslie Young, SwRI ;- pro shortlognight, datestr, sets, nset, noprint=noprint foo = rdnight(datestr, framenum0, n, h, nodata=nodata, $ dateobs=dateobs, utc=utc, rditime=rditime, $ itime=itime, object=object, obstype=obstype, coadds=coadds, numfs=numfs, $ targra=targra, targdec=targdec, targname=targname, rotposn=rotposn, rotmode=rotmode) framenum = framenum0 + lindgen(n) setno = intarr(n) setno[0] = 0 et = utc2et(dateobs + ' ' + utc) salstr=['*', ' '] i = 0 set1 = {setno:setno[i], dateobs:dateobs[i], framenum0:framenum0[i], n:-1, et0:et[i], object:object[i], obstype:obstype[i], $ targra:targra[i], targdec:targdec[i], targname:targname[i], $ itime:itime[i], coadds:coadds[i], numfs:numfs[i], rotposn:rotposn[i], rotmode:rotmode[i]} sets = [set1] nset = 1 if not keyword_set(noprint) then begin print, setno[i], framenum0+i, ' '+object[i], salstr[1], salstr[1], salstr[1], itime[i], coadds[i], numfs[i], rotposn[i], ' '+rotmode[i] endif for i = 1, n-1 do begin sal_time = et[i] le (et[i-1] + 1800.) && dateobs[i] eq dateobs[i-1] sal_obs = object[i] eq object[i-1] && $ obstype[i] eq obstype[i-1] && $ targra[i] eq targra[i-1] && $ targdec[i] eq targdec[i-1] && $ targname[i] eq targname[i-1] sal_mode = itime[i] eq itime[i-1] && $ coadds[i] eq coadds[i-1] && $ numfs[i] eq numfs[i-1] && $ ;rotposn[i] eq rotposn[i-1] && $ rotmode[i] eq rotmode[i-1] sameaslast = ( et[i] le (et[i-1] + 1800.) && $ dateobs[i] eq dateobs[i-1] && $ object[i] eq object[i-1] && $ obstype[i] eq obstype[i-1] && $ targra[i] eq targra[i-1] && $ targdec[i] eq targdec[i-1] && $ targname[i] eq targname[i-1] && $ itime[i] eq itime[i-1] && $ coadds[i] eq coadds[i-1] && $ numfs[i] eq numfs[i-1] && $ ;rotposn[i] eq rotposn[i-1] && $ rotmode[i] eq rotmode[i-1]) if sameaslast then begin setno[i] = setno[i-1] endif else begin setno[i] = setno[i-1] + 1 sets[nset-1].n = framenum[i] - (sets[nset-1]).framenum0 set1.setno=setno[i] set1.dateobs=dateobs[i] set1.framenum0=framenum[i] set1.et0=et[i] set1.object=object[i] set1.obstype=obstype[i] set1.targra=targra[i] set1.targdec=targdec[i] set1.targname=targname[i] set1.itime=itime[i] set1.coadds=coadds[i] set1.numfs=numfs[i] set1.rotposn=rotposn[i] set1.rotmode=rotmode[i] sets = [sets,set1] nset = nset+1 if not keyword_set(noprint) then begin print, setno[i], framenum0+i, ' '+object[i], salstr[sal_time], salstr[sal_obs], salstr[sal_mode], itime[i], coadds[i], numfs[i], rotposn[i], ' '+rotmode[i] endif endelse endfor sets[nset-1].n = framenum0+i - (sets[nset-1]).framenum0 end