;+ ; NAME: JULIAN ; ; PURPOSE: ; This procedure is used to sort dark image files. From a list ; of dark image file names, it will return only those file ; names that have not already been through this procedure. ; ; CATEGORY: ; ; CALLING SEQUENCE: ; JULIAN,FILES,NEWFILES,TIME ; ; INPUTS: ; FILES: A STRING ARRAY of names of dark images ; ; TIME: A two byte integer, used to specify the images with ; the exposure time of interest. If no time is ; specified, then by default 60 will be chosen. ; ; KEYWORD PARAMETERS: ; None. ; ; OUTPUTS: ; NEWFILES: A STRING ARRAY of names of dark images that have not ; been run through this procedure. ; ; TWO FILES ; ; c:\idl\data\dark\julian0.drk : This file contains the dates ; and times, in Julian Seconds, at which the dark images, from ; camera 0, were aquired. ; ; c:\idl\data\dark\julian1.drk : This file contains the dates ; and times, in Julian Seconds, at which the dark images, ; from camera 1, were aquired. ; ; COMMON BLOCKS: ; None. ; ; SIDE EFFECTS: ; None. ; ; RESTRICTIONS: ; All files must come from the same path. ; ; PROCEDURE: ; The first file name in the STRING ARRAY, files, is checked. ; If the path is of the form c:\images\dark\cam0(1)\ , then ; the procedure will look for files with filenames of the form, ; ???...TIME???. If no time is specified then by default TIME=60. ; If the files are of the form, c:\images\dark\cam0(1)\???...time.??? ; then they are files created from dark exposure of the CCD. From ; these files the year,month,day and seconds in to the day at which ; the dark files was aquired is taken. Using a procedure called ; 'ymds2js(year,month,day,second)' the date and time at which the ; dark file was aquired is changed into Julian Seconds. This provides ; a convinient number to associate with the darkfiles. These numbers ; are stored in a file named, c:\idl\data\dark\julian0(1).drk. ; Each time the procedure is run it check all the Julian Seconds ; from the new files, assuming they are of the right type, against ; the one stored in the in the file julian0(1).drk.Only the files ; that have dates in Julian Seconds, which are not in the file ; julian0(1).drk will have their filenames returned in the STRING ; of names NEWFILES .See also documentation for JS_STATS. ; ; MODIFICATION HISTORY: ; Written May 1994, by T A Oliynyk ;- PRO julian,files,newfiles,time in=expose(files,time) camnum=STRMID(files(0),18,1) CASE camnum OF '0':BEGIN infiles=FINDFILE('c:\idl\data\dark\julian0.drk',count=count0) IF count0 NE 1 THEN BEGIN OPENW,unit,'C:\idl\data\dark\julian0.drk',/GET_LUN initial=ASSOC(unit,DBLARR(1)) initial(0)=[0] CLOSE,unit FREE_LUN,unit ENDIF OPENR,unit,'C:\idl\data\dark\julian0.drk',/GET_LUN filestat=FSTAT(unit) number=filestat.size/8 julsec=DBLARR(number) READU,unit,julsec CLOSE,unit FREE_LUN,unit newfiles=[''] FOR i=0, N_ELEMENTS(in)-1 DO BEGIN rdkihd,in(i),header Kih=gethd(header) year=Kih.misc.dt.year month=FIX(Kih.misc.dt.month) day=FIX(Kih.misc.dt.day) second=FIX(Kih.misc.tm.hour)*3600. + FIX(Kih.misc.tm.minute)*60. +$ FIX(kih.misc.tm.second) js=ymds2js(year,month,day,second) dummy=WHERE(Julsec EQ js,label) IF label EQ 0 THEN BEGIN julsec=[julsec,js] newfiles=[newfiles,in(i)] ENDIF ENDFOR IF N_elements(newfiles) GT 2 THEN BEGIN newfiles=newfiles(1:*) OPENW,unit,'C:\idl\data\dark\julian0.drk',/GET_LUN WRITEU,unit,julsec CLOSE,unit FREE_LUN,unit ENDIF ELSE BEGIN OPENW,unit,'C:\idl\data\dark\julian0.drk',/GET_LUN WRITEU,unit,julsec CLOSE,unit FREE_LUN,unit ENDELSE END '1':BEGIN infiles=FINDFILE('c:\idl\data\dark\julian1.drk',count=count1) IF count1 NE 1 THEN BEGIN OPENW,unit,'C:\idl\data\dark\julian1.drk',/GET_LUN initial=ASSOC(unit,DBLARR(1)) initial(0)=[0] CLOSE,unit FREE_LUN,unit ENDIF OPENR,unit,'C:\idl\data\dark\julian1.drk',/GET_LUN filestat=FSTAT(unit) number=filestat.size/8 julsec=DBLARR(number) READU,unit,julsec CLOSE,unit FREE_LUN,unit newfiles=[''] FOR i=0, N_ELEMENTS(in)-1 DO BEGIN rdkihd,in(i),header Kih=gethd(header) year=Kih.misc.dt.year month=FIX(Kih.misc.dt.month) day=FIX(Kih.misc.dt.day) second=FIX(Kih.misc.tm.hour)*3600. + FIX(Kih.misc.tm.minute)*60. +$ FIX(kih.misc.tm.second) js=ymds2js(year,month,day,second) dummy=WHERE(Julsec EQ js,label) IF label EQ 0 THEN BEGIN julsec=[julsec,js] newfiles=[newfiles,in(i)] ENDIF ENDFOR IF N_elements(newfiles) GE 2 THEN BEGIN newfiles=newfiles(1:*) OPENW,unit,'C:\idl\data\dark\julian1.drk',/GET_LUN WRITEU,unit,julsec CLOSE,unit FREE_LUN,unit ENDIF ELSE BEGIN OPENW,unit,'C:\idl\data\dark\julian1.drk',/GET_LUN WRITEU,unit,julsec CLOSE,unit FREE_LUN,unit ENDELSE END ELSE:BEGIN MESSAGE, 'None of the files are from camera 0 or 1.',$ /INFORMATIONAL Newfiles=[''] END ENDCASE END