iluke_update_hxr

PURPOSE ^

external_hxr

SYNOPSIS ^

This is a script file.

DESCRIPTION ^

 external_hxr

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 %
0002 % external_hxr
0003 %
0004 if isfield(external,'hxr'),% include data from external structure if available
0005     %
0006     external_hxr = external.hxr;
0007     %
0008 else
0009     %
0010     external_hxr = [];% no external structure
0011     %
0012 end 
0013 %
0014 if ~isempty(external_hxr),
0015     lukeobj.hxrcam.import.state = 'on';
0016     lukeobj.hxrexp.import.state = 'on';
0017     lukeobj.hxrparam.import.state = 'on';
0018 else
0019     lukeobj.hxrcam.import.state = 'off';
0020     lukeobj.hxrexp.import.state = 'off';
0021     lukeobj.hxrparam.import.state = 'off';
0022 end
0023 %
0024 nc = length(hxr.cam);
0025 lukeobj.hxrcam.select.string = [lukeobj.hxrcam.select.string{1},cell(1,nc)];
0026 for ic = 1:nc,
0027     lukeobj.hxrcam.select.string{ic+1} = hxr.cam{ic}.id;
0028 end
0029 %
0030 ic = lukeobj.hxrcam.select.value - 1;% selected camera
0031 %
0032 if ic == 0,% all cameras
0033     lukeobj.hxrchord.state = 'off';
0034     lukeobj.hxrchord.select.value = 1;
0035 else
0036     lukeobj.hxrchord.state = 'on';
0037     nchords = length(hxr.cam{ic}.chordsnum);
0038     lukeobj.hxrchord.select.string = [lukeobj.hxrchord.select.string{1},cell(1,nchords)];
0039     for ichord = 1:nchords,
0040         lukeobj.hxrchord.select.string{ichord+1} = ['# ',num2str(hxr.cam{ic}.chordsnum(ichord))];
0041     end
0042     lukeobj.hxrchord.select.value = hxr.cam{ic}.selectedchord + 1;
0043 end    
0044 %
0045 if isempty(hxr.cam),
0046     %
0047     lukeobj.hxrcam.select.state = 'off';
0048     %
0049     lukeobj.hxrcam.save.state = 'off';
0050     lukeobj.hxrcam.clear.state = 'off';
0051     lukeobj.hxrcam.disp.state = 'off';
0052     %
0053     if ~isempty(external_hxr),
0054         lukeobj.hxrcam.import.highlight = true;
0055         lukeobj.hxrcam.load.highlight = false;
0056     else
0057         lukeobj.hxrcam.load.highlight = true;
0058         lukeobj.hxrcam.import.highlight = false;
0059     end
0060     %
0061 else
0062     %
0063     lukeobj.hxrcam.select.state = 'on';
0064     %
0065     lukeobj.hxrcam.save.state = 'on';
0066     lukeobj.hxrcam.clear.state = 'on';
0067     %
0068     if curtime > 0 && status.equil(curtime) == 1,
0069         lukeobj.hxrcam.disp.state = 'on';
0070     else
0071         lukeobj.hxrcam.disp.state = 'off';
0072     end
0073     %
0074     lukeobj.hxrcam.import.highlight = false;
0075     lukeobj.hxrcam.load.highlight = false;
0076     %
0077 end
0078 %
0079 if isempty(hxr.exp),
0080     %
0081     lukeobj.hxrexp.save.state = 'off';
0082     lukeobj.hxrexp.clear.state = 'off';
0083     %
0084     if ~isempty(external_hxr),
0085         lukeobj.hxrexp.import.highlight = true;
0086         lukeobj.hxrexp.load.highlight = false;
0087     else
0088         lukeobj.hxrexp.load.highlight = true;
0089         lukeobj.hxrexp.import.highlight = false;
0090     end
0091     %
0092 else
0093     %
0094     lukeobj.hxrexp.save.state = 'on';
0095     lukeobj.hxrexp.clear.state = 'on';
0096     %
0097     lukeobj.hxrexp.import.highlight = false;
0098     lukeobj.hxrexp.load.highlight = false;
0099     %
0100     nbins = length(hxr.exp.energy);
0101     lukeobj.hxrbin.select.string = [lukeobj.hxrbin.select.string{1},cell(1,nbins)];
0102     for ibin = 1:nbins-1,
0103         lukeobj.hxrbin.select.string{ibin+1} = [num2str(hxr.exp.energy(ibin)),' < k (keV) < ',num2str(hxr.exp.energy(ibin + 1))];
0104     end    
0105     lukeobj.hxrbin.select.string{nbins+1} = ['k (keV) > ',num2str(hxr.exp.energy(nbins))];
0106     %
0107     clear ibin nbins
0108 end
0109 %
0110 if ~isempty(hxr.exp) && ic > 0 && any(any(any(~isnan(hxr.exp.data(:,:,hxr.cam{ic}.chordsind))))),
0111     %
0112     lukeobj.hxrexp.disp.state = 'on';
0113     lukeobj.hxrbin.state = 'on';
0114     %
0115 else
0116     %
0117     lukeobj.hxrexp.disp.state = 'off';
0118     lukeobj.hxrbin.state = 'off';
0119 end
0120 %
0121 if isempty(hxr.param),
0122     %
0123     lukeobj.hxrparam.modify.state = 'off';
0124     lukeobj.hxrparam.save.state = 'off';
0125     lukeobj.hxrparam.clear.state = 'off';
0126     %
0127     if ~isempty(external_hxr),
0128         lukeobj.hxrparam.import.highlight = true;
0129         lukeobj.hxrparam.load.highlight = false;
0130     else
0131         lukeobj.hxrparam.load.highlight = true;
0132         lukeobj.hxrparam.import.highlight = false;
0133     end
0134     %
0135     lukeobj.hxrbrem.run.state = 'off';
0136     %
0137     lukeobj.hxrrange1.edit.state = 'off';
0138     lukeobj.hxrrange2.edit.state = 'off';
0139     %
0140 else
0141     %
0142     lukeobj.hxrparam.modify.state = 'on';
0143     lukeobj.hxrparam.save.state = 'on';
0144     lukeobj.hxrparam.clear.state = 'on';
0145     %
0146     lukeobj.hxrparam.import.highlight = false;
0147     lukeobj.hxrparam.load.highlight = false;
0148     %
0149     lukeobj.hxrbrem.run.state = 'on';
0150     %
0151     lukeobj.hxrrange1.edit.state = 'on';
0152     lukeobj.hxrrange2.edit.state = 'on';
0153     %
0154     lukeobj.hxrrange1.edit.string = num2str(hxr.param.kmin);
0155     lukeobj.hxrrange2.edit.string = num2str(hxr.param.kmax);
0156     %
0157 end
0158 %
0159 if (curtime == 0 && any(status.sdiag(1,:) >= 1)) || (curtime > 0 && status.sdiag(1,curtime) >= 1),% FEB calc is enabled
0160     lukeobj.hxrbrem.run.highlight = true;
0161     lukeobj.hxrbrem.run.state = 'on';
0162 else
0163     lukeobj.hxrbrem.run.highlight = false;
0164     lukeobj.hxrbrem.run.state = 'off';
0165 end    
0166 %
0167 if (curtime == 0 && any(status.sdiag(1,:) >= 2)) || (curtime > 0 && status.sdiag(1,curtime) >= 2),% FEB calc is done
0168     lukeobj.hxrbrem.run.highlight = false;
0169     %
0170     lukeobj.hxrbrem.clear.state = 'on';
0171     lukeobj.hxrbrem.disp.state = 'on';
0172     lukeobj.hxrrho.state = 'on';
0173     lukeobj.hxrtheta.state = 'on';
0174     lukeobj.hxrdir.state = 'on';
0175     lukeobj.hxrkphot.state = 'on';
0176     nkphot = length(hxr.param.kphot);
0177     lukeobj.hxrkphot.select.string = [lukeobj.hxrkphot.select.string{1},cell(1,nkphot)];
0178     for ikphot = 1:nkphot,
0179         lukeobj.hxrkphot.select.string{ikphot+1} = num2str(hxr.param.kphot(ikphot));
0180     end    
0181     %
0182     if curtime == 0,
0183         ishotime = find(status.sdiag(1,:) >= 2,1,'first');
0184     else
0185         ishotime = curtime;
0186     end
0187     %
0188     nrho = length(sdiags{1,ishotime}.equilHXR.xrhoT);
0189     ntheta = length(sdiags{1,ishotime}.equilHXR.mtheta);
0190     lukeobj.hxrrho.select.string = [lukeobj.hxrrho.select.string{1},cell(1,nrho)];
0191     lukeobj.hxrtheta.select.string = [lukeobj.hxrtheta.select.string{1},cell(1,ntheta)];
0192     for irho = 1:nrho,
0193         lukeobj.hxrrho.select.string{irho+1} = num2str(sdiags{1,ishotime}.equilHXR.xrhoT(irho),2);
0194     end    
0195     for itheta = 1:ntheta,
0196         lukeobj.hxrtheta.select.string{itheta+1} = [num2str(sdiags{1,ishotime}.equilHXR.mtheta(itheta)*180/pi,3),'°'];
0197     end    
0198     %
0199     if ~isempty(hxr.cam),
0200         lukeobj.hxrdiag.run.state = 'on';
0201     else
0202         lukeobj.hxrdiag.run.state = 'off';
0203     end
0204     %
0205     clear ikphot nkphot ishotime irho nrho itheta ntheta
0206 else
0207     lukeobj.hxrbrem.run.highlight = true;
0208     %
0209     lukeobj.hxrbrem.clear.state = 'off';
0210     lukeobj.hxrbrem.disp.state = 'off';
0211     lukeobj.hxrrho.state = 'off';
0212     lukeobj.hxrtheta.state = 'off';
0213     lukeobj.hxrdir.state = 'off';
0214     lukeobj.hxrkphot.state = 'off';
0215     %
0216     lukeobj.hxrdiag.run.state = 'off';
0217     %
0218 end    
0219 %
0220 if (curtime == 0 && any(status.sdiag(1,:) >= 3)) || (curtime > 0 && status.sdiag(1,curtime) >= 3),% FEB diag calc is done
0221     lukeobj.hxrdiag.run.highlight = false;
0222     %
0223     lukeobj.hxrdiag.clear.state = 'on';
0224     lukeobj.hxrdiag.disp.state = 'on';
0225 else
0226     lukeobj.hxrdiag.run.highlight = true;
0227     %
0228     lukeobj.hxrdiag.clear.state = 'off';
0229     lukeobj.hxrdiag.disp.state = 'off';
0230 end  
0231 %
0232 clear external_hxr ic nc
0233 %

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