From 3cdaf627748bcb5afbb807622e70537ed2b58a02 Mon Sep 17 00:00:00 2001 From: Olivier Sauter <Olivier.Sauter@epfl.ch> Date: Tue, 18 Feb 2020 19:33:36 +0100 Subject: [PATCH] add examples for calls with within expression for tdi add cell array in 2nd cell for expression argument --- matlab/TCV/gdat_tcv.m | 22 +++++++++++++++++++--- matlab/TCV/tcv_requests_mapping.m | 6 ++++++ 2 files changed, 25 insertions(+), 3 deletions(-) diff --git a/matlab/TCV/gdat_tcv.m b/matlab/TCV/gdat_tcv.m index 547a646e..1a46f4d0 100644 --- a/matlab/TCV/gdat_tcv.m +++ b/matlab/TCV/gdat_tcv.m @@ -57,6 +57,8 @@ function [gdat_data,gdat_params,error_status,varargout] = gdat_tcv(shot,data_req % a6=gdat(48836,'ip','Opt1',123,'Doplot',1,'opt2','Abc'); % standard call with a few options (note all lowercase in output) % a7 = gdat(48836,'static("r_m")[$1]'',''001'); % note first and last quote of tdi argument added by gdat % a7 = gdat(48836,'tcv_eq(''''psi'''',''''liuqe.m'''')'); % do not use double quote char so 'liuqe',11 will work +% a8 = gdat(64770,['\magnetics::bpol_003[*,$1]'',{''001''; ''030''}']); one string full expression +% a9 = gdat(64770,{'\magnetics::vloop[*,$1]',{'''001''','''A_001'''}}); cell array (other option) % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % Remote data access for TCV @@ -387,7 +389,15 @@ if strcmp(mapping_for_tcv.method(1:3),'tdi') end eval_expr = ['tdi(''' mapping_for_tcv.expression{1} '''']; for i=2:length(mapping_for_tcv.expression) - eval_expr = [eval_expr ',''' mapping_for_tcv.expression{i} '''']; + if ~iscell(mapping_for_tcv.expression{i}) || length(mapping_for_tcv.expression{i}) == 1 + eval_expr = [eval_expr ',''' mapping_for_tcv.expression{i} '''']; + else + eval_expr = [eval_expr ',{' mapping_for_tcv.expression{i}{1}]; + for j=2:length(mapping_for_tcv.expression{i}) + eval_expr=[eval_expr ',' mapping_for_tcv.expression{i}{j}]; + end + eval_expr = [eval_expr '}']; + end end eval_expr = [eval_expr ');']; aatmp = eval(eval_expr); @@ -586,7 +596,12 @@ if strcmp(mapping_for_tcv.method(1:3),'tdi') mapping_for_tcv.gdat_timedim = mapping_for_tcv.timedim; end gdat_data.data_fullpath=[mapping_for_tcv.expression]; - gdat_data.label=[mapping_for_tcv.expression]; + if iscell(mapping_for_tcv.expression) + gdat_data.label=[mapping_for_tcv.expression{1}]; + else + gdat_data.label=[mapping_for_tcv.expression]; + end + gdat_data.help = aatmp.help; % end of method "tdi" @@ -2601,7 +2616,8 @@ elseif strcmp(mapping_for_tcv.method,'switchcase') case {'psi_edge'} % psi at edge, 0 by construction in Liuqe, thus not given % add surface_psi from surface_flux and d(surface_flux)/dt = vloop -keyboard + warning('now psi_edge expression in tcv_requests_mapping, so should not come here') + keyboard nodenameeff=['\results::psi_axis' substr_liuqe]; if liuqe_version_eff==-1 nodenameeff=[begstr 'q_psi' substr_liuqe]; diff --git a/matlab/TCV/tcv_requests_mapping.m b/matlab/TCV/tcv_requests_mapping.m index 499bbd90..90f5c9e8 100644 --- a/matlab/TCV/tcv_requests_mapping.m +++ b/matlab/TCV/tcv_requests_mapping.m @@ -32,6 +32,12 @@ mapping.label = data_request; % method = 'switchcase', then there will be a specific case within gdat_tcv (usual case when not directly a signal) % % label is used for plotting +if iscell(data_request) + mapping.label = data_request; + mapping.method = 'tdi'; % assume a full tracename is given, so just try with tdi (could check there are some ":", etc...) + mapping.expression = data_request; + return +end switch lower(data_request) case 'a_minor' mapping.timedim = 1; -- GitLab