collect_hxr_forLUKE_jd

PURPOSE ^

SYNOPSIS ^

function [energy,hxr,t,beta,filter_thickness,filter_material] = collect_hxr_forLUKE_jd(basestr,shot,opt,data_path)

DESCRIPTION ^

 This function collects HXR experimental data from database

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function [energy,hxr,t,beta,filter_thickness,filter_material] = collect_hxr_forLUKE_jd(basestr,shot,opt,data_path)
0002 %
0003 % This function collects HXR experimental data from database
0004 %
0005 if nargin < 2,
0006     error('Not enough arguments');
0007 end
0008 %
0009 if nargin < 3,
0010     opt.R = 1;
0011     opt.V = 1;
0012 end
0013 %
0014 if strcmp(basestr,'TCV'),
0015     %
0016     hxrs_collect_hxr_luke;
0017     %
0018     t = t{1};
0019     energy = energy{1};
0020     hxr = hxr{1};
0021     filter_thickness = filter_thickness{1};
0022     filter_material = filter_material{1};
0023     %
0024 elseif strcmp(basestr,'TS') && exist('tsbase','file'),
0025     %
0026     nk = 8;%number of energy chanels in TS
0027     energy = (20:20:160).';%energy channels in TS
0028     nc = 59;%numver of chords in TS
0029     %
0030     if opt.R == 1,
0031         pilerej = 'R';
0032     else
0033         pilerej = '';
0034     end
0035     %
0036     if opt.V == 1,
0037         treel = 'V';
0038     else
0039         treel = '';
0040     end
0041     %
0042     [hxr01,t] = tsbase(shot,['G',treel,pilerej,'X01']);
0043     %
0044     if isempty(hxr01),
0045         disp(['-----> hxr data not found for shot :',num2str(shot)]);
0046         return            
0047     end                
0048     %
0049     nt = size(t,1);
0050     %
0051     t = t(:,1);
0052     %
0053     hxr = zeros(nt,nk,nc);            
0054     %
0055     icstr = cell(1,nc);
0056     for ic = 1:min([nc,9]),
0057         icstr{ic} = ['0',num2str(ic)];
0058     end
0059     for ic = 10:nc,
0060         icstr{ic} = num2str(ic);
0061     end
0062     %
0063     for ic = 1:nc,
0064         try 
0065             [hxrloc,tloc] = tsbase(shot,['G',treel,pilerej,'X',icstr{ic}]);
0066             %
0067             nkloc = size(tloc,2);
0068             %
0069             if nkloc < nk,
0070                 disp('WARNING : number of channels read from TS database is less than 8');
0071             elseif nkloc > nk,
0072                 error('Number of channels read from TS database is more than 8');
0073             end
0074             %
0075             if size(tloc,1) ~= nt || any(tloc(:,1) ~= t),
0076                 for ik = 1:nkloc,
0077                     hxr(:,ik,ic) = interp1(tloc(:,1),hxrloc(:,ik),t);
0078                 end
0079             else
0080                 hxr(:,1:nkloc,ic) = hxrloc;
0081             end                     
0082         catch
0083             continue
0084         end
0085     end
0086     %
0087     if opt.V == 1,
0088         hxr = flipdim(cumsum(flipdim(hxr,2),2),2);%TS data is per channel (it is not monotonically decreasing)
0089     end
0090     %
0091     filter_thickness = NaN;
0092     filter_material = NaN;
0093     beta = NaN;
0094     %
0095 else
0096     %
0097     t = NaN;
0098     energy = NaN;
0099     hxr = NaN;
0100     filter_thickness = NaN;
0101     filter_material = NaN;
0102     beta = NaN;
0103     %
0104     disp(['-----> no access to the ',basestr,' database found.']);
0105     %
0106 end
0107 %
0108 if nargout == 0,
0109     %
0110     if nargin < 4,
0111         data_path = './';
0112     end  
0113     %
0114     data_file = ['HXREXP_',basestr,'_',num2str(shot),'.mat'];
0115     %
0116     save([data_path,data_file],'shot','energy','hxr','t','beta','filter_thickness','filter_material');
0117     %
0118 end

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