pro target,data,row,mean,lag0,lag1 ;============================================================ ; Written by S Mayor in March 1996 to plot time-series of ; radial velocity at constant range with corresponding ACF ; and power spectrum. ; ; This version is from Shane's collection and made available ; on the Web 2/18/97. ; ;================================================================= ; extract the time-series (ts) at a certain range (row) dt=0. print,'Enter dt (time between samples in s):' read,dt ts = data(row,*) n = n_elements(ts) print,'n = ',n mean = avg(ts) print,'Mean = ',mean ts = ts - mean reg_var = total(ts*ts)/n print,'Regular variance = ',reg_var n = 2*(n/2) delta_freq = 1./(n*dt) freq = (findgen(n/2)+1)*delta_freq fdata = fft(ts,-1) acf = float(fft(fdata*conj(fdata),1)) fdata = fdata(1:n/2) spec = float(fdata*conj(fdata)) spec = 2.*spec/delta_freq print,'Spectral variance = ',total(spec)*delta_freq lag0 = acf(0) lag1 = acf(1) print,'Zero-lag height = ',lag0 print,'lag-one height = ',lag1 print,'lag-zero - lag-one = ',lag0-lag1 ;goto,after_graphics main_caption = '' print,'Graphics will appear after you enter main caption for it.' print,'Enter main caption:' read,main_caption start_graphics: !mtitle=' ' ;!p.color=248 !p.charsize=1 !p.thick = 1 !x.style = 0 !y.style = 0 !P.multi = [0, 0, 2, 0, 0] !x.style=1 !x.range=[0-(.02*n),n+(.02*n)] !y.range = 0 !y.ticklen=0.02 !y.range = [-5,5] plot,ts,title=main_caption,ytitle='m s!e-1!n' !P.multi = [2, 2, 2, 0, 0] !x.range=[-1,20] !y.range=0 plot,findgen(21)*dt,acf(0:20),psym=-1,ytitle='m!e2!n s!e-2!n',xtitle='lag (s)' oplot,[-1,20],[0,0],linestyle=1 oplot,[0,0],[-10,10],linestyle=1 !x.style=5 !y.style=1 fmin=.00004 fmax=1.0 !x.range=[fmin,fmax] !y.range=[.0001,10.] ;!p.thick=4 !p.charthick=2 !p.charsize=1.5 ;!x.thick=3 ;!y.thick=3 !x.ticklen=.06 !y.ticklen=.06 plot_oo,freq,freq*spec,ytitle='f S(f) (m!e2!ns!e-2!n)' axis,xaxis=0,xtickv=[.0001,.001,.01,.1,1.],$ xtickname=['10!e-4','10!e-3','10!e-2','10!e-1','10!e0'],$ xtitle='f (Hz)' !x.range=[1./fmin,1./fmax] axis,xaxis=1,xtickv=[1./.0001,1./.001,1./.01,1./.1,1./1.],$ xtickname=['10!e4','10!e3','10!e2','10!e1','10!e0'],$ xtitle=' ' ;xyouts,.58,1.02,'1/f (s)',/normal,alignment=.5 ;plots,[.04,.5],[.04,.5],linestyle=2 ;plots,[10e-5,10e-2],[1,.01],linestyle=2 ;plots,[10e-4,10e-1],[1,.01],linestyle=2 ;plots,[10e-4,30e-3],[.39,.04],linestyle=2 ;xyouts,1.5e-3,0.1,'f!e -2/3' ;xyouts,2e-1,0.1,'f!e +1' ps_filename='dummy' answer='N' if (!d.name eq 'X') then begin read,'Do you want to make a PS file? (Y or N) ',answer if (strupcase(answer) eq 'Y') then begin read,'Enter name for PS file> ',ps_filename print,'Creating '+ps_filename set_plot,'PS' !p.font=0 device,filename=ps_filename ; device,yoffset=1.50,xoffset=1.00,/inches ; device,ysize=9.00,xsize=6.00,/inches device,/landscape goto,start_graphics endif endif else begin device,/close print,'Done.' !p.font=-1 set_plot,'X' endelse after_graphics: return end