1 %% Plot the data specified in Plot.m
3 % PLOT_3PIC plots the data values in column-wise fashion, where each
4 % column represents a different energy level (0.5 MeV, 1.0 MeV, 2.0 MeV).
6 % For each energy level, PLOT_3PIC produces a pitch-angle scattering plot,
7 % a
PSD plot, and a lifetime decay plot (see figures in paper for
15 figure(
'Units',
'inches',
'Position', [1 1 10 8],...
16 'DefaultAxesFontName',
'times new roman',
'DefaultAxesFontWeight',
'bold',
'DefaultAxesFontSize', FontSize,...
17 'PaperOrientation',
'portrait',
'PaperPositionMode',
'auto',
'DefaultTextFontWeight',
'bold');
19 % change target_en_list
for more options
20 %
this array hosts the different energy levels we are measuring
21 target_en_list = [0.5 1 2]; % 0.5, 1,0, 2.0 MeV
25 % For each energy level,
26 for i = 1:numel(target_en_list)
28 target_en = target_en_list(i);
32 folder_name1=['../Execute/Output_', FIGURE, '/'];
35 xmin1=0; % lower and upper x bounds
37 ymin1=DxxYLim(1); % lower and upper y bounds
50 text1=['E=' num2str(target_en) ' MeV'];
52 text3=' Chorus and EMIC ';
57 output_formats = [{
'png'}];%{
'epsc'}];%,{
'pdf'}];%[{'fig'}, {'ai'}, , ];
63 folder_name=folder_name1;
66 dataFileName = [folder_name,'OutPSD.dat'];
67 gridFileName = [folder_name,'perp_grid.plt'];
68 oneDimDataFileName = [folder_name,'out1d.dat'];
69 %----------------------------------
70 % Pitch Angle Scattering plot
71 sb=subplot(3,nfolders,col_num);
73 DxxPLTcell = cell(size(DxxFiles));
74 for iDxx = 1:numel(DxxFiles)
75 DxxPLT.DxxFileName = [folder_name,'../DiffCoeff/' DxxFiles{iDxx}];
77 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
78 % Loading grid and data
79 [~,DxxPLT.en,DxxPLT.alpha, DxxPLT.f_var] = load_plt(DxxPLT.DxxFileName,
'squeeze');
81 [~,ind_target_en] = min(abs(DxxPLT.en.arr(:,1) - target_en ));
82 DxxPLT.alpha.arr = squeeze( DxxPLT.alpha.arr(ind_target_en,:)*180/pi );
83 DxxPLT.x_var = DxxPLT.alpha;
85 DxxPLT.f_var.arr = squeeze(DxxPLT.f_var.arr(ind_target_en,:));
87 plot(DxxPLT.x_var.arr, DxxPLT.f_var.arr, DxxColors{iDxx},
'LineWidth', 2);
91 ylabel(
'D_{\alpha\alpha}, days^{-1}')
93 text(xtext_loc, ytext_loc, text_cur)
95 set(gca, 'yscale', 'log', 'xlim', [xmin1 xmax1], 'ylim', [ymin1 ymax1],'ytick',10.^[log10(DxxYLim(1)):1:log10(DxxYLim(2))]);
97 legend(DxxNames,'Location','northwest','FontSize',6);
99 %----------------------------------
100 % Phase Space Density Plot
102 [L, epc, alpha] = load_plt(gridFileName, 'squeeze');
103 %alpha.arr = alpha.arr*180/pi;
104 alpha.arr = squeeze(alpha.arr(ind_target_en,:))*180/pi;
106 [f_var] = load_plt(dataFileName);
107 f_var.arr = squeeze(f_var.arr(:,ind_target_en,:));
110 %subplot('Position', pos2);
111 sb=subplot(3,nfolders,col_num+nfolders);
112 %set(sb,'ActivePositionProperty', 'outerposition' )
114 cmap = jet(size(f_var.arr,1));
115 % black for first color
116 cmap(1, :) = [0, 0, 0];
118 set(gca, 'ColorOrder', cmap, 'NextPlot', 'replacechildren', 'Box', 'on');
119 plot(x_var.arr, f_var.arr', 'LineWidth', 1);
120 ylabel('Phase Space Density')
121 xlabel('Pitch Angle')
123 set(gca, 'yscale', 'log', 'xlim', [xmin2 xmax2], 'ylim', [ymin2 ymax2],'ytick',10.^[log10(PSDYLim(1)):1:log10(PSDYLim(2))]);
125 % loading various 1d data
126 [time, Kp, Boundary_fluxes, Lpp, Bw] = load_plt(oneDimDataFileName, 'squeeze');
127 caxis([0
max(time.arr)]);
129 % Draw colorbar after Row 2
130 if (col_num==nfolders)
133 set(cl,'Position', [0.918,0.429,0.018 0.177])%('Position', [(pos2(1)+pos2(3)+1-cbar)/2, pos2(2), cbar/2, pos2(4)]);
136 %----------------------------------
137 % Lifetime Decay Plot
139 sb=subplot(3,nfolders,col_num+2*nfolders);
141 it = (length(time.arr)-1);
142 dt = time.arr(it+1) - time.arr(it);
143 % decay.arr=zeros(time.size1,f_var.size1);
144 % for it=1:time.size1-1
145 % decay.arr(it,:)= (f_var.arr(it+1, :) + f_var.arr(it, :)).*dt./(f_var.arr(it, :) - f_var.arr(it+1, :))./2;
147 decay.arr = (f_var.arr(it+1, :) + f_var.arr(it, :)).*dt./(f_var.arr(it, :) - f_var.arr(it+1, :))./2;
148 % cmap = jet(size(f_var.arr,1));
149 % % black for first color
150 % cmap(1, :) = [0, 0, 0];
152 set(gca, 'yscale', 'linear','ColorOrder', cmap, 'NextPlot', 'replacechildren', 'Box', 'on');
153 plot(alpha.arr, decay.arr,'k', 'LineWidth', 2);
154 set(gca, 'xlim', [xmin3 xmax3], 'ylim', [ymin3 ymax3]);
155 ylabel('Decay time, days');
158 %caxis([0
max(time.arr)]);
159 %colorbar%('Position', [(pos2(1)+pos2(3)+1-cbar)/2, pos2(2), cbar/2, pos2(4)]);
161 %set(cl, 'Visible','off')
165 % for it = 1:
max(size(output_formats))
166 % % saveas(
gcf, [Plot_file_name, '.', output_formats{it}], output_formats{it});
167 % eval([
'print -d', output_formats{it},
' ', Plot_file_name,
'.', output_formats{it}]);
170 %print -r2048 -dpdf test.pdf
double max(double v1, double v2)
Return maximum.
void gcf(double *gammcf, double a, double x, double *gln)
Returns the incomplete gamma function Q(a, x) evaluated by its continued fraction representation as g...
Phase Space Density class.
Parameters_structure parameters
Parameters structure, with all parameters from the parameters.ini file. The default parameters define...