From 0b65abfa749fc18f9cd2b94cbd214dc46ac9620d Mon Sep 17 00:00:00 2001
From: Olivier Sauter <olivier.sauter@epfl.ch>
Date: Tue, 26 Sep 2017 14:22:03 +0000
Subject: [PATCH] add source=adcs in rtc request

git-svn-id: https://spcsvn.epfl.ch/repos/TCV/gdat/trunk@8593 d63d8f72-b253-0410-a779-e742ad2e26cf
---
 crpptbx/TCV/gdat_tcv.m            | 40 +++++++++++++++++++++----------
 crpptbx/TCV/tcv_help_parameters.m |  7 +++---
 2 files changed, 32 insertions(+), 15 deletions(-)

diff --git a/crpptbx/TCV/gdat_tcv.m b/crpptbx/TCV/gdat_tcv.m
index 8c86fa64..857cbf4b 100644
--- a/crpptbx/TCV/gdat_tcv.m
+++ b/crpptbx/TCV/gdat_tcv.m
@@ -1825,18 +1825,22 @@ elseif strcmp(mapping_for_tcv.method,'switchcase')
     %define_simulink_signals
 
     % If the rtccode/developemnet folder is not in your path
-    % read from Carpanese's folder ( he might have not
-    % updated the folder to the last version) 
-    if exist('~/rtccode/development/tools/io_defs')
-      addpath('~/rtccode/development/tools/io_defs');
-    else
-      addpath('/home/carpanes/rtccode/development/tools/io_defs');
-    end              
-    
-    sources_avail = {'defined', 'all'};
+    % read from default or Carpanese's folder ( he might have not
+    % updated the folder to the last version)
+    aaa=which('take_all_signals');
+    if isempty(aaa)
+      if exist('/home/sauter/TCV/rtc_tools_io_defs_crpptbx')
+        addpath('/home/sauter/TCV/rtc_tools_io_defs_crpptbx','-end');
+      elseif exist('~/rtccode/development/tools/io_defs')
+        addpath('~/rtccode/development/tools/io_defs','-end');
+      else
+        addpath('/home/carpanes/rtccode/development/tools/io_defs','-end');
+      end
+    end
+    sources_avail = {'defined', 'all', 'adcs'};
     %Check if varargins match source_avail
     if ~isfield(gdat_data.gdat_params,'source') || isempty(gdat_data.gdat_params.source) % with no specifications all, defined, combined are taken
-      gdat_data.gdat_params.source = sources_avail;
+      gdat_data.gdat_params.source = sources_avail(1:2);
     elseif ~iscell(gdat_data.gdat_params.source)
       if ischar(gdat_data.gdat_params.source)
         gdat_data.gdat_params.source = lower(gdat_data.gdat_params.source);
@@ -1846,7 +1850,7 @@ elseif strcmp(mapping_for_tcv.method,'switchcase')
           end
           return
         else
-          gdat_data.gdat_params.source = {gdat_data.gdat_params.source};
+          gdat_data.gdat_params.source = {lower(gdat_data.gdat_params.source)};
         end
       else
         if (gdat_params.nverbose>=1); warning([' source parameter not compatible with: ' sprintf('''%s'' ',sources_avail{:})]); end
@@ -1856,7 +1860,6 @@ elseif strcmp(mapping_for_tcv.method,'switchcase')
       tmp = {};
       for i=1:length(gdat_data.gdat_params.source)
         gdat_data.gdat_params.source{i} = lower(gdat_data.gdat_params.source{i}); %put vargin in params
-        
         if ~any(strmatch(gdat_data.gdat_params.source{i},lower(sources_avail)))
           if gdat_data.gdat_params.nverbose>=1
             warning(['source = ' gdat_data.gdat_params.source{i} ' not expected with data_request= ' data_request_eff])
@@ -1867,10 +1870,23 @@ elseif strcmp(mapping_for_tcv.method,'switchcase')
       end
       gdat_data.gdat_params.source = tmp;
     end
+    if isfield(gdat_data.gdat_params,'max_adcs')
+      zshift = gdat_data.gdat_params.max_adcs;
+    else
+      gdat_data.gdat_params.max_adcs = [];
+    end
     
     % Get data for the source requested
     for isource=1:numel(gdat_data.gdat_params.source)
       switch gdat_data.gdat_params.source{isource}
+       case 'adcs'
+        [DS, DSraw] = take_all_adcs(shot,gdat_data.gdat_params.max_adcs);
+        gdat_data.adcs = DSraw;
+        gdat_data.adcs_grouped = DS;
+        mdsclose;
+        mdsdisconnect;
+        mdsopen(shot);
+        
        case 'defined'
         DS = take_all_signals(shot); %Read from mds
         SDS_DS = define_simulink_signals(DS); %Put them in predifined structure
diff --git a/crpptbx/TCV/tcv_help_parameters.m b/crpptbx/TCV/tcv_help_parameters.m
index 683e1ce1..0ccd2b0b 100644
--- a/crpptbx/TCV/tcv_help_parameters.m
+++ b/crpptbx/TCV/tcv_help_parameters.m
@@ -39,14 +39,15 @@ help_struct_all.edge = '0 (default), 1 to get edge Thomson values';
 help_struct_all.fit = '0, no fit profiles, 1 (default) if fit profiles desired as well, relevant for _rho profiles. See also fit_type';
 help_struct_all.fit_type = 'provenance of fitted profiles ''conf'' (default) from conf nodes, ''avg'' or ''local'' for resp. proffit: nodes';
 help_struct_all.trialindx = 'value of trialindx desired to get a specific one when relevant, otherwise gets ok_trialindx, that is 1 usually';
-help_struct_all.source = sprintf('%s\n%s\n%s\n%s','cxrs: [1 2 3] (default systems);', ...
+help_struct_all.source = sprintf('%s\n','cxrs: [1 2 3] (default systems);', ...
           'sxr: main source: ''MPX'' (default) or ''XTOMO'', case insensitive', ...
           'mhd request: ''23'':23 LFS/HFS (default), ''23full'': 23cm sector 3 and 11, ''0'':z=0 LFS/HFS, ''0full'': 0cm sector 3 and 11', ...
-          'powers: ohmic in any case + ''ec'', ''nbi''');
+          'powers: ohmic in any case + ''ec'', ''nbi''', ...
+          'rtc: defined, all, adcs');
 help_struct_all.camera = ['sxr: for MPX: ''central'', ''top'' (default), ''bottom'' or ''both'' ; ' ...
                     ' for XTOMO: ''central'' (a central chord only), defaults if empty, [1 3 5] if only camera 1, 3 and 5 are desired'];
 help_struct_all.freq = '''slow'', default, lower sampling; ''fast'' full samples for both mpx and xtomo';
-%help_struct_all. = '';
+help_struct_all.max_adcs = 'rtc: source=''adcs'' maximum nb of adc channels loaded for each board in each active node';
 
 %help_struct_all. = '';
 
-- 
GitLab