C+ C NAME: C smei_calgroup C PURPOSE: C Processes the content of the list file with information about C all groups of closed shutter frames. C CALLING SEQUENCE: integer function smei_calgroup(cList, icam, TBeg, TEnd, cframes, cframeref, bTfloat) C INPUTS: C cList*(*) character name of ASCII file with frame names C OUTPUTS: C icam integer camera number (1,2,3) C TBeg(2) integer start time of 'closed shutter' data C TEnd(2) integer end time of 'closed shutter' data C cframes(smei_calgroup) C character list of frame names to be used to C calculate the shutter. C cframeref*(*) character base name for all pattern-related output files. C cframeref contains only a file (no directory, no type) C bTfloat logical set to .TRUE. if the patterns were selected near C the minimum (camera 1,2) or maximum (3) of the CCD C temperature curve. C (NOTE: this is only correct for camera 3 and for C cameras 1 and 2 for the patterns after approximately C doy 100 in 2004.) C smei_calgroup integer # frames in array cframes C INCLUDE: include 'filparts.h' include 'openfile.h' C CALLS: C bOpenFile, Say, smei_Time2Split, iSetFileSpec, iGetFileSpec, Say C LocFirst, LocFirstLen C PROCEDURE: C Each closed shutter calibration is characterized in a small ascii file C containing a group 2+N frame names (currently N=10). C Frames 1 and 2 bracket the 'closed shutter' data; C the following group on N frames is used to determine the pattern. C MODIFICATION HISTORY: C JUN-2004, Paul Hick (UCSD/CASS; pphick@ucsd.edu) C- character cList*(*) integer icam integer TBeg(2) integer TEnd(2) character cframes(*)*(*) character cframeref*(*) logical bTfloat character cSay*13 /'smei_calgroup'/ character cFrmBeg *(FIL__LENGTH) character cFrmEnd *(FIL__LENGTH) character cFrmSpec*(FIL__LENGTH) integer TAB parameter (TAB = 9) integer SPACE parameter (SPACE = 32) logical bOpenFile if (.not. bOpenFile(OPN__TEXT+OPN__REOPEN+OPN__STOP,iU,cList,iRecl)) stop nframe = 0 bTfloat = .FALSE. ! Read frame name of begin of 'shutter closed' data read (iU,'(A)', iostat=I) cFrmBeg do while (I .eq. 0 .and. (itrim(cFrmBeg) .eq. 0 .or. cFrmBeg(:1) .eq. ';')) if (cFrmBeg(:1) .eq. ';') then call Say(cSay,'I','say',cFrmBeg) bTfloat = LocFirst('(minimum)',cFrmBeg) .ne. 0 .or. LocFirst('(maximum)',cFrmBeg) .ne. 0 end if read (iU,'(A)', iostat=I) cFrmBeg end do ! Only proper program exit: EOF on cList if (I .eq. 0) then ! Read frame name of end of 'shutter closed data' read (iU,'(A)') cFrmEnd call smei_Time2Split(0,cFrmBeg,TBeg) call smei_Time2Split(0,cFrmEnd,TEnd) read (cFrmBeg(2:2), '(I1.1)') icam ! Read frame names until EOF read (iU,'(A)',iostat=I) cFrmSpec do while (I .eq. 0) nframe = nframe+1 ! Extract everything up to the first tab, first space or end-of-line cFrmSpec = cFrmSpec(:min(LocFirstLen(char(SPACE),cFrmSpec),LocFirstLen(char(TAB),cFrmSpec))-1) ! We are only interested in the file name I = iSetFileSpec(cFrmSpec) I = iGetFileSpec(FIL__NAME,FIL__NAME,cframes(nframe)) read (iU,'(A)',iostat=I) cFrmSpec end do end if iU = iFreeLun(iU) if (nframe .eq. 0) then cFrmSpec = cList call Say(cSay,'E','#'//cFrmSpec,'empty group encountered') end if ! A frame near the center of the group is used as 'reference': it's name ! is used as base name for all pattern-related output files. ! cframeref is fully-qualified except for a missing file type. cframeref = cframes(max(nframe/2,1)) cframeref = cframeref(:2)//'cal'//cframeref(index(cframeref,'_'):) smei_calgroup = nframe return end