PRO plot_predict_v3, ndata, times, b_out, b_out_vari, b_out_pred_1, $ b_out_pred_2, bird, phase, plot_file_path ; Does so. ; 10/22/03 ; ; Modified to compute reduced chi_square, add it to the ; plot field and also generate a general plot title. Also expects ; two predicts. ; ; Author: Robert Kessel ; Electro-Optics Technology Section ; Code 8123 ; Naval Research Laboratory ; Washington, D.C. 20375-5354 ; email: kessel@ncst.nrl.navy.mil ; ; This code was written for Bill Palya's and Don Walter's ; use at JSU. However, anyone else who finds it useful ; should feel free to use it, rewrite it, or whatever else, ; save charging any money, goods or services from any other ; person for the code or use thereof. ; 10/23/03 ; Make cut down data set nct=0 times_cut = FLTARR(ndata) b_out_cut = FLTARR(ndata) b_out_vari_cut = FLTARR(ndata) FOR i=0,255 DO BEGIN IF (FLOAT(i/8) EQ FLOAT(i)/8.) THEN BEGIN times_cut[nct]=times[i] b_out_cut[nct]=b_out[i] b_out_vari_cut[nct]=b_out_vari[i] nct=nct+1 ENDIF ENDFOR nct=nct-1 times_cut=times_cut[0:nct] b_out_cut=b_out_cut[0:nct] b_out_vari_cut=b_out_vari_cut[0:nct] ; define plot SET_PLOT, 'mac' LOADCT, 27 WINDOW, 0, XSIZE=650, YSIZE=400 ;SET_PLOT, 'PS' ;LOADCT, 0 ;DEVICE, FILENAME=plot_file_path+'b'+STRCOMPRESS(STRING(bird), /REMOVE_ALL)+$ ; '_p'+STRCOMPRESS(STRING(phase), /REMOVE_ALL)+'.ps', /portrait ;DEVICE, FILENAME=plot_file_path+'b'+STRCOMPRESS(STRING(bird), /REMOVE_ALL)+$ ; '_p'+STRCOMPRESS(STRING(phase), /REMOVE_ALL)+'.ps', /landscape plot_title = 'Bird'+STRCOMPRESS(STRING(bird))+$ ', Phase'+STRCOMPRESS(STRING(phase))+' -- observed and predicted' x_title='t (sec)' y_title='B(t) (resp/sec)' !mtitle=plot_title !xtitle=x_title !ytitle=y_title max_rate = MAX([MAX(b_out), MAX(b_out_pred_1), MAX(b_out_pred_2)]) !p.position = [0.15, 0.1, 0.95, 0.9] PLOT, times, b_out, XSTYLE=1, XRANGE=[times[0],times[255]], $ YSTYLE = 1, YRANGE = [-0.03*max_rate, 1.07*max_rate], $ LINESTYLE = 0 n_sessions = 20 ERRPLOT, times_cut, b_out_cut - SQRT(b_out_vari_cut/FLOAT(n_sessions)), $ b_out_cut + SQRT(b_out_vari_cut/FLOAT(n_sessions)) PLOT, times, b_out_pred_1, XSTYLE=1, XRANGE=[times[0],times[255]], $ YSTYLE = 1, YRANGE = [-0.03*max_rate, 1.07*max_rate], $ LINESTYLE = 1, /NOERASE PLOT, times, b_out_pred_2, XSTYLE=1, XRANGE=[times[0],times[255]], $ YSTYLE = 1, YRANGE = [-0.03*max_rate, 1.07*max_rate], $ LINESTYLE = 2, /NOERASE ; compute reduced chi_squared for predict_1 and add label npar = 0 eval_chi_sqrd_nu, ndata, npar, b_out, b_out_vari, b_out_pred_1, $ chi_sqrd_nu, q x_lab_1 = 1300. x_lab_2 = 1500. x_lab_3 = 1550. y_lab_1 = 0.95*max_rate y_lab_2 = 0.85*max_rate PLOTS, [x_lab_1,x_lab_2], [y_lab_1,y_lab_1], LINESTYLE=1, /DATA XYOUTS, x_lab_3, y_lab_1, '!4v!Dm!N!3!E2!N = '+$ STRCOMPRESS(STRING(chi_sqrd_nu), /REMOVE_ALL) eval_chi_sqrd_nu, ndata, npar, b_out, b_out_vari, b_out_pred_2, $ chi_sqrd_nu, q PLOTS, [x_lab_1,x_lab_2], [y_lab_2,y_lab_2], LINESTYLE=2, /DATA XYOUTS, x_lab_3, y_lab_2, '!4v!Dm!N!3!E2!N = '+$ STRCOMPRESS(STRING(chi_sqrd_nu), /REMOVE_ALL) ;DEVICE, /CLOSE ;SET_PLOT, 'mac' END