C+ C NAME: C smei_frm_saturated C PURPOSE: C Count saturated pixels C CATEGORY: C ucsd/camera/for/lib C CALLING SEQUENCE: integer function smei_frm_saturated(hdr, frame) C INPUTS: C hdr(*) double precision SMEI frm header C frame(*) real frame data (from href=smei_frm_read=) C OUTPUTS: C smei_frm_saturated C integer # saturated pixels C CALLS: C iArrR4ValuePresent C INCLUDE: include 'smei_frm_layout.h' include 'smei_frm_hdr.h' C PROCEDURE: C If the onboard flatfield is NOT enable then every pixel C with readout >= 65533 is counted as saturated. C (strictly speaking the saturation value is 65535, but for C camera 3 in mode 1 the highest value appears to be C 65533 at least some of the time). C If the onboard flatfield is enabled (and the headroom of C 0.75 is applied) then 49147 is used). C MODIFICATION HISTORY: C JUN-2004, Paul Hick (UCSD/CASS) C AUG-2005, Paul Hick (UCSD/CASS; pphick@ucsd.edu) C Changed saturation value from 65535 to 65533. C- double precision hdr(*) integer nx integer ny real frame(*) nx = nint( hdr(SMEI__HDR_NAXES ) ) ny = nint( hdr(SMEI__HDR_NAXES+1 ) ) if (nint(hdr(SMEI__HDR_FLAT_ENABLED)) .eq. 0) then smei_frm_saturated = 0 do i=1,nx*ny if (nint(frame(i)) .ge. 65533) smei_frm_saturated = smei_frm_saturated+1 end do else smei_frm_saturated = 0 do i=1,nx*ny if (nint(frame(i)*SMEI__HEADROOM) .ge. 49147) smei_frm_saturated = smei_frm_saturated+1 end do end if return end