fproc_hxr

PURPOSE ^

SYNOPSIS ^

function [hxr_proc,hxr,data_proc] = fproc_hxr(basestr,hxr_path,load_id,hxr_file,exp_file,texp,ic,krange,opt,display_mode,p_opt)

DESCRIPTION ^

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function [hxr_proc,hxr,data_proc] = fproc_hxr(basestr,hxr_path,load_id,hxr_file,exp_file,texp,ic,krange,opt,display_mode,p_opt)
0002 %
0003 if nargin < 11,
0004     p_opt = -1;
0005 end
0006 %
0007 if nargin < 10,
0008     display_mode = 0;
0009 end
0010 %
0011 if nargin < 9,
0012     opt.save = 0;
0013 end
0014 %
0015 if nargin < 8,
0016     krange = NaN;
0017 end
0018 %
0019 if nargin < 7,
0020     ic = NaN;
0021 end
0022 %
0023 if nargin < 6,
0024     texp = NaN;
0025 end
0026 %
0027 opt_save_0 = opt.save;
0028 %
0029 dt = diff(texp);
0030 %
0031 %
0032 % This function processes (and eventually displays) HXR data
0033 %
0034 %
0035 datafile1 = ['LUKE_RESULTS_',load_id,'.mat'];
0036 datafile2 = ['LUKE_DATA_',load_id,'.mat'];
0037 datafile3 = ['LUKE_BACKUP_',load_id,'.mat'];
0038 proc_datafile1 = ['PROC_',datafile1];
0039 proc_datafile2 = ['PROC_',datafile2];
0040 proc_datafile3 = ['PROC_',datafile3];
0041 hxr_datafile = ['HXR_RESULTS_',load_id,'.mat'];
0042 proc_hxr_datafile = ['PROC_HXR_RESULTS_',load_id,'.mat'];
0043 %
0044 hxrdata = 0;
0045 procdata = 0;
0046 %
0047 hxr = '';
0048 data_proc = '';
0049 hxr_proc = '';
0050 %
0051 if hxrdata == 0 && exist([hxr_path,proc_datafile1],'file') && (gettime_jd(proc_datafile1,hxr_path) > gettime_jd(datafile1,hxr_path)),
0052     %
0053     load([hxr_path,proc_datafile1],'data_proc');
0054 %     data = load([hxr_path,datafile1]);
0055 %     data_proc_tmp = proc_luke_jd(data,-1,-1,0.1,NaN,'',opt);
0056 %     data_proc.scalar.I_exp = data_proc_tmp.scalar.I_exp;
0057 %     save([hxr_path,proc_datafile1],'data_proc');
0058     %
0059     procdata = 1;
0060     %
0061     disp(['LUKE data loaded from file ',hxr_path,proc_datafile1])
0062     %
0063     if isfield(data_proc,'hxr'),
0064         hxr = data_proc.hxr;
0065         opt.save = 0;
0066         %
0067         hxrdata = 1;
0068         %
0069         disp(['HXR data loaded from file ',hxr_path,proc_datafile1])
0070         %
0071     end
0072     %
0073     if isstruct(hxr), 
0074         if ~isfield(hxr,'dt')
0075             if isnan(dt),
0076                 error('No value found for dt as input or from PROC_RESULT file')
0077             else
0078                 hxr.dt = dt;
0079                 disp(['Warning : input dt = ',num2str(dt),' enforced, No value found for dt in PROC_RESULT file'])
0080                 if opt_save_0 == 1,
0081                     opt.save = 1;
0082                 end
0083             end
0084         elseif ~isempty(dt) && ~isnan(dt) && abs(dt - hxr.dt)/dt > 1e-2,
0085             disp(['Warning : input dt = ',num2str(dt),' discarded, PROC_RESULT file dt = ',num2str(hxr.dt),' enforced.'])
0086         end
0087     end
0088     datafile = datafile1;
0089     %
0090 end
0091 %
0092 if hxrdata == 0 && exist([hxr_path,proc_datafile2],'file') && (gettime_jd(proc_datafile2,hxr_path) > gettime_jd(datafile2,hxr_path)),
0093     %
0094     load([hxr_path,proc_datafile2],'data_proc');
0095     %
0096     procdata = 1;
0097     %
0098     disp(['LUKE data loaded from file ',hxr_path,proc_datafile2])
0099     %
0100     if isfield(data_proc,'hxr'),
0101         hxr = data_proc.hxr;
0102         opt.save = 0;
0103         %
0104         hxrdata = 1;
0105         %
0106         disp(['HXR data loaded from file ',hxr_path,proc_datafile2])
0107         %
0108     end
0109     %
0110     if isstruct(hxr),
0111         if ~isfield(hxr,'dt')
0112             if isnan(dt),
0113                 error('No value found for dt as input or from PROC_DATA file')
0114             else
0115                 hxr.dt = dt;
0116                 disp(['Warning : input dt = ',num2str(dt),' enforced, No value found for dt in PROC_DATA file'])
0117                 if opt_save_0 == 1,
0118                     opt.save = 1;
0119                 end
0120             end
0121         elseif ~isempty(dt) && ~isnan(dt) && abs(dt - hxr.dt)/dt > 1e-2,
0122             disp(['Warning : input dt = ',num2str(dt),' discarded, PROC_DATA file dt = ',num2str(hxr.dt),' enforced.'])
0123         end
0124     end
0125     datafile = datafile2;
0126     %
0127 end
0128 %
0129 if hxrdata == 0 && exist([hxr_path,proc_datafile3],'file') && (gettime_jd(proc_datafile3,hxr_path) > gettime_jd(datafile3,hxr_path)),
0130     %
0131     load([hxr_path,proc_datafile3],'data_proc');
0132     %
0133     procdata = 1;
0134     %
0135     disp(['LUKE data loaded from file ',hxr_path,proc_datafile3])
0136     %
0137     if isfield(data_proc,'hxr'),
0138         hxr = data_proc.hxr;
0139         opt.save = 0;
0140         %
0141         hxrdata = 1;
0142         %
0143         disp(['HXR data loaded from file ',hxr_path,proc_datafile3])
0144         %
0145     end
0146     %
0147     if isstruct(hxr),
0148         if ~isfield(hxr,'dt')
0149             if isnan(dt),
0150                 error('No value found for dt as input or from PROC_DATA file')
0151             else
0152                 hxr.dt = dt;
0153                 disp(['Warning : input dt = ',num2str(dt),' enforced, No value found for dt in PROC_DATA file'])
0154                 if opt_save_0 == 1,
0155                     opt.save = 1;
0156                 end
0157             end
0158         elseif ~isempty(dt) && ~isnan(dt) && abs(dt - hxr.dt)/dt > 1e-2,
0159             disp(['Warning : input dt = ',num2str(dt),' discarded, PROC_DATA file dt = ',num2str(hxr.dt),' enforced.'])
0160         end
0161     end
0162     datafile = datafile3;
0163     %
0164 end
0165 %
0166 if exist([hxr_path,proc_hxr_datafile],'file') && (gettime_jd(proc_hxr_datafile,hxr_path) > gettime_jd(hxr_datafile,hxr_path)),
0167     %
0168     load([hxr_path,proc_hxr_datafile],'hxr');
0169     %
0170     if ~isempty(dt) && ~isnan(dt) && abs(dt - hxr.dt)/dt > 1e-2,
0171         disp(['Warning : input dt = ',num2str(dt),' discarded, HXR file dt = ',num2str(hxr.dt),' enforced.'])
0172     end
0173     %
0174     hxrdata = 1;
0175     opt.save = 0;
0176     %
0177     disp(['HXR data loaded from file ',hxr_path,proc_hxr_datafile])
0178     %
0179 end
0180 %
0181 if hxrdata == 0 && exist([hxr_path,hxr_datafile],'file'),
0182     %
0183     load([hxr_path,hxr_datafile],'Zbremdiag','hxrexp');
0184     %
0185     hxr.kfit = Zbremdiag.kfit;
0186     hxr.brem_bd_plasma = Zbremdiag.brem_bd_plasma;
0187     hxr.brem_bd_diag = Zbremdiag.brem_bd_diag;
0188     hxr.dt = Zbremdiag.dt;
0189     hxr.hxrexp = hxrexp.';
0190     %
0191     if ~isempty(dt) && ~isnan(dt) && abs(dt - hxr.dt)/dt > 1e-2,
0192         disp(['Warning : input dt = ',num2str(dt),' discarded, HXR file dt = ',num2str(hxr.dt),' enforced.'])
0193     end
0194     %
0195     clear Zbremdiag hxrexp dt
0196     %
0197     hxrdata = 1;
0198     datafile = hxr_datafile;
0199     %
0200     disp(['HXR data loaded from file ',hxr_path,hxr_datafile])
0201     %
0202 end
0203 %
0204 if hxrdata == 0 && exist([hxr_path,datafile1],'file'),
0205     %
0206     data = load([hxr_path,datafile1]);
0207     %
0208     disp(['LUKE data loaded from file ',hxr_path,datafile1])
0209     %
0210     if procdata == 0,
0211         %
0212         data_proc = proc_luke_jd(data,-1,-1,0.1,NaN,'',opt);
0213         %
0214         procdata = 1;
0215         %
0216     end
0217     %
0218     if isempty(hxr_file),
0219         error('No HXR spec file specified')
0220     end
0221     %
0222     hxrdata = runhxr_jd(data,basestr,hxr_file,exp_file,hxr_path,texp);
0223     %
0224     hxr.kfit = hxrdata.Zbremdiag.kfit;
0225     hxr.brem_bd_plasma = hxrdata.Zbremdiag.brem_bd_plasma;
0226     hxr.brem_bd_diag = hxrdata.Zbremdiag.brem_bd_diag;
0227     hxr.dt = hxrdata.Zbremdiag.dt;
0228     hxr.hxrexp = hxrdata.hxrexp.';
0229     %
0230     if ~isempty(dt) && ~isnan(dt) && abs(dt - hxr.dt)/dt > 1e-2,
0231         disp(['Warning : input dt = ',num2str(dt),' discarded, PROC_RESULTS file dt = ',num2str(hxr.dt),' enforced.'])
0232     end
0233     %
0234     clear data hxrdata 
0235     %
0236     hxrdata = 1;
0237     datafile = datafile1;
0238     %
0239 end
0240 %
0241 if hxrdata == 0 && exist([hxr_path,datafile2],'file'),
0242     %
0243     data = load([hxr_path,datafile2]);
0244     %
0245     disp(['LUKE data loaded from file ',hxr_path,datafile2])
0246     %
0247     if procdata == 0,
0248         %
0249         data_proc = proc_luke_jd(data.output,-1,-1,0.1,NaN,'',opt);
0250         %
0251         procdata = 1;
0252         %
0253     end
0254     %
0255     if isempty(hxr_file),
0256         error('No HXR spec file specified')
0257     end
0258     %
0259     hxrdata = runhxr_jd(data,basestr,hxr_file,exp_file,hxr_path,texp);
0260     %
0261     hxr.kfit = hxrdata.Zbremdiag.kfit;
0262     hxr.brem_bd_plasma = hxrdata.Zbremdiag.brem_bd_plasma;
0263     hxr.brem_bd_diag = hxrdata.Zbremdiag.brem_bd_diag;
0264     hxr.dt = hxrdata.Zbremdiag.dt;
0265     hxr.hxrexp = hxrdata.hxrexp.';
0266     %
0267     if ~isempty(dt) && ~isnan(dt) && abs(dt - hxr.dt)/dt > 1e-2,
0268         disp(['Warning : input dt = ',num2str(dt),' discarded, PROC_DATA file dt = ',num2str(hxr.dt),' enforced.'])
0269     end
0270     %
0271     clear data hxrdata 
0272     %
0273     hxrdata = 1;
0274     datafile = datafile2;
0275     %
0276 end
0277 %
0278 if hxrdata == 0 && exist([hxr_path,datafile3],'file'),
0279     %
0280     data = load([hxr_path,datafile3]);
0281     %
0282     disp(['LUKE data loaded from file ',hxr_path,datafile3])
0283     %
0284     data = proc_backup_jd(data,opt);
0285     %
0286     if procdata == 0,
0287         %
0288         data_proc = proc_luke_jd(data,-1,-1,0.1,NaN,'',opt);
0289         %
0290         procdata = 1;
0291         %
0292     end
0293     %
0294     if isempty(hxr_file),
0295         error('No HXR spec file specified')
0296     end
0297     %
0298     hxrdata = runhxr_jd(data,basestr,hxr_file,exp_file,hxr_path,texp);
0299     %
0300     hxr.kfit = hxrdata.Zbremdiag.kfit;
0301     hxr.brem_bd_plasma = hxrdata.Zbremdiag.brem_bd_plasma;
0302     hxr.brem_bd_diag = hxrdata.Zbremdiag.brem_bd_diag;
0303     hxr.dt = hxrdata.Zbremdiag.dt;
0304     hxr.hxrexp = hxrdata.hxrexp.';
0305     %
0306     if ~isempty(dt) && ~isnan(dt) && abs(dt - hxr.dt)/dt > 1e-2,
0307         disp(['Warning : input dt = ',num2str(dt),' discarded, PROC_RESULTS file dt = ',num2str(hxr.dt),' enforced.'])
0308     end
0309     %
0310     clear data hxrdata 
0311     %
0312     hxrdata = 1;
0313     datafile = datafile1;
0314     %
0315 end
0316 %
0317 if hxrdata == 0,
0318     disp('Warning : No data found, aborted')
0319     return
0320 end
0321 %
0322 if opt.save,
0323     %
0324     if procdata == 1,
0325         %
0326         data_proc.hxr = hxr;
0327         %
0328         save([hxr_path,'PROC_',datafile],'data_proc');
0329         %
0330     else
0331         %
0332         save([hxr_path,'PROC_',datafile],'hxr');
0333         %
0334     end
0335 end
0336 %
0337 nc = length(ic);
0338 %
0339 %dt = hxr.dt;
0340 if strcmp(basestr,'TS'),
0341     dt = 0.016;%hxr.dt;%sampling time
0342 elseif strcmp(basestr,'TCV'),
0343     dt = 0.0025;
0344 else
0345     error('this machine is not implemented yet')
0346 end
0347 %
0348 ikfitmin = find(hxr.kfit >= krange(1),1,'first');
0349 ikfitmax = find(hxr.kfit <= krange(2),1,'last');
0350 ik = ikfitmin:ikfitmax;
0351 nk = length(ik);
0352 %
0353 hxr_proc.k = hxr.kfit;
0354 hxr_proc.ik = ik;
0355 hxr_proc.ic = ic;
0356 hxr_proc.dNdtplasma = hxr.brem_bd_plasma.';
0357 hxr_proc.dNdtdiag = hxr.brem_bd_diag.';
0358 hxr_proc.dNdtexp = hxr.hxrexp.';
0359 %
0360 hxr_proc.dvarplasmak = abs(sum(hxr.brem_bd_plasma(ic,ik)) - sum(hxr.hxrexp(ic,ik)))./abs(sum(hxr.hxrexp(ic,ik)));
0361 hxr_proc.dvarplasma = sqrt(sum(hxr_proc.dvarplasmak.^2))/nk;        
0362 %
0363 hxr_proc.dvardiagk = abs(sum(hxr.brem_bd_diag(ic,ik)) - sum(hxr.hxrexp(ic,ik)))./abs(sum(hxr.hxrexp(ic,ik)));
0364 hxr_proc.dvardiag = sqrt(sum(hxr_proc.dvardiagk.^2))/nk;        
0365 %
0366 [hxr_proc.Tphplasma,hxr_proc.eTphplasma,hxr_proc.Aplasma,hxr_proc.eAplasma,hxr_proc.Qplasma] = ...
0367     tphfit_dke_yp(repmat(hxr_proc.k(ik).',[1,nc]),dt*hxr.brem_bd_plasma(ic,ik).',sqrt(dt*hxr.brem_bd_plasma(ic,ik)).');
0368 [hxr_proc.Tphdiag,hxr_proc.eTphdiag,hxr_proc.Adiag,hxr_proc.eAdiag,hxr_proc.Qdiag] = ...
0369     tphfit_dke_yp(repmat(hxr_proc.k(ik).',[1,nc]),dt*hxr.brem_bd_diag(ic,ik).',sqrt(dt*hxr.brem_bd_diag(ic,ik)).');
0370 [hxr_proc.Tphexp,hxr_proc.eTphexp,hxr_proc.Aexp,hxr_proc.eAexp,hxr_proc.Qexp] = ...
0371     tphfit_dke_yp(repmat(hxr_proc.k(ik).',[1,nc]),dt*hxr.hxrexp(ic,ik).',sqrt(dt*hxr.hxrexp(ic,ik)).');
0372 %
0373 %hxr_proc.icpeak = ic(find(sum(hxr.brem_bd_diag(ic,ik),2) == max(sum(hxr.brem_bd_diag(ic,ik),2)),1,'first'));
0374 hxr_proc.icpeak = ic(find(sum(hxr.brem_bd_plasma(ic,ik),2) == max(sum(hxr.brem_bd_plasma(ic,ik),2)),1,'first'));
0375 %
0376 if isfield(opt,'diaryname') && ~isempty(opt.diaryname),
0377     diary(opt.diaryname)
0378     disp(' ');
0379     disp(' ---- HXR results on the central chord ---- ');
0380     disp(' ');
0381     %
0382     disp('k (keV) | CR exp (1/ms) | CR sim (1/ms)')
0383     %
0384     for iik = 1:length(hxr_proc.k),
0385         sk = num2str(hxr_proc.k(iik),3);
0386         sdNdtdiag_iikiicc = num2str(hxr_proc.dNdtdiag(iik,opt.icc),'%6.2f');
0387         sdNdtexp_iikiicc = num2str(hxr_proc.dNdtexp(iik,opt.icc),'%6.2f');
0388         %
0389         disp(['  ',repmat(' ',[1,3-length(sk)]),sk,'   |   ',repmat(' ',[1,9-length(sdNdtexp_iikiicc)]),sdNdtexp_iikiicc,'   |   ',repmat(' ',[1,9-length(sdNdtdiag_iikiicc)]),sdNdtdiag_iikiicc])
0390         %
0391     end
0392     diary off;
0393 end    
0394 %
0395 if display_mode > 0,
0396     %
0397     style0 = 'none';
0398     style = '-';
0399     style2 = '--';
0400     marker = 'none';
0401     marker1 = '+';
0402     marker2 = 'o';
0403     marker3 = 's';
0404     marker4 = '.';
0405     markers = {marker1,marker2,marker3};
0406     color = NaN;
0407     color1 = 'k';
0408     color2 = 'r';
0409     color3 = 'b';
0410     color4 = 'g';
0411     color5 = 'm';
0412     color6 = 'c';
0413     colors = {color2,color3,color4};
0414     %
0415     width = 0.5;
0416     width2 = 2;
0417     siz = 20+14*1i;
0418     %
0419     red = 0.9;
0420     lspace = 0.7;
0421     lspace2 = 0.5;
0422     bspace = 0.7;
0423     bspace2 = 0.5;
0424     %
0425     n1 = 3;
0426     siz = 14+10*1i;
0427     %
0428     k = hxr_proc.k(ik);
0429     dNdtplasma = hxr_proc.dNdtplasma(ik,ic);
0430     dNdtdiag = hxr_proc.dNdtdiag(ik,ic);
0431     dNdtexp = hxr_proc.dNdtexp(ik,ic);
0432     %
0433     if isfield(opt,'icrej_exp') && ~isempty(opt.icrej_exp),
0434         maskic_exp = ~any(repmat(ic,[length(opt.icrej_exp),1]) == repmat(opt.icrej_exp.',[1,length(ic)]),1);
0435     else
0436         maskic_exp = true(1,nc);
0437     end
0438     %
0439     xlab = 'Chord #';
0440     xlim = [min(ic)-1,max(ic)+1];
0441     xtick = 0:5:60;
0442     %
0443     xlab2 = 'Photon Energy (keV)';
0444     xlim2 = [0,2*k(end) - k(end-1)];
0445     xtick2 = k;
0446     %
0447     ylim = NaN;
0448     %ytick = 0:500:2500;
0449     leg = {'sim.','exp.'};%{'plasma','diag.','exp.'};%
0450     %
0451     if display_mode > 1,
0452         %
0453         figure(51),clf,set(51,'name','profile per channel')
0454         %
0455         ylab = 'dN/dt [s^{-1}]';
0456         n2 = ceil(nk/n1);
0457         %
0458         for iik = 1:nk,
0459             %
0460             subplot(n1,n2,iik)
0461             %
0462             tit = ['Pulse count rate, E=',num2str(k(iik)),' keV'];
0463             %
0464             %graph1D_jd(ic,dNdtplasma(iik,:),0,0,'','','',NaN,xlim,ylim,style,marker,color1,width2,siz);
0465             graph1D_jd(ic,dNdtdiag(iik,:),0,0,'','','',NaN,xlim,ylim,style,marker,color2,width2,siz);
0466             graph1D_jd(ic,dNdtexp(iik,:),0,0,xlab,ylab,tit,leg,xlim,ylim,style2,marker,color3,width2,siz,gca,red);
0467             %
0468             set(gca,'xtick',xtick);
0469             %set(gca,'ytick',ytick);
0470             %
0471         end
0472         %
0473         print_jd(p_opt,['Fig_hxrcomp_',load_id],[hxr_path,'figures'],51);
0474         %
0475         %
0476         figure(52),clf,set(52,'name','spectrum per chord')
0477         %
0478         n2 = ceil(nc/n1);
0479         %
0480         for iic = 1:nc,
0481             %
0482             subplot(n1,n2,iic)
0483             %
0484             tit = ['Pulse count rate, chord # ',num2str(ic(iic))];
0485             %
0486             %graph1D_jd(k,dNdtplasma(:,iic),0,1,'','','',NaN,xlim2,ylim,style,marker,color1,width2,siz);
0487             graph1D_jd(k,dNdtdiag(:,iic),0,1,'','','',NaN,xlim2,ylim,style,marker,color2,width2,siz);
0488             graph1D_jd(k,dNdtexp(:,iic),0,1,xlab2,ylab,tit,leg,xlim2,ylim,style2,marker,color3,width2,siz,gca,red);
0489             %
0490             set(gca,'xtick',xtick2);
0491             %set(gca,'ytick',ytick);
0492             %
0493         end
0494         %
0495         print_jd(p_opt,['Fig_hxrcomp_spec_',load_id],[hxr_path,'figures'],52);
0496         %
0497     end
0498     %
0499     figure(53),clf,set(53,'Name','Count rate')
0500     %
0501     kmin = min(k);
0502     kmax= max(k);
0503     %
0504     ylab = ['Count rate (s^{-1}) [',num2str(kmin),' - ',num2str(kmax),' keV]'];
0505     tit = '';
0506     %
0507     %Nplasma = sum(dNdtplasma,1);%Count rate
0508     Ndiag = sum(dNdtdiag,1);%Count rate
0509     Nexp = sum(dNdtexp,1);%Count rate
0510     %
0511     %graph1D_jd(ic,Nplasma,0,0,'','','',NaN,xlim,ylim,style,marker,color1,width2,siz,gca,1,lspace,bspace,sqrt(Nplasma/dt));
0512     graph1D_jd(ic,Ndiag,0,0,'','','',NaN,xlim,ylim,style,marker,color2,width2,siz,gca,1,lspace,bspace,sqrt(Ndiag/dt));
0513     graph1D_jd(ic(maskic_exp),Nexp(maskic_exp),0,0,xlab,ylab,tit,leg,xlim,ylim,style,marker,color3,width2,siz,gca,red,lspace,bspace,sqrt(Nexp(maskic_exp)/dt));
0514     %
0515     set(gca,'xtick',xtick);
0516     %set(gca,'ytick',ytick);
0517     %
0518     print_jd(p_opt,['Fig_hxrcomp_tot_',load_id],[hxr_path,'figures'],53);
0519     %
0520     %
0521     figure(54),clf,set(54,'Name','Normalized count rate')
0522     %
0523     ylab = 'Normalized count rate';
0524     ylim = [0,1.2];
0525     ytick = 0:0.2:1.2;
0526     %
0527     %nNplasma = Nplasma/Nplasma(ic == opt.icc);%Count rate
0528     nNdiag = Ndiag/Ndiag(ic == opt.icc);%Count rate
0529     nNexp = Nexp/Nexp(ic == opt.icc);%Count rate
0530     %
0531     %enNplasma = sqrt(Nplasma/dt)/Nplasma(ic == opt.icc);%Count rate
0532     enNdiag = sqrt(Ndiag/dt)/Ndiag(ic == opt.icc);%Count rate
0533     enNexp = sqrt(Nexp/dt)/Nexp(ic == opt.icc);%Count rate
0534     %
0535     %graph1D_jd(ic,nNplasma,0,0,'','','',NaN,xlim,ylim,style,marker,color1,width2,siz,gca,1,lspace,bspace,enNplasma);
0536     graph1D_jd(ic,nNdiag,0,0,'','','',NaN,xlim,ylim,style,marker,color2,width2,siz,gca,1,lspace,bspace,enNdiag);
0537     graph1D_jd(ic(maskic_exp),nNexp(maskic_exp),0,0,xlab,ylab,tit,leg,xlim,ylim,style,marker,color3,width2,siz,gca,red,lspace,bspace,enNexp(maskic_exp));
0538     %
0539     set(gca,'xtick',xtick);
0540     %set(gca,'ytick',ytick);
0541     %
0542     print_jd(p_opt,['Fig_hxrcomp_norm_',load_id],[hxr_path,'figures'],54);
0543     %
0544     %
0545     figure(55),clf,set(55,'Name','Normalized exp emission')
0546     %
0547     Nnorm = dNdtexp.'./repmat(max(dNdtexp.'),[nc,1]);
0548     eNnorm = sqrt(dNdtexp.'/dt)./repmat(max(dNdtexp.'),[nc,1]);
0549     %
0550     for iik = 1:nk,
0551         leg2{iik} = ['k = ',num2str(k(iik)),' keV'];
0552     end
0553     %
0554     graph1D_jd(repmat(ic(maskic_exp).',[1,nk]),Nnorm(maskic_exp,:),0,0,xlab,ylab,tit,leg2,xlim,ylim,...
0555         style,marker,color,width2,siz,gca,red,lspace,bspace,eNnorm(maskic_exp,:));
0556     %
0557     set(gca,'xtick',xtick);
0558     set(gca,'ytick',ytick);
0559     %
0560     print_jd(p_opt,['Fig_countrate_exp_',load_id],[hxr_path,'figures'],55);
0561     %
0562     %
0563     maskplasma = 1 - hxr_proc.Qplasma < 1e-1;%1e-2;%1e-4;
0564     maskdiag = 1 - hxr_proc.Qdiag < 1e-1;%1e-2;%1e-4;
0565     maskexp = 1 - hxr_proc.Qexp < 1e-1;%1e-2;%1e-4;
0566     %
0567     figure(56),clf,set(56,'Name','Photon Temperature')
0568     %
0569     ylim = [0,max([hxr_proc.Tphplasma(maskplasma),hxr_proc.Tphdiag(maskdiag),hxr_proc.Tphexp(maskexp)])]*1.2;
0570     %ytick = 0:2:16;
0571     ylab = ['Photon temperature (keV)'];
0572     tit = '';
0573     %
0574     %
0575     %graph1D_jd(ic(maskplasma),hxr_proc.Tphplasma(maskplasma),0,0,'','','',NaN,xlim,ylim,style,marker,color1,width2,siz,gca,1,lspace,bspace,hxr_proc.eTphplasma(maskplasma));
0576     graph1D_jd(ic(maskdiag),hxr_proc.Tphdiag(maskdiag),0,0,'','','',NaN,xlim,ylim,style,marker,color2,width2,siz,gca,1,lspace,bspace,hxr_proc.eTphdiag(maskdiag));
0577     graph1D_jd(ic(maskexp & maskic_exp),hxr_proc.Tphexp(maskexp & maskic_exp),0,0,xlab,ylab,tit,leg,xlim,ylim,style,marker,color3,width2,siz,gca,red,lspace,bspace,hxr_proc.eTphexp(maskexp & maskic_exp));
0578     %
0579     set(gca,'xtick',xtick);
0580     %set(gca,'ytick',ytick);
0581     %
0582     print_jd(p_opt,['Fig_tph_',load_id],[hxr_path,'figures'],56);
0583     %
0584     %
0585     figure(57),clf,set(57,'Name','Photon Amplitude')
0586     %
0587     ylim = NaN;%[0,max([hxr_proc.Aplasma(maskplasma),hxr_proc.Adiag(maskdiag),hxr_proc.Aexp(maskexp)])]*1.2;
0588     ylab = ['Emission Amplitude'];
0589     tit = '';
0590     %
0591     %
0592     %graph1D_jd(ic(maskplasma),hxr_proc.Aplasma(maskplasma),0,0,'','','',NaN,xlim,ylim,style,marker,color1,width2,siz,gca,1,lspace,bspace,hxr_proc.eAplasma(maskplasma));
0593     graph1D_jd(ic(maskdiag),hxr_proc.Adiag(maskdiag),0,0,'','','',NaN,xlim,ylim,style,marker,color2,width2,siz,gca,1,lspace,bspace,hxr_proc.eAdiag(maskdiag));
0594     graph1D_jd(ic(maskexp & maskic_exp),hxr_proc.Aexp(maskexp & maskic_exp),0,0,xlab,ylab,tit,leg,xlim,ylim,style,marker,color3,width2,siz,gca,red,lspace,bspace,hxr_proc.eAexp(maskexp & maskic_exp));
0595     %
0596     set(gca,'xtick',xtick);
0597     %set(gca,'ytick',ytick);
0598     %
0599     print_jd(p_opt,['Fig_A_',load_id],[hxr_path,'figures'],57);
0600     %
0601     %
0602     figure(58),clf,set(58,'name','spectrum for central chord')
0603     %
0604     ylab = 'dN/dt [s^{-1}]';
0605     %ymin = floor(min(log10([dNdtplasma(:,ic == opt.icc);dNdtdiag(:,ic == opt.icc);dNdtexp(:,ic == opt.icc)])));
0606     %ymax =  ceil(max(log10([dNdtplasma(:,ic == opt.icc);dNdtdiag(:,ic == opt.icc);dNdtexp(:,ic == opt.icc)])));
0607     %
0608     ylim = NaN;%[ymin,ymax];
0609 %     ytick = ymin:ymax;
0610 %     yticklabel = cell(1,length(ytick));
0611 %     for iy = 1:length(ytick),
0612 %         yticklabel{iy} = ['10^{',num2str(ytick(iy)),'}'];
0613 %     end
0614     %
0615     tit = ['Pulse count rate, chord # ',num2str(opt.icc)];
0616     %
0617     %graph1D_jd(k,dNdtplasma(:,ic == opt.icc),0,1,'','','',NaN,xlim2,ylim,style,marker,color1,width2,siz,gca,1,lspace,bspace,sqrt(dNdtplasma(:,ic == opt.icc)/dt));
0618     graph1D_jd(k,dNdtdiag(:,ic == opt.icc),0,0,'','','',NaN,xlim2,ylim,style,marker,color2,width2,siz,gca,1,lspace,bspace,sqrt(dNdtdiag(:,ic == opt.icc)/dt));
0619     graph1D_jd(k,dNdtexp(:,ic == opt.icc),0,0,xlab2,ylab,tit,leg,xlim2,ylim,style2,marker,color3,width2,siz,gca,red,lspace,bspace,sqrt(dNdtexp(:,ic == opt.icc)/dt));
0620     %
0621     set(gca,'xtick',xtick2);
0622     %set(gca,'ytick',ytick);
0623     %set(gca,'yticklabel',yticklabel)
0624     %
0625     print_jd(p_opt,['Fig_hxrcomp_central_',load_id],[hxr_path,'figures'],58);
0626     %
0627     %
0628 end

Community support and wiki are available on Redmine. Last update: 18-Apr-2019.