;function subtract_60hz
;
;PURPOSE:
;	To eliminate the common mode signal present in output 0 (0:127) of the
;	H4RG detector (this noise was present during the KPNO run of
;	4/24/07-5/1/07)
;INPUTS:
;	InArr - The full 4006x4096 array from the H4RG detector
;
function subtract_60hz, InArr

Common KeyParams, KeyStr

MeanChannel0 = mean(InArr(KeyStr.Ref:KeyStr.Ch0W-1,*))
MedianChannel0 = median(InArr(KeyStr.Ref:KeyStr.Ch0W-1,*))
MedianRowsChannel0 = median(InArr(KeyStr.Ref:127,*), dimension = 1)

;Form a 4096x1 array of the noise - mean
Noise = Float(MedianRowsChannel0)-float(MeanChannel0)

For Row = 0, (Size(InArr))[2] - 1 do begin
  InArr(*, Row) = float(InArr(*,Row)) - Noise(Row)
EndFor

InArr=Long(InArr)
return, InArr

end 
