From 853e79e6920bb2345ed0014513b1fbf2beb86468 Mon Sep 17 00:00:00 2001 From: Olivier Sauter <Olivier.Sauter@epfl.ch> Date: Sun, 8 May 2022 10:53:16 +0200 Subject: [PATCH] fix units --- matlab/TCV/gdat_tcv.m | 6 +++--- matlab/TCV/tcv_requests_mapping.m | 27 ++++++++++++++++----------- 2 files changed, 19 insertions(+), 14 deletions(-) diff --git a/matlab/TCV/gdat_tcv.m b/matlab/TCV/gdat_tcv.m index 6558b058..e763fd77 100644 --- a/matlab/TCV/gdat_tcv.m +++ b/matlab/TCV/gdat_tcv.m @@ -2139,7 +2139,7 @@ elseif strcmp(mapping_for_tcv.method,'switchcase') rho=[]; end gdat_data.dim{1}=rho; - gdat_data.dimunits=[{'sqrt(psi_norm)'} ; {'time [s]'}]; + gdat_data.dimunits=[{'sqrt(psi_norm)'} ; {'s'}]; gdat_data.x=rho; % add grids_1d to have rhotor, etc gdat_data = get_grids_1d(gdat_data,2,1,gdat_params.nverbose); @@ -3441,7 +3441,7 @@ elseif strcmp(mapping_for_tcv.method,'switchcase') gdat_data.t=[]; end gdat_data.dim=[{gdat_data.x};{gdat_data.t}]; - gdat_data.dimunits=[{'sqrt(psi\_norm)'} ; {'time [s]'}]; + gdat_data.dimunits=[{'sqrt(psi\_norm)'} ; {'s'}]; if ~isempty(gdat_data.t) && any(strcmp(fieldnames(tracetdi),'units')) gdat_data.units=tracetdi.units; end @@ -3629,7 +3629,7 @@ gdat_data.error_bar = vertcat(data_tmp.error_bar); if status_any,gdat_data.data_fullpath = [strjoin({data_tmp(status).data_fullpath},'; '),'; error_bar'];end z = arrayfun(@(x) x.dim{1}, data_tmp, 'UniformOutput', false); gdat_data.dim = {vertcat(z{:}),time}; -gdat_data.dimunits = {'Z [m]' ; 'time [s]'}; +gdat_data.dimunits = {'Z [m]' ; 's'}; gdat_data.x = gdat_data.dim{1}; gdat_data.t = time; gdat_data.system=vertcat(data_tmp.system); diff --git a/matlab/TCV/tcv_requests_mapping.m b/matlab/TCV/tcv_requests_mapping.m index 6933c895..7e193527 100644 --- a/matlab/TCV/tcv_requests_mapping.m +++ b/matlab/TCV/tcv_requests_mapping.m @@ -143,7 +143,7 @@ switch lower(data_request) mapping.expression = ['params_eff = gdat_data.gdat_params;params_eff.data_request=''tcv_eq("r_contour","LIUQE.M")'';' ... 'gdat_tmp=gdat_tcv([],params_eff);aa_data(1,:)=min(gdat_tmp.data,[],1)-0.624;' ... 'aa_data(2,:)=1.136-max(gdat_tmp.data,[],1);gdat_tmp.data=aa_data;gdat_tmp.x=[1:2];gdat_tmp.dim{1}=gdat_tmp.x;' ... - 'gdat_tmp.dimunits{1}={''HFS'',''LFS''};']; + 'gdat_tmp.dimunits{1}={''HFS'',''LFS''};gdat_tmp.units=''m'';']; case {'gas', 'gas_flux', 'gas_request', 'gas_feedforward','gas_valve'} mapping.timedim = 1; mapping.label = 'gas flux'; @@ -168,7 +168,8 @@ switch lower(data_request) 'gdat_tmp2=gdat_tcv(shot,params_eff);'... 'params_eff.data_request=''\tcv_shot::top.results.conf:h_scal'';' ... 'gdat_tmp3=gdat_tcv(shot,params_eff);ih89p=4;' ... - 'ih89p=5;if size(gdat_tmp3.data,1)>=ih89p;gdat_tmp.data = gdat_tmp.data./gdat_tmp2.data .* gdat_tmp3.data(ih89p,:)'';end;']; + 'ih89p=5;if size(gdat_tmp3.data,1)>=ih89p;gdat_tmp.data = gdat_tmp.data./gdat_tmp2.data .* gdat_tmp3.data(ih89p,:)'';end;' ... + 'gdat_tmp.units='''';gdat_tmp.dimunits{1}=''s'';']; case 'h98y2' mapping.timedim = 1; mapping.label = 'H98y2'; @@ -178,7 +179,8 @@ switch lower(data_request) 'gdat_tmp2=gdat_tcv(shot,params_eff);'... 'params_eff.data_request=''\tcv_shot::top.results.conf:h_scal'';' ... 'gdat_tmp3=gdat_tcv(shot,params_eff);ih98y2=5;' ... - 'ih98y2=5;if size(gdat_tmp3.data,1)>=ih98y2;gdat_tmp.data = gdat_tmp.data./gdat_tmp2.data .* gdat_tmp3.data(ih98y2,:)'';end;']; + 'ih98y2=5;if size(gdat_tmp3.data,1)>=ih98y2;gdat_tmp.data = gdat_tmp.data./gdat_tmp2.data .* gdat_tmp3.data(ih98y2,:)'';end;' ... + 'gdat_tmp.units='''';gdat_tmp.dimunits{1}=''s'';']; % $$$ case 'icds' % $$$ mapping.timedim = 1; % $$$ mapping.label = 'various driven current'; @@ -276,7 +278,8 @@ switch lower(data_request) 'gdat_tmp=gdat_tcv(shot,params_eff);params_eff.data_request=''n_greenwald'';' ... 'gdat_tmp2=gdat_tcv(shot,params_eff);ij=find(gdat_tmp2.data==0);gdat_tmp2.data(ij)=NaN;' ... 'tmp_data2=interp1(gdat_tmp2.t,gdat_tmp2.data,gdat_tmp.t,[],NaN);' ... - 'gdat_tmp.data = gdat_tmp.data./(tmp_data2+1e-5);']; + 'gdat_tmp.data = gdat_tmp.data./(tmp_data2+1e-5);' ... + 'gdat_tmp.units='''';gdat_tmp.dimunits{1}=''s'';']; case {'ec_data', 'aux', 'h_cd', 'nbi_data', 'ic_data', 'lh_data', 'ohm_data', 'bs_data'} mapping.timedim = 2; mapping.label = 'various Pdens, Icd, jcd'; @@ -289,7 +292,7 @@ switch lower(data_request) mapping.label = 'toroidal_flux'; mapping.method = 'switchcase'; case {'p_lh', 'plh'} - mapping.label = 'p\_lh threshold'; + mapping.label = 'P\_LH threshold with S'; mapping.timedim = 1; mapping.method = 'expression'; mapping.expression = ['params_eff = gdat_data.gdat_params;params_eff.data_request=''nel'';' ... @@ -297,9 +300,9 @@ switch lower(data_request) 'params_eff.data_request=''surface_edge'';gdat_tmp_s=gdat_tcv(shot,params_eff);' ... 's_nel=interpos(gdat_tmp_s.t,gdat_tmp_s.data,gdat_tmp.t,-1.);b0_nel=interpos(gdat_tmpb0.t,gdat_tmpb0.data,gdat_tmp.t,-1.);' ... 'gdat_tmp.data = 0.0488e6.*(gdat_tmp.data/1e20).^0.717.*abs(b0_nel).^0.803.*s_nel.^0.941;' ... - 'gdat_tmp.label=''P\_LH threshold'';']; + 'gdat_tmp.units=''W'';gdat_tmp.dimunits{1}=''s'';']; case {'p_lh_a_r', 'plh_a_r'} - mapping.label = 'p\_lh threshold'; + mapping.label = 'P\_LH threshold with a, R0'; mapping.timedim = 1; mapping.method = 'expression'; mapping.expression = ['params_eff = gdat_data.gdat_params;params_eff.data_request=''nel'';' ... @@ -307,7 +310,7 @@ switch lower(data_request) 'params_eff.data_request=''a_minor'';gdat_tmp_a=gdat_tcv(shot,params_eff);' ... 'a_nel=interpos(gdat_tmp_a.t,gdat_tmp_a.data,gdat_tmp.t,-1.);b0_nel=interpos(gdat_tmpb0.t,gdat_tmpb0.data,gdat_tmp.t,-1.);' ... 'gdat_tmp.data = 2.15e6.*(gdat_tmp.data/1e20).^0.782.*abs(b0_nel).^0.772.*a_nel.^0.975.*gdat_tmpb0.r0.^0.999;' ... - 'gdat_tmp.label=''P\_LH threshold'';']; + 'gdat_tmp.units=''W'';gdat_tmp.dimunits{1}=''s'';']; case 'psi' mapping.timedim = 1; mapping.label = 'psi(R,Z)'; @@ -433,7 +436,8 @@ switch lower(data_request) mapping.label = 'surface'; mapping.method = 'expression'; mapping.expression = ['params_eff = gdat_data.gdat_params;params_eff.data_request=''tcv_eq(''''''''surf'''''''',''''''''LIUQE.M'''''''')'';' ... - 'gdat_tmp=gdat_tcv(shot,params_eff); gdat_tmp.dim = {gdat_tmp.t}; gdat_tmp.x=[]; gdat_tmp.data= gdat_tmp.data(end,:);']; + 'gdat_tmp=gdat_tcv(shot,params_eff); gdat_tmp.dim = {gdat_tmp.t}; gdat_tmp.x=[]; gdat_tmp.data= gdat_tmp.data(end,:);' ... + 'gdat_tmp.dimunits{1}=''s'';']; case 'sxr' mapping.timedim = 1; mapping.gdat_timedim = 2; @@ -448,7 +452,7 @@ switch lower(data_request) mapping.method = 'switchcase'; case 'teft' mapping.timedim = 2; - mapping.label = 'ne'; + mapping.label = 'te fit'; mapping.method = 'expression'; mapping.expression = ['params_eff = gdat_data.gdat_params;params_eff.data_request=''te_rho''; ' ... 'params_eff.fit=1;params_eff.fit_type=''avg'';gdat_tmp=gdat_tcv([],params_eff);']; @@ -566,7 +570,8 @@ switch lower(data_request) mapping.expression = ['params_eff = gdat_data.gdat_params;params_eff.data_request=''\results::te_x_a[*,12]''; ' ... 'gdat_tmp=gdat_tcv([],params_eff); ' ... 'params_eff = gdat_data.gdat_params;params_eff.data_request=''\magnetics::iplasma:trapeze''; ' ... - 'aa=gdat_tcv([],params_eff);it=find(abs(aa.data)<10e3);it2=iround_os(gdat_tmp.t,aa.t(it));gdat_tmp.data(it2)=NaN;']; + 'aa=gdat_tcv([],params_eff);it=find(abs(aa.data)<10e3);it2=iround_os(gdat_tmp.t,aa.t(it));gdat_tmp.data(it2)=NaN;' ... + 'gdat_tmp.units=''eV'';gdat_tmp.dimunits{1}=''s'';']; % $$$ case '' % $$$ mapping.timedim = 1; -- GitLab