C+ C NAME: C smei_orb_get C PURPOSE: C Select orbital minimum or difference pattern C CATEGORY: C ucsd/camera/for/lib C CALLING SEQUENCE: subroutine smei_orb_get(orb_file,icam,mode,cal_file,orb_pattern,bNew,version) C INPUTS: C orb_file character*(*) name of orbital difference file C Only file name; no directory, no extension, i.e. C as extracted from Fits header of SMEI frame. C If orb_file is a blank string then orb_pattern is C set to zero. C icam integer must be always 3 C mode integer must be always 1 C cal_file character*(*) File name of closed shutter calibration pattern. C OUTPUTS: C orb_pattern real C bNew logical .TRUE. if a new orbital difference pattern is read C (and orb_pattern was modified) C .FALSE. if no new pattern is read (and orb_pattern C is not modified) C version double precision Version number of smei_orb that wrote the C the orbital pattarn. Return 0.0d0 if no orbital C pattern was read. C INCLUDE: include 'filparts.h' include 'dirspec.h' include 'smei_frm_layout.h' C CALLS: C iFilePath, smei_orb_cal_name, iSetFileSpec, iGetFileSpec, Say C PROCEDURE: C The name of the last difference pattern is saved internally. C A new difference pattern is read only if the input orb_file is different from C the internally saved name. If a new file is read then orb_pattern is updated, C and bNew is set true. If no new file is read then orb_pattern is not modified. C and bNew is set false. C C If the input cal_file is not the blank string then it is compared against the C the name of the calibration patterns associated with the current difference C pattern. If the names do not match program execution terminates. C MODIFICATION HISTORY: C SEP-2005, Paul Hick (UCSD/CASS) C JAN-2008, Paul Hick (UCSD/CASS; pphick@ucsd.edu) C Added version argument. C- character orb_file*(*) integer icam integer mode character cal_file*(*) real orb_pattern(*) logical bNew double precision version character cSay*7 /'orb_get'/ character cStr *(FIL__LENGTH) character cFile*(FIL__LENGTH) logical smei_frm_read_get_sdark ! The name of the orbital pattern from a previous call to ! this routine is saved in orb_name (file name+extension). ! (the file may or may not exist in $SMEIDB/orb) character orb_name*21 /' '/ save orb_name ! If the orbital pattern file exists in $SMEIDB/orb then ! the name of the calibration pattern used to make it is ! is stored in cal_name. cal_name will be blank if the ! orbital pattern file does not exist. character cal_name*21 /' '/ save cal_name bNew = .FALSE. version = 0.0d0 if (orb_file .ne. ' ') then ! Only for cam 3, mode 1 if (orb_file .ne. orb_name) then ! Orbital pattern name changes if (.not. smei_frm_read_get_sdark(idark)) & call Say(cSay,'E','sdark','funny setting for sdark keyword') if (idark .eq. -1) then i = iFilePath(cEnvi(:iEnvi)//'SMEIDB',1,'orb',orb_file,cFile) else write (cStr(:3),'(I3.3)') idark i = iFilePath(cEnvi(:iEnvi)//'SMEIDB',1,'orb_'//cStr(:3),orb_file,cFile) end if cFile(i+1:) = '.fts.gz' ! The orbital pattern may not exist. ! smei_base fills the frame header with the expected name of the ! the orbital pattern. In theory it is possible that this ! pattern is never (or not yet) created with smei_orb. ! If this happens use a zero orbital pattern. if (iSearch(1,cFile,cStr) .eq. 1) then call smei_orb_read(cStr, nx, ny, orb_pattern) call smei_orb_cal_name(cal_name) ! Calibration pattersn call smei_orb_version(version) ! smei_orb version else ! Orbital pattern doesn't exist call Say(cSay,'W','#'//cFile,'does not exist') nbin = 2**mode ! Use zero pattern call ArrR4Zero(SMEI__FRM_NPIX/(nbin*nbin),orb_pattern) version = 0.0d0 cal_name = ' ' end if orb_name = orb_file bNew = .TRUE. end if if (cal_file .ne. ' ' .and. cal_name .ne. ' ') then i = iSetFileSpec(cal_file) i = iGetFileSpec(FIL__NAME,FIL__NAME,cStr) if (cStr .ne. cal_name) call Say(cSay,'E','wrong','calibration pattern') end if else nbin = 2**mode call ArrR4Zero(SMEI__FRM_NPIX/(nbin*nbin),orb_pattern) end if return end