From 240fd772167f2cd303b351dbdadeda21ee2f5a9d Mon Sep 17 00:00:00 2001 From: Olivier Sauter <olivier.sauter@epfl.ch> Date: Wed, 26 Sep 2001 14:58:07 +0000 Subject: [PATCH] further debugged options git-svn-id: https://spcsvn.epfl.ch/repos/TCV/gdat/trunk@1825 d63d8f72-b253-0410-a779-e742ad2e26cf --- JET/loadJETdata.m | 2 + TCV/loadTCVdata.m | 98 +++++++++++++++++++++++++++++++++-------------- gdat.m | 17 ++++++-- 3 files changed, 86 insertions(+), 31 deletions(-) diff --git a/JET/loadJETdata.m b/JET/loadJETdata.m index d2ff4892..b12bc7ed 100644 --- a/JET/loadJETdata.m +++ b/JET/loadJETdata.m @@ -80,6 +80,8 @@ if size(data_type,1)==2 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']) disp('********************') % temporarily add entry in arrays, so can work below index=length(JETkeywrdall)+1; diff --git a/TCV/loadTCVdata.m b/TCV/loadTCVdata.m index b601d5ca..5a1bb477 100644 --- a/TCV/loadTCVdata.m +++ b/TCV/loadTCVdata.m @@ -1,33 +1,46 @@ function [trace,error,varargout]=loadTCVdata(shot,data_type,varargin) % +% 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 +% '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 % % INPUT: % shot: shot number -% data_type: type of the required data. Ex.: 'Ip', 'zmag', 'rmag','sxr', 'ece', 'sxR' -% 'MPX' -% optional: -% varargin{1}: channel status 1= unread yet, 0= read -% varargin{2}: [i1 i2] : if not empty, assumes need many chords from i1 to i2 -% varargin{3}: zmag for varargout{1} computation +% data_type: type of the required data +% +% Definition of varargin depends on data_type: +% +% data_type=sxr or ece: +% varargin{1}: channel status 1= unread yet, 0= read +% (for traces with many channel, enables to load additional channels, +% like SXR, ECE, etc.) +% 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 % trace.x: space of reference -% varargout{1}: intersection of the view lines with magnetic axis +% +% Additional Output arguments depending on data_type +% +% data_type=sxR, ece: +% varargout{1}: major radius: intersection/projection of the view lines with z=zmag +% data_type=MPX: +% varargout{1}: te be determined +% % % function needed: mds functions-xtomo_geometry-get_xtomo_data (Furno's routines) -% get_mdsdata (Reimerdes's routine)VsxrTCVradius -% 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 -% '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 +% VsxrTCVradius % Example: -% [zmag,error]=loadTCVdata(shot,'zmag'); +% [ip,error]=loadTCVdata(shot,'Ip',1); +% [sxr,error,R]=loadTCVdata(shot,'sxR',1); % varargout{1}=cell(1,1); @@ -64,7 +77,19 @@ TCVsigtimeindx=ones(size(TCVkeywrdall)); if strcmp(data_type(1:1),'\') % in case full node name was given index=strmatch(data_type,TCVsiglocation,'exact'); - if ~strcmp(TCVkeywrdcase{index},'simpletdi') + 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']) + 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}; + TCVsigtimeindx(end+1)=0; + elseif ~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') @@ -105,25 +130,42 @@ switch TCVkeywrdcase{index} tracetdi=tdi(TCVsiglocation{index}); mdsclose(shot) trace.data=tracetdi.data; - trace.t=tracetdi.dim{TCVsigtimeindx(index)}; - if (length(tracetdi.dim)>1) + trace.t=tracetdi.dim{max(1,TCVsigtimeindx(index))}; + if length(tracetdi.dim)==2 + % 2D data ix=2; - if TCVsigtimeindx(index)==2; ix=1; end; + if TCVsigtimeindx(index)==2; + ix=1; + elseif TCVsigtimeindx(index)==0; + % time array unknow, assumes time array with values having most number of digits + ab1=num2str(tracetdi.dim{1}-fix(tracetdi.dim{1})); + ab2=num2str(tracetdi.dim{2}-fix(tracetdi.dim{2})); + if size(ab1,2)<size(ab2,2); ix=1; end + disp(['assumes time array has more digits, so x from dim{' num2str(ix) '}']) + 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') + trace.data=trace.data'; + if TCVsigtimeindx(index)==2 + trace.t=tracetdi.dim{1}; + end + else + if max(1,TCVsigtimeindx(index))==1 + trace.t=tracetdi.dim{2}; end end + elseif length(tracetdi.dim)>2 + 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','warn') + warning('in simpletdi of loadTCVdata') else trace.x=[]; + if max(1,TCVsigtimeindx(index))~=1 + disp('Problems in loadTCVdata, max(1,TCVsigtimeindx(index)) should be 1') + end end error=0; diff --git a/gdat.m b/gdat.m index b8e84277..bfa11200 100644 --- a/gdat.m +++ b/gdat.m @@ -59,6 +59,8 @@ function [trace,error,varargout] = gdat(shot,data_type,varargin) % % +gdatpaths + nargineff=nargin; if nargineff>=3 & ischar(varargin{1}) data_type={data_type ; varargin{1}}; @@ -87,12 +89,21 @@ end % PLOT DATA (if required) if doplot==1 figure;zoom on - plot(trace.t,trace.data); + if length(size(trace.data))<=2 + plot(trace.t,trace.data); + ylabel(data_type) + else + plot(trace.t,trace.data(:,:,1)); + ylabel([data_type '(:,:,1)']) + end xlabel('time [s]') - ylabel(data_type) title([machine ' ' num2str(shot)]) grid elseif doplot==-1 hold on - plot(trace.t,trace.data,'r'); + if length(size(trace.data))<=2 + plot(trace.t,trace.data); + else + plot(trace.t,trace.data(:,:,1),'--'); + end end -- GitLab