
; CNA_MASKCORR -- Combine static bad pixel mask with NICMOS DQ array.
; The input DQ array is logically "OR'd" with the mask DQ array.
; Also set all DQ values to BADPIX if there was a TDF transition.
; The input SCI, ERR, SAMP, and TIME arrays are unchanged.

; Revision history:
; I. Barg 10-Jan-2000 Modified structure names (and tag names) to match 
;             "/iraf/stsdas/lib/hstio.h".

function cna_maskcorr, nic, mask, input

@calnica_common

  ; Arguments:
  ;	nic	 i: NICMOS info structure
  ;	mask	 i: mask image
  ;	input	io: image to be masked

  ; Combine the DQ mask with the input DQ.
  input.dq.data.data = input.dq.data.data or $
			       mask.dq.data.data

  ; Was there a TDF transition during the exposure? 
  if (nic.tdftrans(nic.group-1) gt 0) then begin
    ; Set the BADPIX value in the entire DQ array.
    input.dq.data.data = input.dq.data.data or BADPIX
  endif


  ; Successful return.
  return, 0

end
