diff --git a/JET/loadJETdata.m b/JET/loadJETdata.m index b12bc7ed81889861083c490878ba1ef5e4320014..c25503ceada32a5772282d06f8744b9bd9a3affa 100644 --- a/JET/loadJETdata.m +++ b/JET/loadJETdata.m @@ -4,6 +4,13 @@ function [trace,error,varargout]=loadJETdata(shot,data_type,varargin) % 'Ip' = current % 'zmag' = vertical position of the center of the plasma (magnetic axis) % 'rmag' = radial position of the center of the plasma +% 'qrho' = q profile on rho mesh +% 'neint' = line-integrated electron density [m/m^3] +% 'ne'= ne raw profile on (R,t). ADD error bars in .std +% 'te'= Te raw profile on (R,t). ADD error bars in .std +% 'nerho'= ne profile on (rho=sqrt(psi),time) mesh.Note rho is a 2D array as depends on time. ADD error bars in .std +% 'terho'= Te profile on (rho=sqrt(psi),time) mesh.Note rho is a 2D array as depends on time. ADD error bars in .std +% Now, use CHAIN2 lid2/neo and teo for nerho, terho % 'ece' = electron cyclotron emission % 'sxr' = soft x-ray emission % 'sxR' = soft x-ray emission with varargout{1} option (requires varargin{5}!) @@ -15,6 +22,18 @@ function [trace,error,varargout]=loadJETdata(shot,data_type,varargin) % shot: shot number % data_type: type of the required data. % +% Allows extension for uid and seq number a la RDA: ?uid=jetthg+seq=110 +% examples: +% +% data_type='Ip?uid=jetthg+seq=110' +% data_type='ppf','efit/xip?uid=jetthg+seq=110' +% +% for EFIT traces, allows keyword extension '_m' to get data from ppf/efitm instead of ppf/efit +% examples: +% +% data_type='Ip_m?uid=jetthg+seq=110' +% data_type='ppf','efitm/xip?uid=jetthg+seq=110' +% % Meaning of varargin depends on data_type: % % data_type=sxr or ece: @@ -24,6 +43,7 @@ function [trace,error,varargout]=loadJETdata(shot,data_type,varargin) % varargin{2}: [i1 i2] : if not empty, assumes need many chords from i1 to i2 % varargin{3}: zmag for varargout{1} computation % +% % OUTPUT: % trace.data: data structure % trace.t: time of reference @@ -43,22 +63,94 @@ function [trace,error,varargout]=loadJETdata(shot,data_type,varargin) varargout=cell(1,1); +% To allow multiple ways of writing a specific keyword, use data_type_eff within this routine + +data_type_eff=data_type; + +i_efitm=0; +i_ext=length(data_type_eff)+1; +name_ext=''; +if size(data_type_eff,1)==1 + i=findstr('?',data_type_eff); + if ~isempty(i) + i_ext=i; + name_ext=data_type_eff(i_ext:end); + end + data_type_eff_noext=data_type_eff(1:i_ext-1); + i=findstr('_m',data_type_eff_noext); + if ~isempty(i) + i_efitm=1; + data_type_eff_noext=data_type_eff(1:i-1); + end + if ~isempty(strmatch(data_type_eff_noext,[{'ip'} {'i_p'} {'xip'}],'exact')) + data_type_eff_noext='Ip'; + end + if ~isempty(strmatch(data_type_eff_noext,[{'Te'} {'t_e'} {'TE'} {'T_e'}],'exact')) + data_type_eff_noext='te'; + end + if ~isempty(strmatch(data_type_eff_noext,[{'Ne'} {'n_e'} {'NE'} {'N_e'}],'exact')) + data_type_eff_noext='ne'; + end + if ~isempty(strmatch(data_type_eff_noext,[{'Terho'}],'exact')) + data_type_eff_noext='terho'; + end + if ~isempty(strmatch(data_type_eff_noext,[{'SXR'}],'exact')) + data_type_eff_noext='sxr'; + end + if ~isempty(strmatch(data_type_eff_noext,[{'ECE'}],'exact')) + data_type_eff_noext='ece'; + end + if ~isempty(strmatch(data_type_eff_noext,[{'Rmag'}],'exact')) + data_type_eff_noext='rmag'; + end + if ~isempty(strmatch(data_type_eff_noext,[{'Zmag'}],'exact')) + data_type_eff_noext='zmag'; + end +else + i_ext=length(data_type_eff(2))+1; + name_ext=''; + i=findstr('?',data_type_eff(2)); + if ~isempty(i) + i_ext=i; + name_ext=data_type_eff(2)(i_ext:end); + end + data_type_eff_noext=data_type_eff{2}(1:i_ext-1)]; +end + % all keywords and corresponding case to run below -JETkeywrdall=[{'Ip'} {'zmag'} {'rmag'} {'sxr'} {'sxR'} {'ece'}]; -JETsig.iip=1; -JETsig.izmag=2; -JETsig.irmag=3; -JETsig.isxr=4; -JETsig.isxR=5; -JETsig.iece=6; +JETkeywrdall=[{'Ip'} {'zmag'} {'rmag'} {'qrho'} {'neint'} ... + {'ne'} {'te'} {'nerho'} {'terho'} ... + {'sxr'} {'sxR'} {'ece'}]; +JETsig.iip=strmatch('Ip',JETkeywrdall,'exact'); +JETsig.izmag=strmatch('zmag',JETkeywrdall,'exact'); +JETsig.irmag=strmatch('rmag',JETkeywrdall,'exact'); +JETsig.iqrho=strmatch('qrho',JETkeywrdall,'exact'); +JETsig.ineint=strmatch('neint',JETkeywrdall,'exact'); +JETsig.ine=strmatch('ne',JETkeywrdall,'exact'); +JETsig.ite=strmatch('te',JETkeywrdall,'exact'); +JETsig.inerho=strmatch('nerho',JETkeywrdall,'exact'); +JETsig.iterho=strmatch('terho',JETkeywrdall,'exact'); +JETsig.isxr=strmatch('sxr',JETkeywrdall,'exact'); +JETsig.isxR=strmatch('sxR',JETkeywrdall,'exact'); +JETsig.iece=strmatch('ece',JETkeywrdall,'exact'); + % For each keyword, specify which case to use. As most common is 'simplereaddata', fill in with this and change % only indices needed. Usually use name of case same as keyword name JETkeywrdcase=cell(size(JETkeywrdall)); JETkeywrdcase(:)={'simplereaddata'}; +JETkeywrdcase(JETsig.iqrho)=JETkeywrdall(JETsig.iqrho); % special as efit q on psi +JETkeywrdcase(JETsig.ine)=JETkeywrdall(JETsig.ine); % special as adds error bars +JETkeywrdcase(JETsig.ite)=JETkeywrdall(JETsig.ite); % idem +JETkeywrdcase(JETsig.inerho)=JETkeywrdall(JETsig.inerho); % idem +JETkeywrdcase(JETsig.iterho)=JETkeywrdall(JETsig.iterho); % idem JETkeywrdcase(JETsig.isxr)=JETkeywrdall(JETsig.isxr); JETkeywrdcase(JETsig.isxR)=JETkeywrdall(JETsig.isxR); JETkeywrdcase(JETsig.iece)=JETkeywrdall(JETsig.iece); +% Information about which dimension has time, always return 2D data as (x,t) array +% as most are 1D arrays with time as first index, fill in with ones and change only those needed +JETsigtimeindx=ones(size(JETkeywrdall)); + % For the 'simplereaddata' cases, we need the full node in case gdat was called with full location directly % for the other cases, leave this location empty JETsiglocation=cell(2,size(JETkeywrdall,2)); @@ -66,59 +158,110 @@ JETsiglocation(:)={''}; JETsiglocation(:,JETsig.iip)={'ppf'; 'efit/xip'}; JETsiglocation(:,JETsig.izmag)={'ppf'; 'efit/zmag'}; JETsiglocation(:,JETsig.irmag)={'ppf'; 'efit/rmag'}; - -% Information about which dimension has time, always return 2D data as (x,t) array -% as most are 1D arrays with time as first index, fill in with ones and change only those needed -JETsigtimeindx=ones(size(JETkeywrdall)); +JETsiglocation(JETsig.ineint)={'ppf'; 'kg1v/lid3'}; % find index of signal called upon -if size(data_type,1)==2 +if size(data_type_eff,1)==2 % in case node name was given in 2 parts directly (as old way) - ii1=strmatch(data_type(1),JETsiglocation(1,:),'exact'); - index=find(strmatch(data_type(2),JETsiglocation(2,ii1),'exact')); + ii1=strmatch(data_type_eff(1),JETsiglocation(1,:),'exact'); + index=find(strmatch(data_type_eff_noext,JETsiglocation(2,ii1),'exact')); if isempty(index) disp('********************') disp('trace not yet registered.') disp('If standard data, ask andrea.scarabosio@epfl.ch or olivier.sauter@epfl.ch to create a keyqord entry for this data') - eval(['!mail -s ''' data_type{1} ' ' data_type{2} ' ' num2str(shot) ' ' ... - getenv('USER') ' TCV'' olivier.sauter@epfl.ch < /dev/null']) + eval(['!mail -s ''' data_type_eff{1} ' ' data_type_eff{2} ' ' num2str(shot) ' ' ... + getenv('USER') ' JET'' olivier.sauter@epfl.ch < /dev/null']) disp('********************') % temporarily add entry in arrays, so can work below index=length(JETkeywrdall)+1; JETkeywrdall(end+1)={'new'}; JETkeywrdcase(end+1)={'simplereaddata'}; - JETsiglocation(1:2,end+1)=data_type; + JETsiglocation(1:2,end+1)=[data_type_eff(1) ; {data_type_eff_noext}]; JETsigtimeindx(end+1)=0; elseif ~strcmp(JETkeywrdcase{index},'simplereaddata') - msgbox(['Problem in loadJETdata with data_type = ' data_type ... + msgbox(['Problem in loadJETdata with data_type_eff = ' char(data_type_eff(end)) ... '. Full paths of nodes should only be for case simplereaddata'],'in loadJETdata','error') error('in loadJETdata') end else - index=strmatch(data_type,JETkeywrdall,'exact'); + index=strmatch(data_type_eff_noext,JETkeywrdall,'exact'); end disp(' ') -disp(['loading' ' ' char(data_type(end)) ' from JET shot #' num2str(shot)]); +disp(['loading' ' ' char(data_type_eff(end)) ' from JET shot #' num2str(shot)]); disp(['case ' JETkeywrdcase{index}]) disp(' ') switch JETkeywrdcase{index} + &&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&& case 'simplereaddata' - varargout={[]}; ppftype=JETsiglocation{1,index}; - tracename=JETsiglocation{2,index}; + if i_efitm; + tracename=['efitm' JETsiglocation{2,index}(5:end) name_ext]; + else + tracename=[JETsiglocation{2,index} name_ext]; + end [a,t,x,d,e]=jetreaddata(['http://data.jet.uk/' ppftype '/' num2str(shot) '/' tracename]); trace.data=a'; - trace.t=t; trace.x=x; + trace.t=t; clear error error=e; if error~=0 [aaa bbb]=jetgetlasterrordetail; disp(bbb) end + if length(size(trace.data))==1 + trace.dim=[{trace.t}]; + trace.dimunits(1)={'time [s]'}; + elseif length(size(trace.data))==2 + trace.dim=[{trace.x} ; {trace.t}]; + trace.dimunits=[{'R [m] or rho=sqrt(psi_norm)'} ; {'time [s]'}]; + else + disp('how to deal with 3D arrays?') + trace.dim=[{trace.x} ; {trace.t} ; {d}]; + trace.dimunits=[{'R [m] or rho=sqrt(psi_norm)'} ; {'time [s]'} ; {'d'}]; + trace.d=d; + end + + &&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&& + case {JETkeywrdall{JETsig.ine} , JETkeywrdall{JETsig.ite}} + % ne, te raw data from LIDR vs R,t. Add error bars + ppftype='ppf'; + if strcmp(JETkeywrdcase{index},JETkeywrdall{JETsig.ine}) + tracename=['LIDR/NE' name_ext]; + else + tracename=['LIDR/TE' name_ext]; + end + [a,t,x,d,e]=jetreaddata(['http://data.jet.uk/' ppftype '/' num2str(shot) '/' tracename]); + trace.data=a'; + trace.x=x; + trace.t=t; + trace.dim=[{trace.x} ; {trace.t}]; + trace.dimunits=[{'R [m]'} ; {'time [s]'}]; + clear error + error=e; + + &&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&& + case {JETkeywrdall{JETsig.inerho} , JETkeywrdall{JETsig.iterho}} + % ne, te on rho mesh. use lid2, thus need chain2 to have been run. Add error bars + ppftype='ppf'; + if strcmp(JETkeywrdcase{index},JETkeywrdall{JETsig.inerho}) + tracename=['LID2/NEO' name_ext]; + else + tracename=['LID2/TEO' name_ext]; + end + [a,t,x,d,e]=jetreaddata(['http://data.jet.uk/' ppftype '/' num2str(shot) '/' tracename]); + trace.data=a'; + trace.x=x; + trace.t=t; + trace.dim=[{trace.x} ; {trace.t}]; + trace.dimunits=[{'rho=sqrt(psi)'} ; {'time [s]'}]; + clear error + error=e; + + &&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&& case {'sxr','sxR'} % LOAD MULTI CHANNEL DATA % load JET soft x-ray data @@ -137,7 +280,7 @@ switch JETkeywrdcase{index} % Status=1 => Not Read Yet % vertical SXR chords ppftype='jpf'; - tracename=['db/j3-sxr<v' num2str(i) '''''/1']; + tracename=['db/j3-sxr<v' num2str(i) '''''/1' name_ext]; [a,t,x,d,e]=jetreaddata(['http://data.jet.uk/' ppftype '/' num2str(shot) '/' tracename]); trace.data(:,i)=a; trace.t(:,i)=t; @@ -150,15 +293,18 @@ switch JETkeywrdcase{index} % Convert from raw sxr data to W/m^2 trace.data(i,:) = trace.data(i,:) * vconvert(i); % calculating intersection of the view lines with magnetics axis - if strcmp(data_type,'sxR') + if strcmp(data_type_eff_noext,'sxR') zmag=varargin{3}; radius(:,i)=2.848 + (2.172-zmag.data) .* ... tan(-4.5/180.*3.14159 - atan2(0.99.*(i-18),35.31)); varargout={radius}; end end + trace.dim=[{trace.t} ; {[starti:endi]}]; + trace.dimunits=[{'time [s]'} ; {'channels'}]; end + &&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&& case 'ece' starti=varargin{1}(1); endi=varargin{1}(2); @@ -170,7 +316,7 @@ switch JETkeywrdcase{index} % ECE, te0 % Status=1 => Not Read Yet ppftype='ppf'; - tracename=['kk3/te0'num2str(i)]; + tracename=['kk3/te0'num2str(i) name_ext]; [a,t,x,d,e]=jetreaddata(['http://data.jet.uk/' ppftype '/' num2str(shot) '/' tracename]); trace.data(:,i)=a; trace.t(:,i)=t; @@ -181,7 +327,7 @@ switch JETkeywrdcase{index} disp(bbb) end ppftype='ppf'; - tracename=['kk3/rc0'num2str(i)]; + tracename=['kk3/rc0'num2str(i) name_ext]; [a,t,x,d,e]=jetreaddata(['http://data.jet.uk/' ppftype '/' num2str(shot) '/' tracename]); radius.data(:,i)=a; radius.t(:,i)=t; @@ -189,7 +335,7 @@ switch JETkeywrdcase{index} error=e; else ppftype='ppf'; - tracename=['kk3/te'num2str(i)]; + tracename=['kk3/te'num2str(i) name_ext]; [a,t,x,d,e]=jetreaddata(['http://data.jet.uk/' ppftype '/' num2str(shot) '/' tracename]); trace.data(:,i)=a; trace.t(:,i)=t; @@ -200,7 +346,7 @@ switch JETkeywrdcase{index} disp(bbb) end ppftype='ppf'; - tracename=['kk3/rc'num2str(i)]; + tracename=['kk3/rc'num2str(i) name_ext]; [a,t,x,d,e]=jetreaddata(['http://data.jet.uk/' ppftype '/' num2str(shot) '/' tracename]); radius.data(:,i)=a; radius.t(:,i)=t; @@ -208,6 +354,8 @@ switch JETkeywrdcase{index} end end end + trace.dim=[{trace.t} ; {[starti:endi]}]; + trace.dimunits=[{'time [s]'} ; {'channels'}]; varargout={radius}; end diff --git a/TCV/loadTCVdata.m b/TCV/loadTCVdata.m index 4e5578b3694c438f476a1b6cc346342d80d54dea..16be9c7ed0bc564276a99b09bac21f2e6073d20c 100644 --- a/TCV/loadTCVdata.m +++ b/TCV/loadTCVdata.m @@ -3,7 +3,7 @@ % list of data_type currently available: % 'Ip' = current % 'zmag' = vertical position of the center of the plasma (magnetic axis) -% 'rmag' = radial position of the center of the plasma +% 'rmag' = radial position of the center of the plasma % 'rcont' = R of plama flux surfaces % 'zcont' = Z of plama flux surfaces % 'vol' = volume of flux surfaces @@ -19,7 +19,7 @@ % 'teft' = te fitted from data on rho mesh (from proffit.local_time:teft) % 'neftav' = ne fitted from averaged over time data on rho mesh (from proffit.avg_time:neft) % 'teftav' = te fitted from averaged over time data on rho mesh (from proffit.avg_time:teft) -% 'ece' = electron cyclotron emission +% 'ece' = electron cyclotron emission % 'sxr' = soft x-ray emission % 'sxR' = soft x-ray emission with varargout{1} option (requires varargin{4}!) % 'MPX' = soft x-ray from wire chambers @@ -41,9 +41,9 @@ % % OUTPUT: % -% trace.data: data -% trace.t: time of reference -% trace.x: space of reference +% trace.data: data +% trace.t: time of reference +% trace.x: space of reference % trace.dim: cell array of grids, trace.dim{1}, {2}, ... % trace.dimunits: units of dimensions % @@ -51,7 +51,7 @@ % % data_type=sxR, ece: % varargout{1}: major radius: intersection/projection of the view lines with z=zmag -% data_type=MPX: +% data_type=MPX: % varargout{1}: te be determined % % @@ -65,6 +65,50 @@ varargout{1}=cell(1,1); error=1; +% To allow multiple ways of writing a specific keyword, use data_type_eff within this routine +data_type_eff=data_type; +i_23=0; +liuqe_ext=''; +if strcmp(data_type_eff(end-1:end),'_2') | strcmp(data_type_eff(end-1:end),'_3') + i_23=2; + liuqe_ext=data_type_eff(end-1:end); +end +% use keyword without eventual _2 or _3 extension to check for multiple possibilities +data_type_eff_noext=data_type_eff(1:end-i_23); +if ~isempty(strmatch(data_type_eff_noext,[{'ip'} {'i_p'} {'xip'}],'exact')) + data_type_eff_noext='Ip'; +end +if ~isempty(strmatch(data_type_eff_noext,[{'Te'} {'t_e'} {'TE'} {'T_e'}],'exact')) + data_type_eff_noext='te'; +end +if ~isempty(strmatch(data_type_eff_noext,[{'Ne'} {'n_e'} {'NE'} {'N_e'}],'exact')) + data_type_eff_noext='ne'; +end +if ~isempty(strmatch(data_type_eff_noext,[{'Rcont'}],'exact')) + data_type_eff_noext='rcont'; +end +if ~isempty(strmatch(data_type_eff_noext,[{'Zcont'}],'exact')) + data_type_eff_noext='zcont'; +end +if ~isempty(strmatch(data_type_eff_noext,[{'Terho'}],'exact')) + data_type_eff_noext='terho'; +end +if ~isempty(strmatch(data_type_eff_noext,[{'SXR'}],'exact')) + data_type_eff_noext='sxr'; +end +if ~isempty(strmatch(data_type_eff_noext,[{'ECE'}],'exact')) + data_type_eff_noext='ece'; +end +if ~isempty(strmatch(data_type_eff_noext,[{'VOL'} {'volume'}],'exact')) + data_type_eff_noext='vol'; +end +if ~isempty(strmatch(data_type_eff_noext,[{'Rmag'}],'exact')) + data_type_eff_noext='rmag'; +end +if ~isempty(strmatch(data_type_eff_noext,[{'Zmag'}],'exact')) + data_type_eff_noext='zmag'; +end + % some defaults % nodes which have _2 and _3 equivalence, related to simpletdi case @@ -75,7 +119,8 @@ liuqe23=[{'\results::i_p'} {'\results::z_axis'} {'\results::r_axis'} {'\results: % all keywords and corresponding case to run below TCVkeywrdall=[{'Ip'} {'zmag'} {'rmag'} {'rcont'} {'zcont'} {'vol'} {'qrho'} {'neint'} ... - {'ne'} {'te'} {'nerho'} {'terho'} {'profnerho'} {'profterho'} {'neft'} {'teft'} {'neftav'} {'teftav'} ... + {'ne'} {'te'} {'nerho'} {'terho'} {'profnerho'} {'profterho'} ... + {'neft'} {'teft'} {'neftav'} {'teftav'} ... {'sxr'} {'sxR'} {'ece'}]; TCVsig.iip=strmatch('Ip',TCVkeywrdall,'exact'); TCVsig.izmag=strmatch('zmag',TCVkeywrdall,'exact'); @@ -98,6 +143,7 @@ TCVsig.iteftav=strmatch('teftav',TCVkeywrdall,'exact'); TCVsig.isxr=strmatch('sxr',TCVkeywrdall,'exact'); TCVsig.isxR=strmatch('sxR',TCVkeywrdall,'exact'); TCVsig.iece=strmatch('ece',TCVkeywrdall,'exact'); + % For each keyword, specify which case to use. As most common is 'simpletdi', fill in with this and change % only indices needed. Usually use name of case same as keyword name TCVkeywrdcase=cell(size(TCVkeywrdall)); @@ -113,6 +159,10 @@ TCVkeywrdcase(TCVsig.isxr)=TCVkeywrdall(TCVsig.isxr); TCVkeywrdcase(TCVsig.isxR)=TCVkeywrdall(TCVsig.isxR); TCVkeywrdcase(TCVsig.iece)=TCVkeywrdall(TCVsig.iece); +% Information about which dimension has time, always return 2D data as (x,t) array +% as most are 1D arrays with time as first index, fill in with ones and change only those needed +TCVsigtimeindx=ones(size(TCVkeywrdall)); + % For the 'simpletdi' cases, we need the full node in case gdat was called with full location directly % for the other cases, leave this location empty TCVsiglocation=cell(size(TCVkeywrdall)); @@ -120,52 +170,42 @@ TCVsiglocation(:)={''}; TCVsiglocation(TCVsig.iip)={'\results::i_p'}; TCVsiglocation(TCVsig.izmag)={'\results::z_axis'}; TCVsiglocation(TCVsig.irmag)={'\results::r_axis'}; -TCVsiglocation(TCVsig.ircont)={'\results::r_contour'}; -TCVsiglocation(TCVsig.izcont)={'\results::z_contour'}; -TCVsiglocation(TCVsig.ivol)={'\results::psitbx:vol'}; +TCVsiglocation(TCVsig.ircont)={'\results::r_contour'}; TCVsigtimeindx(TCVsig.ircont)=2; +TCVsiglocation(TCVsig.izcont)={'\results::z_contour'}; TCVsigtimeindx(TCVsig.izcont)=2; +TCVsiglocation(TCVsig.ivol)={'\results::psitbx:vol'}; TCVsigtimeindx(TCVsig.ivol)=2; TCVsiglocation(TCVsig.ineint)={'\results::fir:lin_int_dens'}; -TCVsiglocation(TCVsig.ineft)={'\results::proffit.local_time:neft'}; -TCVsiglocation(TCVsig.iteft)={'\results::proffit.local_time:teft'}; -TCVsiglocation(TCVsig.ineftav)={'\results::proffit.avg_time:neft'}; -TCVsiglocation(TCVsig.iteftav)={'\results::proffit.avg_time:teft'}; - -% Information about which dimension has time, always return 2D data as (x,t) array -% as most are 1D arrays with time as first index, fill in with ones and change only those needed -TCVsigtimeindx=ones(size(TCVkeywrdall)); +TCVsiglocation(TCVsig.ineft)={'\results::proffit.local_time:neft'}; TCVsigtimeindx(TCVsig.ineft)=2; +TCVsiglocation(TCVsig.iteft)={'\results::proffit.local_time:teft'}; TCVsigtimeindx(TCVsig.iteft)=2; +TCVsiglocation(TCVsig.ineftav)={'\results::proffit.avg_time:neft'}; TCVsigtimeindx(TCVsig.ineftav)=2; +TCVsiglocation(TCVsig.iteftav)={'\results::proffit.avg_time:teft'}; TCVsigtimeindx(TCVsig.iteftav)=2; % find index of signal called upon -i_23=0; -liuqe_ext=''; -if strcmp(data_type(end-1:end),'_2') | strcmp(data_type(end-1:end),'_3') - i_23=2; - liuqe_ext=data_type(end-1:end); -end -if strcmp(data_type(1:1),'\') +if strcmp(data_type_eff(1:1),'\') % in case full node name was given - index=strmatch(data_type(1:end-i_23),TCVsiglocation,'exact'); + index=strmatch(data_type_eff(1:end-i_23),TCVsiglocation,'exact'); if isempty(index) disp('********************') disp('trace not yet registered.') disp('If standard data, ask andrea.scarabosio@epfl.ch or olivier.sauter@epfl.ch to create a keyqord entry for this data') - eval(['!mail -s ''' data_type ' ' num2str(shot) ' ' getenv('USER') ' TCV'' olivier.sauter@epfl.ch < /dev/null']) + eval(['!mail -s ''' data_type_eff ' ' num2str(shot) ' ' getenv('USER') ' TCV'' olivier.sauter@epfl.ch < /dev/null']) disp('********************') % temporarily add entry in arrays, so can work below index=length(TCVkeywrdall)+1; TCVkeywrdall(end+1)={'new'}; TCVkeywrdcase(end+1)={'simpletdi'}; - TCVsiglocation(end+1)={data_type(1:end-i_23)}; + TCVsiglocation(end+1)={data_type_eff(1:end-i_23)}; TCVsigtimeindx(end+1)=0; elseif ~strcmp(TCVkeywrdcase{index},'simpletdi') - msgbox(['Problem in loadTCVdata with data_type = ' data_type ... + msgbox(['Problem in loadTCVdata with data_type_eff = ' data_type_eff ... '. Full paths of nodes should only be for case simpletdi'],'in loadTCVdata','error') error('in loadTCVdata') end else - index=strmatch(data_type(1:end-i_23),TCVkeywrdall,'exact'); + index=strmatch(data_type_eff(1:end-i_23),TCVkeywrdall,'exact'); if isempty(index) disp(' ') disp('********************') - disp(['no such keyword: ' data_type(1:end-i_23)]) + disp(['no such keyword: ' data_type_eff(1:end-i_23)]) disp(' ') disp('Available keywords:') TCVkeywrdall(:) @@ -176,12 +216,12 @@ else return end end -disp(['loading' ' ' data_type ' from TCV shot #' num2str(shot)]); +disp(['loading' ' ' data_type_eff ' from TCV shot #' num2str(shot)]); disp(['case ' TCVkeywrdcase{index}]) if i_23==2 & isempty(strmatch(TCVsiglocation(index),liuqe23,'exact')) disp('********') disp('Warning asks for liuqe 2 or 3 of a signal, but not in liuqe23 list in loadTCVdata') - eval(['!mail -s ''' data_type ' ' num2str(shot) ' ' getenv('USER') ' TCV: not in liuqe23 list'' olivier.sauter@epfl.ch < /dev/null']) + eval(['!mail -s ''' data_type_eff ' ' num2str(shot) ' ' getenv('USER') ' TCV: not in liuqe23 list'' olivier.sauter@epfl.ch < /dev/null']) disp('********') end @@ -201,17 +241,16 @@ if nargineff>=3 i1 =varargin{i}(1); i2 =varargin{i}(2); end - end + end end end switch TCVkeywrdcase{index} - - + &&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&& case 'simpletdi' - % load TCV other data + % load TCV other data mdsopen(shot); nodenameeff=[TCVsiglocation{index} liuqe_ext]; % test if node exists @@ -219,16 +258,16 @@ switch TCVkeywrdcase{index} if eval(['~mdsdata(''node_exists("\' nodenameeff '")'')']) disp(['node ' nodenameeff ' does not exist for shot = ' num2str(shot)]) trace.data=[]; - trace.t=[]; trace.x=[]; + trace.t=[]; trace.dim=[]; trace.dimunits=[]; return elseif eval(['mdsdata(''getnci("\' nodenameeff ':foo","length")'')==0']) disp(['no data for node ' nodenameeff ' for shot = ' num2str(shot)]) trace.data=[]; - trace.t=[]; trace.x=[]; + trace.t=[]; trace.dim=[]; trace.dimunits=[]; return @@ -238,8 +277,8 @@ switch TCVkeywrdcase{index} if isempty(tracetdi.data) | isnan(tracetdi.data) disp(['node ' nodenameeff ' is empty for shot = ' num2str(shot)]) trace.data=[]; - trace.t=[]; trace.x=[]; + trace.t=[]; trace.dim=[]; trace.dimunits=[]; return @@ -265,12 +304,12 @@ switch TCVkeywrdcase{index} trace.data=trace.data'; end elseif length(tracetdi.dim)>2 - msgbox(['data more than 2D (data_type=' data_type ... + msgbox(['data more than 2D (data_type_eff=' data_type_eff ... '), check how to save it, contact andrea.scarabosio@epfl.ch or olivier.sauter@epfl.ch'],... 'in simpletdi','warn') warning('in simpletdi of loadTCVdata') else - trace.x=[]; + trace.x=[]; if max(1,TCVsigtimeindx(index))~=1 disp('Problems in loadTCVdata, max(1,TCVsigtimeindx(index)) should be 1') end @@ -288,7 +327,8 @@ switch TCVkeywrdcase{index} trace.t=[]; end error=0; - + + &&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&& case {'ne','te'} % ne or Te from Thomson data on raw z mesh vs (z,t) mdsopen(shot); @@ -310,6 +350,7 @@ switch TCVkeywrdcase{index} trace.t=time; mdsclose + &&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&& case {'nerho','terho'} % ne or Te from Thomson data on rho=sqrt(psi_normalised) mesh: (rho,t) mdsopen(shot); @@ -336,6 +377,7 @@ switch TCVkeywrdcase{index} trace.t=time; mdsclose + &&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&& case {'qrho'} % q profile on psi from liuqe mdsopen(shot); @@ -347,6 +389,7 @@ switch TCVkeywrdcase{index} trace.dimunits=[{'sqrt(psi)'} ; {'time [s]'}]; mdsclose + &&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&& case {TCVkeywrdcase{TCVsig.iprofnerho},TCVkeywrdcase{TCVsig.iprofnerho}} % Thomson profiles with error bars mdsopen(shot); @@ -369,15 +412,16 @@ switch TCVkeywrdcase{index} trace.std=tracestd.data; mdsclose + &&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&& case {'sxr','sxR'} - % load TCV soft x-ray data + % load TCV soft x-ray data % camera selection: 1-10. each camera has 20 channels icamera=[0 1 0 0 0 0 0 0 0 0]; %index of the camera to use if ~isempty(find(status(1:20*icamera*ones(10,1)) == 1)) [fans,vangle,xchord,ychord,aomega,angfact]=xtomo_geometry(1,icamera); - % calculating intersection of the view lines with magnetic axis - if strcmp(data_type,'sxR') + % calculating intersection of the view lines with magnetic axis + if strcmp(data_type_eff,'sxR') if isempty(zmag) zmag=loadTCVdata(shot,['zmag' liuqe_ext]); end @@ -395,34 +439,40 @@ switch TCVkeywrdcase{index} [xtomo_signal,t]=get_xtomo_data(shot,t_1,t_2,13e-6*16, ... icamera,angfact); end - end + end for i=1:(20*icamera*ones(10,1)) trace.t(:,i)=t'; - end - trace.data=xtomo_signal'; + end + trace.data=xtomo_signal'; + trace.dim{1}={trace.t}; + trace.dimunits={'time [s]'}; error=0; + &&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&& case 'ece' % load TCV ECE data - % Status=1 => Not Read Yet + % Status=1 => Not Read Yet if ~isempty(find(status == 1)) [TE_ECE,TE_ECE_ERR,RHO,R,T,TE_THOM,TE_THOM_ERR,Fcentral,CAL]=ece_te ... (shot,[0.1 0.29],10,10); - end + end a=min(find(R(:,1)>=0)); b=max(find(R(:,1)>=0)); for i=1:size(TE_ECE,2) trace.t(:,i)=T(a:b); - end + end trace.data=TE_ECE(a:b,:); - radius.t=trace.t; + radius.t=trace.t; radius.data=R(a:b,:); + trace.dim{1}={trace.t}; + trace.dimunits={'time [s]'}; varargout{1}={radius}; error=0; - + + &&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&& case 'MPX' % load TCV MPX data - % Status=1 => Not Read Yet + % Status=1 => Not Read Yet if isempty(zmag) zmag=loadTCVdata(shot,'zmag'); end @@ -430,19 +480,21 @@ switch TCVkeywrdcase{index} t_2=zmag.t(end); if ~isempty(find(status == 1)) mdsopen(shot); - signal=get_mds_mio('MPX',[t_1 t_2]); + signal=get_mds_mio('MPX',[t_1 t_2]); mdsclose(shot) trace.data=signal.data; for i=1:size(signal.dim{2},2) trace.t(:,i)=signal.dim{1}; - end - end + end + end + trace.dim{1}={trace.t}; + trace.dimunits={'time [s]'}; [xchord,ychord]=mpx_geometry; varargout{1}={VsxrTCVradius(zmag.data,xchord,ychord)}; - error=0; - + error=0; + otherwise - % eval(['!mailto_Andrea ''from loadTCVdata, data_type= ' data_type '''']) - disp(['this data_type' ' ' data_type ' ' 'not yet programmed in loadTCVdata, ask Andrea.Scarabosio@epfl.ch']); + % eval(['!mailto_Andrea ''from loadTCVdata, data_type_eff= ' data_type_eff '''']) + disp(['this data_type_eff' ' ' data_type_eff ' ' 'not yet programmed in loadTCVdata, ask Andrea.Scarabosio@epfl.ch']); end