C+ C NAME: C smei_frm_clean C PURPOSE: C Massages SMEI data frame for further processing C CATEGORY: C gen/for/lib C CALLING SEQUENCE: integer function smei_frm_clean(nX, nY, frm1, frm2) C INPUTS: C nX integer horizontal frame size C nY integer vertical frame size C frm1(nX,nY) real frame data (from href=smei_frm_read=) C OUTPUTS: C frm2(nX,nY) real massaged data with some C pixels flagged as bad C smei_frm_clean integer # pixels flagged as bad C This should be 8/nbin C In full-frame eng mode (no ROI applied) C this will be 4*256+8 (4 leading columns C of zeros). C CALLS: C BadR4, ArrR4Copy, smei_frm_mode C INCLUDE: include 'smei_frm_layout.h' include 'smei_frm_hdr.h' C PROCEDURE: C > Pixels with readout of zero ADU are set to bad C This primarily flags the first 4 columns for full-frame eng mode C frames (which contain 4 columns of zero at the start) C > 8 pixels in top row at right side of frame. 4 dark current C and 4 pedestal pixels are set to bad. These sometimes contain C funny values like 0 of 512. C MODIFICATION HISTORY: C JUN-2004, Paul Hick (UCSD/CASS; pphick@ucsd.edu) C- integer nX integer nY real frm1(nX,nY) real frm2(nX,nY) character cSay*9 /'frm_clean'/ integer smei_frm_mode integer drk_col integer ped_col drk_col(i) = (SMEI__DRK_COL(i)-1)/nbin+1 ped_col(i) = (SMEI__PED_COL(i)-1)/nbin+1 bad = BadR4() call ArrR4Copy(nX*nY, frm1, frm2) mode = smei_frm_mode(nX, nbin) ! Don't trust dark and ped pixels in top row on right side (sometimes ! contain funny values). Set 8 pixels to zero (effectively flags them as bad). nbad = 0 do i=SMEI__DRK_NCOL/2+1,SMEI__DRK_NCOL,nbin nbad = nbad+1 frm2(drk_col(i),nY) = bad end do do i=SMEI__PED_NCOL/2+1,SMEI__PED_NCOL,nbin nbad = nbad+1 frm2(ped_col(i),nY) = bad end do do j=1,nY ! All zero values are set to bad here do i=1,nX if (frm2(i,j) .eq. 0.0) then nbad = nbad+1 frm2(i,j) = bad end if end do end do smei_frm_clean = nbad return end