C+ C NAME: C ssff C PURPOSE: C To remove the known ground-based update to small scale flat field from the data frames C Note this does not include the ssff that may already have been applied to inflight data C This latter can happen only when the ROI is applied upon inflight data C For non-ROI flight data, strictly speaking the inflight SSFF should be applied here, C *BUT* in the present version those inflight SSFF's are not brought in nor used, except C for the UCSD camera. C CATEGORY: C SMEI Data processing C CALLING SEQUENCE: C call ssff(mode,ic,ifm,id,jd,iframemask,framessff,frame) C INPUTS: C mode integer 1 - "Engineering" frame records, no onboard binning C 2 - "Hi-res" frame records, binned 2 x 2 pixels C 4 - "Normal Data" frame records, binned 4 x 4 pixels C ic integer Camera 0,1,2,3 or 4 C ifm integer frame mask mode - 0 mask not imposed, 1 frame mask imposed C id integer data frame max x-value (along rows) C jd integer data frame max y-value (down columns) C iframemask(id,jd) integer Data mask showing location of valid data C framessff real Known ground-based update to small scale flat field C frame(id,jd) real Data frame from CCD C OUTPUTS: C frame(id,jd) real Data frame from CCD, small scale flatfield correction applied C CALLS: C PROCEDURE: C The small scale flatfields here are those determined at UCSD/B'ham with the white-cloth "dome flat" C These should be imposed only if not already imposed onboard the spacecraft (i.e., no ROI or C switched off) or with 4 x 4 onboard binning (since the ssff values within a block average to 1) C The present code is probably not optimum for 2 x 2 binning. C MODIFICATION HISTORY: C Jan. 2003, A. Buffington (UCSD) C- subroutine ssff(mode,ic,ifm,id,jd,iframemask,framessff,frame) real framessff(1280,600), & frame(id,jd) integer iframemask(id,jd) integer*4 icount,i,j,ii,jj C C Bail out if ROI imposed for flight cameras, or in 4 x 4 onboard binning mode C if(ic.ge.1.and.(ifm.eq.1.or.mode.eq.4))return C C Remove ground-based small scale flat field from the data frame in Engineering mode. C if(mode.eq.1) then do j=1,jd do i=1,id if(ifm.eq.1)then if(iframemask(i,j).ne.0) then frame(i,j) = frame(i,j)*framessff(i,j) end if else frame(i,j) = frame(i,j)*framessff(i,j) endif end do end do end if C C Remove ground-based small scale flat field from the data frame in the 2 x 2 binning mode. C Application of SSFF is questionable: strictly, the ssff value used here should be an average of 4. C if(mode.eq.2) then do j=1,jd jj=1+(j-1)/2 do i=1,id ii=1+i/2 if(ifm.eq.1)then if(iframemask(i,j).ne.0) then frame(i,j) = frame(i,j)*framessff(ii,jj) end if else frame(i,j) = frame(i,j)*framessff(ii,jj) endif end do end do end if C return end