;+
; Project     : SOHO - CDS     
;                   
; Name        : DEMO_4TH_PIX
;               
; Purpose     : Demonstrates the 4th pixel readout effect in NIS1 data.
;               
; Explanation : The NIS1 readout causes a depression in the counts of every 
;               4th pixel.  This is illustrated here together with a possible
;               fix (at least in a cosmetic sense) by adding 0.16 counts to
;               each affected pixel.
;               
; Use         : IDL> demo_4th_pix
;    
; Inputs      : None
;               
; Opt. Inputs : None
;               
; Outputs     : None
;               
; Opt. Outputs: None
;               
; Keywords    : None
;
; Calls       : None
;
; Common      : None
;               
; Restrictions: None
;               
; Side effects: None
;               
; Category    : None
;               
; Prev. Hist. : None
;
; Written     : C D Pike, RAL, 13-Nov-96
;               
; Modified    : 
;
; Version     : Version 1, 13-Nov-96
;-            

pro demo_4th_pix

;
;  read averaged spectrum and reduce to 1-d
;
sp = readfits(concat_dir('$CDS_NIS','avg_qs_nis1_debias.fts'))
sp = average(sp,2)

;
; standard wavecal
;
w1 = pix2wave('n1',indgen(1024))

;
;  plot raw data in histogram mode
;
plot,w1,sp,psym=10,xr=[325,332],yr=[3.0,5.],/xst,/yst,chars=1.5,$
       tit='NIS1 4th pixel readout effect',xtit='Wavelength',ytit='Intensity'

;
;  add "correction"
;
n = indgen(256)*4 + 1
sp(n) = sp(n) +0.16

;
;  and overplot
;
circle_sym
oplot,w1,sp,th=2,psym=-8

end
