;title: wband_motion.pro ;purpose: examine the motion compensation statistics ; ;implementation: ; get_data=0 run_analysis=0 if get_data then begin motiondir='E:/archive/wband/logs' plotdir='C:/data/acse/plots/motioncomp' colorfile='C:/data/acse/programs/colorscopy.tbl' sarg='2014070500' ;YYYYMMDDHH, starting date argument ;Determine data range (20140705 to present) sjd=julday(7,5,2014)-julday(1,1,2014)+1 cjd=systime(/utc,/julian) caldat,cjd,mm,dd,yy if mm lt 10 then mm='0'+strtrim(mm,2) else mm=strtrim(mm,2) if dd lt 10 then dd='0'+strtrim(dd,2) else dd=strtrim(dd,2) earg=strtrim(yy,2)+mm+dd+'24' datestr=mm+"/"+dd+"/"+strtrim(yy,2) cjd=cjd-julday(1,1,2014)+1 ;WBAND Motion acse_readcross,sarg,earg,cr_time,cr_pitch,cr_roll,cr_zacc,directory=motiondir,factor=cfactor,jtime=cr_jtime acse_readkongs,sarg,earg,ko_time,ko_pitch,ko_roll,ko_vel,directory=motiondir,factor=kfactor,jtime=ko_jtime endif ;get_data if run_analysis then begin ;make time array for analysis minwindow=5. ;minutes for the analysis window numd=ceil(max(cr_jtime)-cr_jtime[0]) leng=numd*24.*60./minwindow atime=findgen(leng)*minwindow/60./24.+sjd cr_pitchsd=fltarr(leng,3)*0-999. cr_rollsd=fltarr(leng,3)*0-999. ko_pitchsd=fltarr(leng,3)*0-999. ko_rollsd=fltarr(leng,3)*0-999. for i=0L,leng-2 do begin wh=where(cr_jtime ge atime[i] and cr_jtime lt atime[i+1],nm) if nm gt 2 then begin cr_pitchsd[i,*]=[stddev(cr_pitch[wh]),mean(cr_pitch[wh]),mean(abs(cr_pitch[wh]))] cr_rollsd[i,*]=[stddev(cr_roll[wh]),mean(cr_roll[wh]),mean(abs(cr_roll[wh]))] endif wh=where(ko_jtime ge atime[i] and ko_jtime lt atime[i+1],nm) if nm gt 2 then begin ko_pitchsd[i,*]=[stddev(ko_pitch[wh]),mean(ko_pitch[wh]),mean(abs(ko_pitch[wh]))] ko_rollsd[i,*]=[stddev(ko_roll[wh]),mean(ko_roll[wh]),mean(abs(ko_roll[wh]))] endif endfor endif ;run_analysis cd,plotdir loadct,44,file=colorfile window,0,xsize=500,ysize=600 pos=[.12,.07,.98,.95] pos1=[pos[0],pos[1]+(pos[3]-pos[1])*3./4,pos[2],pos[1]+(pos[3]-pos[1])*4./4] pos2=[pos[0],pos[1]+(pos[3]-pos[1])*2./4,pos[2],pos[1]+(pos[3]-pos[1])*3./4] pos3=[pos[0],pos[1]+(pos[3]-pos[1])*1./4,pos[2],pos[1]+(pos[3]-pos[1])*2./4] pos4=[pos[0],pos[1]+(pos[3]-pos[1])*0./4,pos[2],pos[1]+(pos[3]-pos[1])*1./4] blk=strarr(10)+' ' xra=[atime[0],max(atime)] plot,ko_jtime,ko_pitch,position=pos1,xrange=xra,/xstyle,ytitle='Pitch (deg)',xtickname=blk,yrange=[-1.6,1.4],/ystyle,$ title='ACSE W-Band Pitch Analysis (5-min)',/nodata,color=1 oplot,cr_jtime,cr_pitch,color=254 oplot,ko_jtime,ko_pitch,color=1 plots,xra,[0,0],color=200 plots,xra,[0.2,0.2],color=200,linestyle=1 plots,xra,[-0.2,-0.2],color=200,linestyle=1 xyouts,187.5,1.1,/data,'Kongsberg',color=1 xyouts,195,1.1,/data,'Crossbow',color=254 plot,atime,ko_pitchsd[*,1],position=pos2,/noerase,yrange=[-0.4,0.3],/ystyle,/xstyle,xrange=xra,ytitle='Mean (deg)',$ xtickname=blk,color=1 oplot,atime,cr_pitchsd[*,1],color=254 plots,xra,[0,0],color=200 plot,atime,ko_pitchsd[*,2],position=pos3,/noerase,yrange=[0,0.4],/ystyle,/xstyle,xrange=xra,ytitle='Mean Abs Dev (deg)',$ xtickname=blk,color=1 oplot,atime,cr_pitchsd[*,2],color=254 plots,xra,[0,0],color=1 plot,atime,ko_pitchsd[*,0],position=pos4,/noerase,yrange=[0,0.4],/ystyle,xtitle='Yearday',/xstyle,xrange=xra,$ ytitle='Stddev (deg)',color=1 oplot,atime,cr_pitchsd[*,0],color=254 ifile='acse.pitchanalysis.'+strmid(earg,0,8)+'.png' tvlct,r,g,b,/get write_png,ifile,tvrd(true=1),r,g,b plot,ko_jtime,ko_roll,position=pos1,xrange=xra,/xstyle,ytitle='Roll (deg)',xtickname=blk,yrange=[-3.5,3.5],/ystyle,$ title='ACSE W-Band Roll Analysis (5-min)',/nodata,color=1 oplot,cr_jtime,cr_roll,color=254 oplot,ko_jtime,ko_roll,color=1 plots,xra,[0,0],color=200 plots,xra,[0.2,0.2],color=200,linestyle=1 plots,xra,[-0.2,-0.2],color=200,linestyle=1 xyouts,187.5,2.5,/data,'Kongsberg',color=1 xyouts,195,2.5,/data,'Crossbow',color=254 plot,atime,ko_rollsd[*,1],position=pos2,/noerase,yrange=[-0.7,0.9],/ystyle,/xstyle,xrange=xra,ytitle='Mean (deg)',$ xtickname=blk,/nodata,color=1 oplot,atime,cr_rollsd[*,1],color=254 oplot,atime,ko_rollsd[*,1]*10.,color=1 plots,xra,[0,0],color=200 xyouts,187.5,-0.6,/data,'Kongsberg is x10 in this panel only',color=1 plot,atime,ko_rollsd[*,2],position=pos3,/noerase,yrange=[0,1],/ystyle,/xstyle,xrange=xra,ytitle='Mean Abs Dev (deg)',$ xtickname=blk,color=1 oplot,atime,cr_rollsd[*,2],color=254 plots,xra,[0,0],color=1 plot,atime,ko_rollsd[*,0],position=pos4,/noerase,yrange=[0,1],/ystyle,xtitle='Yearday',/xstyle,xrange=xra,$ ytitle='Stddev (deg)',color=1 oplot,atime,cr_rollsd[*,0],color=254 ifile='acse.rollanalysis.'+strmid(earg,0,8)+'.png' tvlct,r,g,b,/get write_png,ifile,tvrd(true=1),r,g,b window,0 !p.multi=[0,2,1] plot,cr_pitchsd[*,2],ko_pitchsd[*,2],psym=3,yrange=[0,0.2],xrange=[0,0.5],color=1,$ xtitle='Crossbow Pitch MAD_5min [deg]',ytitle='Kongsberg Pitch MAD_5min [deg]',$ title=' ACSE, Sensitivity of W-band motion to Ship motion (5-min)' plot,cr_rollsd[*,2],ko_rollsd[*,2],psym=3,yrange=[0,0.2],xrange=[0,1],color=1,$ xtitle='Crossbow Roll MAD_5min [deg]',ytitle='Kongsberg Roll MAD_5min [deg]' !p.multi=0 ifile='acse.sensanalysis.'+strmid(earg,0,8)+'.png' tvlct,r,g,b,/get write_png,ifile,tvrd(true=1),r,g,b end