Skip to content
Snippets Groups Projects
Commit 378cf4ba authored by Olivier Sauter's avatar Olivier Sauter
Browse files

change the structure of defining the different cases for different traces

git-svn-id: https://spcsvn.epfl.ch/repos/TCV/gdat/trunk@1817 d63d8f72-b253-0410-a779-e742ad2e26cf
parent 5ffec959
No related branches found
No related tags found
No related merge requests found
...@@ -30,112 +30,151 @@ ...@@ -30,112 +30,151 @@
% [zmag,error]=loadTCVdata(shot,'zmag'); % [zmag,error]=loadTCVdata(shot,'zmag');
% %
TCVsigkeywrd=[{'Ip'} ; {'zmag'} ; {'rmag'}]; varargout=cell(1,1);
TCVsigtimeindx=['1' ; '1' ; '1'];
% all keywords and corresponding case to run below
TCVkeywrdall=[{'Ip'} {'zmag'} {'rmag'} {'sxr'} {'sxR'} {'ece'}];
TCVsig.iip=1; TCVsig.iip=1;
TCVsig.izmag=2; TCVsig.izmag=2;
TCVsig.irmag=3; TCVsig.irmag=3;
TCVsiglocation=[{'\results::i_p'} ; {'\results::z_axis'} ; {'\results::r_axis'}]; TCVsig.isxr=4;
% setting location of the required data TCVsig.isxR=5;
index_sig=strmatch(data_type,TCVsigkeywrd); TCVsig.iece=6;
if ~isempty(index_sig); % For each keyword, specify which case to use. As most common is 'simpletdi', fill in with this and change
location={TCVsiglocation{index_sig} TCVsigtimeindx(index_sig)}; % only indices needed. Usually use name of case same as keyword name
elseif strcmp(data_type(1:1),'\') TCVkeywrdcase=cell(size(TCVkeywrdall));
index_sig=strmatch(data_type,TCVsiglocation); TCVkeywrdcase(:)={'simpletdi'};
if ~isempty(index_sig) TCVkeywrdcase(TCVsig.isxr)=TCVkeywrdall(TCVsig.isxr);
fprintf(['Note: you can also get this data simply with gdat(shot,' ... TCVkeywrdcase(TCVsig.isxR)=TCVkeywrdall(TCVsig.isxR);
char(TCVsigkeywrd(index_sig)) ') instead of the full node name' ' ' data_type]); TCVkeywrdcase(TCVsig.iece)=TCVkeywrdall(TCVsig.iece);
location={data_type ; '1'};
else % For the 'simpletdi' cases, we need the full node in case gdat was called with full location directly
% eval(['!mailto_Andrea ''from loadTCVdata, data_type= ' data_type '''']) % for the other cases, leave this location empty
end TCVsiglocation=cell(size(TCVkeywrdall));
TCVsiglocation(:)={''};
TCVsiglocation(TCVsig.iip)={'\results::i_p'};
TCVsiglocation(TCVsig.izmag)={'\results::z_axis'};
TCVsiglocation(TCVsig.irmag)={'\results::r_axis'};
% 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));
% find index of signal called upon
if strcmp(data_type(1:1),'\')
% in case full node name was given
index=strmatch(data_type,TCVsiglocation,'exact');
if ~strcmp(TCVkeywrdcase{index},'simpletdi')
msgbox(['Problem in loadTCVdata with data_type = ' data_type ...
'. Full paths of nodes should only be for case simpletdi'],'in loadTCVdata','error')
error('in loadTCVdata')
end
else else
disp(['this data_type' ' ' data_type ' ' 'not yet programmed in loadTCVdata, ask Andrea.Scarabosio@epfl.ch']); index=strmatch(data_type,TCVkeywrdall,'exact');
end end
disp(['loading' ' ' data_type ' from TCV shot #' num2str(shot)]); disp(['loading' ' ' data_type ' from TCV shot #' num2str(shot)]);
disp(['case ' TCVkeywrdcase{index}])
switch TCVkeywrdcase{index}
case 'simpletdi'
% LOAD DATA % load TCV other data
if (strcmp(data_type,'sxr') | strcmp(data_type,'sxR'))
% 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
status=varargin{1};
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')
zmag=varargin{3};
varargout={VsxrTCVradius(zmag.data,xchord,ychord)};
t_1=zmag.t(1);
t_2=zmag.t(end);
else
t_1=0.001;
t_2=3;
varargout={};
end
[xtomo_signal,t]=get_xtomo_data(shot,t_1,t_2,13e-6*16, ...
icamera,angfact);
end
for i=1:(20*icamera*ones(10,1))
trace.t(:,i)=t';
end
trace.data=xtomo_signal';
error=0;
% load TCV ECE data
elseif (strcmp(data_type,'ece'))
status=varargin{2};
% 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
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
trace.data=TE_ECE(a:b,:);
radius.t=trace.t;
radius.data=R(a:b,:);
varargout={radius};
error=0;
% load TCV MPX data
elseif (strcmp(data_type,'MPX'))
status=varargin{1};
% Status=1 => Not Read Yet
zmag=varargin{3};
t_1=zmag.t(1);
t_2=zmag.t(end);
if ~isempty(find(status == 1))
mdsopen(shot); mdsopen(shot);
signal=get_mds_mio('MPX',[t_1 t_2]); tracetdi=tdi(TCVsiglocation{index});
mdsclose(shot) mdsclose(shot)
trace.data=signal.data; trace.data=tracetdi.data;
for i=1:size(signal.dim{2},2) trace.t=tracetdi.dim{TCVsigtimeindx(index)};
trace.t(:,i)=signal.dim{1}; if (length(tracetdi.dim)>1)
ix=2;
if TCVsigtimeindx(index)==2; ix=1; end;
trace.x=tracetdi.dim{ix};
% make sure data is of (x,t)
if ix==2
% transpose data
if length(size(trace.data))==2
trace.data=trace.data';
else
msgbox(['data more than 2D (data_type=' data_type ...
'), check how to save it, contact andrea.scarabosio@epfl.ch or olivier.sauter@epfl.ch'],...
'in simpletdi','warning')
warning('in simpletdi of loadTCVdata')
end
end
else
trace.x=[];
end
error=0;
case {'sxr','sxR'}
% 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
status=varargin{1};
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')
zmag=varargin{3};
varargout={VsxrTCVradius(zmag.data,xchord,ychord)};
t_1=zmag.t(1);
t_2=zmag.t(end);
else
t_1=0.001;
t_2=3;
end
[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))
[xchord,ychord]=mpx_geometry; trace.t(:,i)=t';
varargout={VsxrTCVradius(zmag.data,xchord,ychord)}; end
trace.data=xtomo_signal';
error=0;
error=0;
else case 'ece'
% load TCV other data % load TCV ECE data
varargout={[]}; status=varargin{2};
mdsopen(shot); % Status=1 => Not Read Yet
tracetdi=tdi(location{1}); if ~isempty(find(status == 1))
mdsclose(shot) [TE_ECE,TE_ECE_ERR,RHO,R,T,TE_THOM,TE_THOM_ERR,Fcentral,CAL]=ece_te ...
trace.data=tracetdi.data; (shot,[0.1 0.29],10,10);
time_pos=str2num(location{2}); end
trace.t=tracetdi.dim{time_pos}; a=min(find(R(:,1)>=0));
if (length(tracetdi.dim)>1) b=max(find(R(:,1)>=0));
ii=2; for i=1:size(TE_ECE,2)
if time_pos==2; ii=1; end; trace.t(:,i)=T(a:b);
trace.x=tracetdi.dim{ii}; end
else trace.data=TE_ECE(a:b,:);
trace.x=[]; radius.t=trace.t;
end radius.data=R(a:b,:);
error=0; varargout={radius};
error=0;
case 'MPX'
% load TCV MPX data
status=varargin{1};
% Status=1 => Not Read Yet
zmag=varargin{3};
t_1=zmag.t(1);
t_2=zmag.t(end);
if ~isempty(find(status == 1))
mdsopen(shot);
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
[xchord,ychord]=mpx_geometry;
varargout={VsxrTCVradius(zmag.data,xchord,ychord)};
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']);
end end
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment