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

add experiment for shotfiles so can take ECED/RMD/Trad-A for example

git-svn-id: https://spcsvn.epfl.ch/repos/TCV/gdat/trunk@4250 d63d8f72-b253-0410-a779-e742ad2e26cf
parent 5781992b
No related branches found
No related tags found
No related merge requests found
...@@ -8,7 +8,10 @@ function [trace,error,varargout]=loadAUGdata(shot,data_type,varargin) ...@@ -8,7 +8,10 @@ function [trace,error,varargout]=loadAUGdata(shot,data_type,varargin)
% 'sxR' = soft x-ray emission with varargout{1} option (requires varargin{5}!) % 'sxR' = soft x-ray emission with varargout{1} option (requires varargin{5}!)
% 'SXB' = soft x-ray emission from (by default camera J) SXB/J_xx camera (sxb, sxB, etc all work) % 'SXB' = soft x-ray emission from (by default camera J) SXB/J_xx camera (sxb, sxB, etc all work)
% %
% gdat(15133,'MAG/Ipi',1,'AUG') % gdat(15133,'MAG/Ipa',1,'AUG') % uses experiment=AUGD shotfiles per default
% gdat(15133,'MAG/Ipa',1) (sufficient at AUG since 'AUG' per defaut, same with gdat(15133,'ip',1)
% gdat(15133,'AUGD/MAG/Ipa',1,'AUG') % to specify experiment explicitely like in:
% gdat(30230,'ECED/RMD/Trad-A',1,'AUG') %
% %
% INPUT: % INPUT:
% shot: shot number % shot: shot number
...@@ -52,14 +55,22 @@ function [trace,error,varargout]=loadAUGdata(shot,data_type,varargin) ...@@ -52,14 +55,22 @@ function [trace,error,varargout]=loadAUGdata(shot,data_type,varargin)
varargout={cell(1,1)}; varargout={cell(1,1)};
error=1; error=1;
shotfile_exp = 'AUGD';
% To allow multiple ways of writing a specific keyword, use data_type_eff within this routine % To allow multiple ways of writing a specific keyword, use data_type_eff within this routine
data_type_eff=data_type; data_type_eff=data_type;
if size(data_type_eff,1)==1 if size(data_type_eff,1)==1
i=findstr('/',data_type_eff); i=findstr('/',data_type);
if length(i)>=1 if length(i)==1
% assumes given a la 'MAG/Ipi' % assumes given a la 'MAG/Ipi'
data_type_eff=[{data_type_eff(1:i(1)-1)} ; {data_type_eff(i(1)+1:end)}]; data_type_eff=[{data_type(1:i(1)-1)} ; {data_type(i(1)+1:end)}];
elseif length(i)==2
% assumes given a la 'AUGD/MAG/Ipi' or 'ECED/RMP/Trad-A'
data_type_eff=[{data_type(i(1)+1:i(2)-1)} ; {data_type(i(2)+1:end)}];
shotfile_exp = data_type(1:i(1)-1);
else
disp(['more / than expected in tracename: length(i)= ' num2str(length(i))])
data_type
end end
end end
...@@ -181,7 +192,7 @@ AUGsigtimeindx=ones(size(AUGkeywrdall)); ...@@ -181,7 +192,7 @@ AUGsigtimeindx=ones(size(AUGkeywrdall));
% for the other cases, leave this location empty % for the other cases, leave this location empty
AUGsiglocation=cell(2,size(AUGkeywrdall,2)); AUGsiglocation=cell(2,size(AUGkeywrdall,2));
AUGsiglocation(:)={''}; AUGsiglocation(:)={''};
AUGsiglocation(:,AUGsig.iip)={'MAG'; 'Ipi'}; AUGsiglocation(:,AUGsig.iip)={'MAG'; 'Ipa'};
AUGsiglocation(:,AUGsig.izmag)={'FPG'; 'Zmag'}; AUGsiglocation(:,AUGsig.izmag)={'FPG'; 'Zmag'};
AUGsiglocation(:,AUGsig.irmag)={'FPG'; 'Rmag'}; AUGsiglocation(:,AUGsig.irmag)={'FPG'; 'Rmag'};
AUGsiglocation(:,AUGsig.ircont)={'' ; ''}; AUGsigtimeindx(AUGsig.ircont)=2; AUGsiglocation(:,AUGsig.ircont)={'' ; ''}; AUGsigtimeindx(AUGsig.ircont)=2;
...@@ -269,7 +280,7 @@ switch AUGkeywrdcase{index} ...@@ -269,7 +280,7 @@ switch AUGkeywrdcase{index}
end end
ij=find(tracename~=''''); ij=find(tracename~='''');
tracename=tracename(ij) tracename=tracename(ij)
[a,e]=rdaAUG_eff(shot,ppftype,tracename); [a,e]=rdaAUG_eff(shot,ppftype,tracename,shotfile_exp);
% switch tracename % switch tracename
% special cases if traces do not exist for some shot or other % special cases if traces do not exist for some shot or other
% end % end
...@@ -277,7 +288,9 @@ switch AUGkeywrdcase{index} ...@@ -277,7 +288,9 @@ switch AUGkeywrdcase{index}
trace=a; trace=a;
clear error clear error
error=e; error=e;
if length(size(trace.data))==1 | (length(size(trace.data))==2 & size(trace.data,2)==1) if isempty(trace.data)
trace.dimunits=[];
elseif length(size(trace.data))==1 | (length(size(trace.data))==2 & size(trace.data,2)==1)
trace.dim=[{trace.t}]; trace.dim=[{trace.t}];
trace.dimunits={'time [s]'}; trace.dimunits={'time [s]'};
elseif length(size(trace.data))==2 elseif length(size(trace.data))==2
...@@ -325,7 +338,7 @@ switch AUGkeywrdcase{index} ...@@ -325,7 +338,7 @@ switch AUGkeywrdcase{index}
trace.t=[]; trace.t=[];
trace.x=[]; trace.x=[];
ppftype='SXR'; ppftype='SXR';
[a,e]=rdaAUG_eff(shot,ppftype,tracename,timerange); [a,e]=rdaAUG_eff(shot,ppftype,tracename,shotfile_exp,timerange);
trace=a; trace=a;
trace.dim=[{[starti:endi]'} ; {trace.t}]; trace.dim=[{[starti:endi]'} ; {trace.t}];
trace.x=trace.dim{1}; trace.x=trace.dim{1};
...@@ -397,7 +410,7 @@ switch AUGkeywrdcase{index} ...@@ -397,7 +410,7 @@ switch AUGkeywrdcase{index}
iok=0; iok=0;
for ichord=starti:endi for ichord=starti:endi
tracename_eff = [tracename '_' num2str(ichord,'%.3d')]; tracename_eff = [tracename '_' num2str(ichord,'%.3d')];
[a,e]=rdaAUG_eff(shot,ppftype,tracename_eff,timerange); [a,e]=rdaAUG_eff(shot,ppftype,tracename_eff,shotfile_exp,timerange);
if isempty(a) || e~=0 if isempty(a) || e~=0
trace_all = struct([]); trace_all = struct([]);
else else
...@@ -439,9 +452,9 @@ switch AUGkeywrdcase{index} ...@@ -439,9 +452,9 @@ switch AUGkeywrdcase{index}
case {'te', 'ne'} case {'te', 'ne'}
if strcmp(AUGkeywrdcase{index},'te') if strcmp(AUGkeywrdcase{index},'te')
[a,e]=rdaAUG_eff(shot,'YPR','Te'); [a,e]=rdaAUG_eff(shot,'YPR','Te',shotfile_exp);
else else
[a,e]=rdaAUG_eff(shot,'YPR','Ne'); [a,e]=rdaAUG_eff(shot,'YPR','Ne',shotfile_exp);
end end
trace = a; trace = a;
trace.data = a.value'; trace.data = a.value';
...@@ -458,18 +471,18 @@ switch AUGkeywrdcase{index} ...@@ -458,18 +471,18 @@ switch AUGkeywrdcase{index}
else else
DIAG = 'EQI'; DIAG = 'EQI';
end end
[a,e]=rdaAUG_eff(shot,DIAG,'Qpsi'); [a,e]=rdaAUG_eff(shot,DIAG,'Qpsi',shotfile_exp);
% Qpsi has inverted channel/time from CEC % Qpsi has inverted channel/time from CEC
a.value = a.value(:,end:-1:1)'; a.value = a.value(:,end:-1:1)';
a.data = a.value; a.data = a.value;
% get x values % get x values
[psi,e]=rdaAUG_eff(shot,DIAG,'PFL'); [psi,e]=rdaAUG_eff(shot,DIAG,'PFL',shotfile_exp);
psi.value=psi.value(:,end:-1:1)'; psi.value=psi.value(:,end:-1:1)';
psi_axis= (ones(size(psi.value,1),1) * psi.value(1,:)); psi_axis= (ones(size(psi.value,1),1) * psi.value(1,:));
a.x = sqrt(abs((psi.value-psi_axis) ./(zeros(size(psi.value))-psi_axis) )); % psi_edge=0 assumed a.x = sqrt(abs((psi.value-psi_axis) ./(zeros(size(psi.value))-psi_axis) )); % psi_edge=0 assumed
a.psi = psi.value; a.psi = psi.value;
% get time values % get time values
[psi_time,e]=rdaAUG_eff(shot,DIAG,'time'); [psi_time,e]=rdaAUG_eff(shot,DIAG,'time',shotfile_exp);
if length(psi_time.value) > length(a.x(1,:)) if length(psi_time.value) > length(a.x(1,:))
a.t = psi_time.value(1:length(a.x(1,:))); % problem with times?? a.t = psi_time.value(1:length(a.x(1,:))); % problem with times??
elseif length(psi_time.value) < length(a.x(1,:)) elseif length(psi_time.value) < length(a.x(1,:))
...@@ -479,12 +492,12 @@ switch AUGkeywrdcase{index} ...@@ -479,12 +492,12 @@ switch AUGkeywrdcase{index}
a.t = psi_time.value; a.t = psi_time.value;
end end
% get rhotor values % get rhotor values
[phi,e]=rdaAUG_eff(shot,DIAG,'TFLx'); [phi,e]=rdaAUG_eff(shot,DIAG,'TFLx',shotfile_exp);
phi.value=phi.value(:,end:-1:1)'; phi.value=phi.value(:,end:-1:1)';
a.rhotor = sqrt(abs(phi.value ./ (ones(size(phi.value,1),1) * phi.value(end,:)))); a.rhotor = sqrt(abs(phi.value ./ (ones(size(phi.value,1),1) * phi.value(end,:))));
a.torflux = phi.value; a.torflux = phi.value;
% get rhovol values % get rhovol values
[Vol,e]=rdaAUG_eff(shot,DIAG,'Vol'); [Vol,e]=rdaAUG_eff(shot,DIAG,'Vol',shotfile_exp);
Vol.value=Vol.value(:,end-1:-2:1)'; % 2nd index are dV/dpsi Vol.value=Vol.value(:,end-1:-2:1)'; % 2nd index are dV/dpsi
a.rhovol = sqrt(abs(Vol.value ./ (ones(size(Vol.value,1),1) * Vol.value(end,:)))); a.rhovol = sqrt(abs(Vol.value ./ (ones(size(Vol.value,1),1) * Vol.value(end,:))));
a.volume = Vol.value; a.volume = Vol.value;
......
function [adata,error]=rdaAUG_eff(shot,diagname,sigtype,varargin); function [adata,error]=rdaAUG_eff(shot,diagname,sigtype,shotfile_exp,varargin);
% %
% gets data using sf2sig or mdsplus (when mdsplus will be available) % gets data using sf2sig or mdsplus (when mdsplus will be available)
% 1D arrays: assumes dimension is time % 1D arrays: assumes dimension is time
...@@ -24,7 +24,7 @@ if isempty(usemdsplus); usemdsplus=1; end ...@@ -24,7 +24,7 @@ if isempty(usemdsplus); usemdsplus=1; end
error=1; error=1;
time_int=[]; time_int=[];
if nargin>=4 & ~isempty(varargin{1}) if nargin>=5 & ~isempty(varargin{1})
time_int=varargin{1}; time_int=varargin{1};
end end
...@@ -43,7 +43,7 @@ if usemdsplus ...@@ -43,7 +43,7 @@ if usemdsplus
end end
user=getenv('USER'); user=getenv('USER');
if nargin>=4 & ~isempty(varargin{1}) if nargin>=5 & ~isempty(varargin{1})
['[data,error]=mdsvalue(''_rdaeff' user diagname '=augsignal(' num2str(shot) ',"' diagname '","' sigtype '",,,' ... ['[data,error]=mdsvalue(''_rdaeff' user diagname '=augsignal(' num2str(shot) ',"' diagname '","' sigtype '",,,' ...
num2str(varargin{1}(1),'%.14f') ',' num2str(varargin{1}(end),'%.14f') ')'');'] num2str(varargin{1}(1),'%.14f') ',' num2str(varargin{1}(end),'%.14f') ')'');']
eval(['[data,error]=mdsvalue(''_rdaeff' user diagname '=augsignal(' num2str(shot) ',"' diagname '","' sigtype '",,,' ... eval(['[data,error]=mdsvalue(''_rdaeff' user diagname '=augsignal(' num2str(shot) ',"' diagname '","' sigtype '",,,' ...
...@@ -89,23 +89,27 @@ else ...@@ -89,23 +89,27 @@ else
% use sf2sig % use sf2sig
if isempty(time_int) if isempty(time_int)
try try
[adata,adata_time, adata_area]=sf2sig(diagname,shot,sigtype); [adata,adata_time, adata_area]=sf2sig(diagname,shot,sigtype,'-exp',shotfile_exp);
catch catch
adata = struct([]); adata.value = [];
adata_time = struct([]); adata.data = [];
adata.dim = [];
adata_time.data = [];
adata_area = []; adata_area = [];
end end
else else
try try
[adata,adata_time, adata_area]=sf2sig(diagname,shot,sigtype,[time_int(1);time_int(end)]); [adata,adata_time, adata_area]=sf2sig(diagname,shot,sigtype,[time_int(1);time_int(end)],'-exp',shotfile_exp);
catch catch
adata = struct([]); adata.value = [];
adata_time = struct([]); adata.data = [];
adata.dim = [];
adata_time.data = [];
adata_area = []; adata_area = [];
end end
end end
if isempty(adata) if isempty(adata.value)
return return
end end
...@@ -121,6 +125,8 @@ else ...@@ -121,6 +125,8 @@ else
adata.time_aug = adata_time; adata.time_aug = adata_time;
adata.area = adata_area; adata.area = adata_area;
adata.exp = shotfile_exp;
if (prod(size(adata.value))==length(adata.value)) if (prod(size(adata.value))==length(adata.value))
% only time signal % only time signal
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment