FUNCTION CalcDSweights,samples,gap,clocktime
; -------------------
; Simon Tulloch
; QUCAM
; Novemeber 2013
; ---------------------------------------------------------------------------
; Returns an array of ADC sample weights with the length of 1 pixel (="samples")
; Dual Slope integrator with rectangular response.
; "clocktime" time is wasted at start with the serial clocking, expressed as a fraction of pixel time
; "gap" time is wasted during settling after initial serial clocks an also after charge dump, expressed as a fraction of pixel time.
; NOTE. There are two gaps therefore, one before reference integration and one before signal integration
; The signal and reference integrations sections have the same width.
; ----------------------------------------------------------------------------
;
;--clocktime-gap-reference-gap-signal
;
weights=FLTARR(samples)
t=FIX(samples*(1-2*gap-clocktime)/2.0) ; Integration time of each window.
start=FIX(samples*(clocktime+gap))
finish=start+t-1
weights[start:finish]=1.0
start=FIX(samples-1-t)
finish=start+t-1
weights[start:finish]=-1.0
RETURN,weights
END