;20160504 Ali ;creates tplot variables from data and pickup ion model results ;keywords: ; store: stores model-data comparisons in tplot variables (use with one of the following keywords) ; tplot: plots the main results (model-data comparison) or saved 3d tplots ; tohban: plots Tohban-related data ; savetplot: saves the tplots as png files ; swia3d: plots SWIA pickup hydrogen and oxygen 3d spectra ; stah3d: plots STATIC 3d spectra, pickup hydrogen, D1 data product, mass channel=0 or sum of 0,1,2 ; stao3d: plots STATIC 3d spectra, pickup oxygen, D1 data product, mass channel=4 or sum of 3,4,5 ; datimage: plots 3d data images instead of tplots (use instead of 'store' or 'tplot' with one of the above 3d keywords) ; modimage: plots 3d model images instead of tplots ; d2mimage: plots 3d images of data to model ratios ; trange: plots the above spectra for the specified trange ; explain these: denprof=denprof,d2mqf=d2mqf,denmap=denmap pro mvn_pui_tplot,store=store,tplot=tplot,tohban=tohban,savetplot=savetplot,_extra=_extra @mvn_pui_commonblock.pro ;common mvn_pui_common if ~keyword_set(pui) then begin dprint,'Please run mvn_pui_model first. returning...' return endif tplot_options,'no_interp',1 centertime=pui.centertime if keyword_set(store) then begin onesnt=replicate(1.,pui0.nt) store_data,'mvn_pui_line_1',data={x:centertime,y:onesnt},limits={colors:'g'} ;straight line equal to 1 store_data,'mvn_pos_(km)',data={x:centertime,y:transpose(pui.data.scp)/1e3},limits={colors:'bgr',labels:['x','y','z'],labflag:1} store_data,'mvn_sep1_fov',centertime,transpose(pui.data.sep[0].fov) store_data,'mvn_sep2_fov',centertime,transpose(pui.data.sep[1].fov) store_data,'mvn_stax_fov',centertime,transpose(pui.data.sta.fov.x) store_data,'mvn_staz_fov',centertime,transpose(pui.data.sta.fov.z) options,'mvn_*_fov',colors='bgr',panel_size=.5,yrange=[-1,1] mag=transpose(pui.data.mag.mso) emot=pui.model.params.kemax/pui.model.params.rg/2. ;motional electric field magnitude (V/m) nsw=pui.data.swi.swim.density ;solar wind density (cm-3) fsw=pui.data.swi.swim2.fsw ;solar wind number flux (cm-2 s-1) esw=1e-3*pui.data.swi.swim2.esw ;solar wind proton energy (keV) mfsw=pui.data.swi.swim2.mfsw ;solar wind proton momentum flux (g cm-1 s-2) efsw=pui.data.swi.swim2.efsw ;solar wind proton energy flux (eV cm-2 s-1) sintub=sqrt(pui.model[0:1].params.kemax/(4.*1e3*[1.,16.]#esw)) eden=pui.data.swe.eden ;swea electron density (cm-3) edenpot=pui.data.swe.edenpot ;swea electron density (cm-3) store_data,'mvn_mag_MSO_(nT)',data={x:centertime,y:1e9*[[onesnt-1.],[mag],[sqrt(total(mag^2,2))]]},limits={yrange:[-10,10],labels:['0','Bx','By','Bz','Btot'],colors:'cbgrk',labflag:1} store_data,'mvn_mag_Btot_(nT)',data={x:centertime,y:1e9*sqrt(total(mag^2,2))},limits={yrange:[.1,1000],ylog:1,ytickunits:'scientific',constant:[1,10,100]} store_data,'mvn_Nsw_(cm-3)',data={x:centertime,y:pui.data.swi.swim.density},limits={yrange:[.01,100],ylog:1,ytickunits:'scientific',constant:[.1,1,10]} store_data,'mvn_Vsw_MSO_(km/s)',data={x:centertime,y:[[onesnt-1.],[transpose(pui.data.swi.swim.velocity_mso)],[-pui.data.swi.swim2.usw]]},limits={labels:['0','Vx','Vy','Vz','-Vtot'],colors:'cbgrk',labflag:1,constant:[200,0,-200,-400,-600,-800,-1000]} store_data,'Sin(thetaUB)',data={x:centertime,y:transpose(sintub)},limits={yrange:[0,1]} store_data,'E_Motional_(V/km)',data={x:centertime,y:1e3*transpose(emot)},limits={yrange:[.01,10],ylog:1,ytickunits:'scientific'} store_data,'Pickup_Gyro_Period_(sec)',data={x:centertime,y:transpose(pui.model[0:1].params.tg)},limits={yrange:[1,1e3],ylog:1,labels:['H+','O+'],colors:'br',labflag:1,ytickunits:'scientific'} store_data,'Pickup_Gyro_Radius_(1000km)',data={x:centertime,y:transpose(pui.model[0:1].params.rg/1e6)},limits={yrange:[.1,100],ylog:1,labels:['H+','O+'],colors:'br',labflag:1,ytickunits:'scientific'} store_data,'Pickup_Max_Energy_(keV)',data={x:centertime,y:[[transpose(pui.model[0:1].params.kemax/1e3)],[esw],[4*esw],[4*16*esw]]},limits={yrange:[.1,300],ylog:1,labels:['H+','O+','SWIA','4xSWIA','64xSWIA'],colors:'brgcm',labflag:1,ytickunits:'scientific'} store_data,'Pickup_Number_Density_(cm-3)',data={x:centertime,y:[[transpose(pui.model[0:1].params.totnnn)],[nsw],[eden],[edenpot]]},limits={yrange:[.001,100],ylog:1,labels:['H+','O+','SWIA','SWEA','SWEApot'],colors:'brgcm',labflag:1,ytickunits:'scientific'} store_data,'Pickup_Number_Flux_(cm-2.s-1)',data={x:centertime,y:[[transpose(pui.model[0:1].params.totphi)],[fsw]]},limits={yrange:[1e4,1e9],ylog:1,labels:['H+','O+','SWIA'],colors:'brg',labflag:1} store_data,'Pickup_Momentum_Flux_(g.cm-1.s-2)',data={x:centertime,y:[[transpose(pui.model[0:1].params.totmph)],[mfsw]]},limits={yrange:[1e-11,1e-7],ylog:1,labels:['H+','O+','SWIA'],colors:'brg',labflag:1} store_data,'Pickup_Energy_Flux_(eV.cm-2.s-1)',data={x:centertime,y:[[transpose(pui.model[0:1].params.toteph)],[efsw]]},limits={yrange:[1e8,1e12],ylog:1,labels:['H+','O+','SWIA'],colors:'brg',labflag:1} store_data,'O+_Max_Energy_(keV)',centertime,pui.model[1].params.kemax/1e3 ;pickup oxygen max energy (keV) store_data,'mvn_model_puh_tot',data={x:centertime,y:transpose(pui.model[0].fluxes.toteflux),v:pui1.totet},limits={ylog:1,zlog:1,spec:1,yrange:[10.,30e3],zrange:[1e2,1e6],ztitle:'Eflux'} store_data,'mvn_model_puo_tot',data={x:centertime,y:transpose(pui.model[1].fluxes.toteflux),v:pui1.totet},limits={ylog:1,zlog:1,spec:1,yrange:[100.,300e3],zrange:[1e2,1e6],ztitle:'Eflux'} ;store_data,'mvn_model_pux_tot',data={x:centertime,y:transpose(pui.model[2].fluxes.toteflux),v:pui1.totet},limits={ylog:1,zlog:1,spec:1,yrange:[10.,300e3],zrange:[1e2,1e6],ztitle:'Eflux'} for i=0,1 do begin ;loop over 2 seps sepm=pui.model[1].fluxes.sep[i].model_rate sepd=pui.data.sep[i].rate_bo sepmtot=total(sepm[2:16,*],1) ;sep model tot 10