From b970db338419987d57a9676057eff83ebff8fd02 Mon Sep 17 00:00:00 2001
From: Olivier Sauter <olivier.sauter@epfl.ch>
Date: Thu, 4 Oct 2001 09:41:48 +0000
Subject: [PATCH] further small changes

git-svn-id: https://spcsvn.epfl.ch/repos/TCV/gdat/trunk@1837 d63d8f72-b253-0410-a779-e742ad2e26cf
---
 JET/loadJETdata.m | 50 ++++++++++++++++++++++++++++++++---------------
 JET/rda_eff.m     | 11 ++++++++---
 2 files changed, 42 insertions(+), 19 deletions(-)

diff --git a/JET/loadJETdata.m b/JET/loadJETdata.m
index 3fd00fd1..4730cf48 100644
--- a/JET/loadJETdata.m
+++ b/JET/loadJETdata.m
@@ -238,6 +238,23 @@ switch JETkeywrdcase{index}
       trace.d=d;
     end
 
+  %&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&
+  case JETkeywrdall{JETsig.iqrho}
+    %  q profile on sqrt(psi_norm)
+    ppftype='ppf';
+    if i_efitm
+      tracename=['eftm/q' name_ext];
+    else
+      tracename=['efit/q' name_ext];
+    end
+    [a,x,t,d,e]=rda_eff(shot,ppftype,tracename);
+    trace.data=a;
+    trace.x=sqrt(x); % x is psi (? to test)
+    trace.t=t;
+    trace.dim=[{trace.x} ; {trace.t}];
+    trace.dimunits=[{'sqrt(\psi)'} ; {'time [s]'}];
+    error=e;
+
   %&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&
   case {JETkeywrdall{JETsig.ine} , JETkeywrdall{JETsig.ite}}
     %  ne, te raw data from LIDR vs R,t. Add error bars
@@ -247,13 +264,13 @@ switch JETkeywrdcase{index}
     else
       tracename=['LIDR/TE' name_ext];
     end
-    [a,t,x,d,e]=jetreaddata(['http://data.jet.uk/' ppftype '/' num2str(shot) '/' tracename]);
-    trace.data=a';
+    [a,x,t,d,e]=rda_eff(shot,ppftype,tracename);
+    trace.data=a;
     trace.x=x;
     trace.t=t;
     trace.dim=[{trace.x} ; {trace.t}];
     trace.dimunits=[{'R [m]'} ; {'time [s]'}];
-    clear error
+    trace.std=[];
     error=e;
 
   %&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&
@@ -265,16 +282,15 @@ switch JETkeywrdcase{index}
     else
       tracename=['LID2/TEO' name_ext];
     end
-    [a,t,x,d,e]=jetreaddata(['http://data.jet.uk/' ppftype '/' num2str(shot) '/' tracename]);
-    trace.data=a';
+    [a,x,t,d,e]=rda_eff(shot,ppftype,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
+    trace.std=[];
     error=e;
 
-
   %&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&
   case {'sxr','sxR'}
     %  LOAD MULTI CHANNEL DATA    
@@ -304,9 +320,9 @@ switch JETkeywrdcase{index}
         % vertical SXR chords
         ppftype='jpf';
         tracename=['db/j3-sxr<v' num2str(i) '''''/1' name_ext];
-        [a,t,x,d,e]=jetreaddata(['http://data.jet.uk/' ppftype '/' num2str(shot) '/' tracename]);
+        [a,x,t,d,e]=rda_eff(shot,ppftype,tracename);
         % Convert from raw sxr data to W/m^2
-        trace.data(i,:) = a' * vconvert(i);
+        trace.data(i,:) = a * vconvert(i);
         trace.t=t;
         trace.x(i,:)=x; 
         error=e;
@@ -321,11 +337,12 @@ switch JETkeywrdcase{index}
       else
         zmag=loadJETdata(shot,'zmag');
       end
-      zmageff=interpos(13,zmag.t,zmag.data,trace.t);
+      zmageff=interp1(zmag.t,zmag.data,trace.t);
       for i=starti:endi
         radius(i,:)=2.848 + (2.172-zmageff') .* tan(-4.5/180.*3.14159 - atan2(0.99.*(i-18),35.31));
       end
       varargout={{radius}}; 
+      trace.R=radius.data;
     end
 
   %&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&
@@ -349,22 +366,23 @@ switch JETkeywrdcase{index}
         % Status=1 => Not Read Yet
         ppftype='ppf';
         tracename=['kk3/te' num2str(i,'%2.2d') name_ext];
-        [a,t,x,d,e]=jetreaddata(['http://data.jet.uk/' ppftype '/' num2str(shot) '/' tracename]);
-        trace.data(i,:)=a';
+        [a,x,t,d,e]=rda_eff(shot,ppftype,tracename);
+        trace.data(i,:)=a;
         trace.t=t;
-        trace.x(i,:)=x'; 
+        trace.x(i,:)=x;
         error=e;
         ppftype='ppf';
         tracename=['kk3/rc' num2str(i,'%2.2d') name_ext];
-        [a,t,x,d,e]=jetreaddata(['http://data.jet.uk/' ppftype '/' num2str(shot) '/' tracename]);
-        radius.data(i,:)=a';
+        [a,x,t,d,e]=rda_eff(shot,ppftype,tracename);
+        radius.data(i,:)=a;
         radius.t=t;
-        radius.x(i,:)=x'; 
+        radius.x(i,:)=x;
       end
     end 
     trace.dim=[{[starti:endi]'} ; {trace.t}];
     trace.dimunits=[{'channels'} ; {'time [s]'}];
     varargout={{radius}}; 
+    trace.R=radius.data;
 
   otherwise
     disp('case not yet defined')
diff --git a/JET/rda_eff.m b/JET/rda_eff.m
index a626a052..f8bcd14d 100644
--- a/JET/rda_eff.m
+++ b/JET/rda_eff.m
@@ -12,17 +12,22 @@ function [data,x,time,hsig,error]=rda_eff(shot,pftype,tracename,varargin);
 %          [data,x,time,hsig,error]=rda_eff(51994,'ppf','efit/xip');
 %          [data,x,time,hsig,error]=rda_eff(52206,'ppf','equi/rmji?uid=jetthg+seq=122');
 %
-% usemds had-coded in this routine determines if RDA or mdsplus is used
+% set global variable: usemdsplus to decide if RDA or mdsplus is used:
+%    >> global usemdsplus
+%    >> usemdsplus=1 % means use mds to get data (default if not defined)
+%    >> usemdsplus=0 % means use jetreaddata routine (RDA)
+%       if ~exist('usemdsplus'); usemdsplus=1; end
 %
 
-usemds=0;
+global usemdsplus
+if ~exist('usemdsplus'); usemdsplus=1; end
 
 time_int=[];
 if nargin>=4 & ~isempty(varargin{1})
   time_int=varargin{1};
 end
 
-if usemds
+if usemdsplus
   % use mdsplus
   
   if ~unix('test -d /home/duval/mdsplus')
-- 
GitLab