
; CNA_DARKCORR -- Subtract dark current from NICMOS image. The dark
; current image is selected from the DARKFILE reference file
; and subtracted in-place from the science image. The dark
; image errors and DQ flags are combined with the science
; data errors and DQ flags. The input 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_darkcorr, nic, dark, input

  ; Arguments:
  ;	nic	 i: NICMOS info structure
  ;	dark	 i: dark current image
  ;	input	io: image to be dark subtracted

  ; If the exposure time is zero, don't bother with subtraction.
  if (nic.exptime(nic.group-1) eq 0) then return, 0

  ; Do the dark subtraction in-place in input.
  ;input.sci.data.data = input.sci.data.data - $
  ;				 dark.sci.data.data

  print, ' DARKCORR is using dark imset ',nic.darkframe1,' for imset ',nic.group
  print, '          with exptime = ',nic.exptime(nic.group-1)

  temp = cna_asub(input,dark)

  ; Successful return.
  return, 0

end
