Skip to content
Snippets Groups Projects

Compare revisions

Changes are shown as if the source revision was being merged into the target revision. Learn more about comparing revisions.

Source

Select target project
No results found
Select Git revision

Target

Select target project
  • spc/gdat
1 result
Select Git revision
Show changes
Commits on Source (16)
......@@ -130,6 +130,9 @@ switch lower(data_request)
mapping.gdat_timedim = 2;
mapping.method = 'switchcase'; % could use function make_eqdsk directly?
mapping.expression = '';
case {'gas', 'gas_valve'}
mapping.gdat_timedim = 2;
mapping.method = 'switchcase';
case 'halpha'
mapping.timedim = 1;
mapping.label = 'Halpha';
......
......@@ -1297,6 +1297,82 @@ elseif strcmp(mapping_for_aug.method,'switchcase')
gdat_data.dimunits{1} = 'rhopolnorm';
gdat_data.dimunits{2} = 'time [s]';
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
case {'gas', 'gas_valve', 'gas_valves'}
%
uvs_signals_source = [{'D_tot','Sum of calibrated D2 gas-fluxes (= D/s)'}; ...
{'N_tot','Sum of calibrated N2 gas-fluxes (= N*7/s)'}; ...
{'H_tot','Sum of calibrated H gas-fluxes (= H/s)'}; ...
{'He_tot','Sum of calibrated He gas-fluxes (= He*2/s)'}; ...
{'Ne_tot','Sum of calibrated Ne gas-fluxes (= Ne*10/s)'}; ...
{'Ar_tot','Sum of calibrated Ar gas-fluxes (= Ar*18/s)'}];
for i=1:size(uvs_signals_source,1)
uvs_signals.(uvs_signals_source{i,1}) = gdat_aug(shot,{'UVS',uvs_signals_source{i,1}});
if isempty(gdat_data.t) && numel(uvs_signals.(uvs_signals_source{i,1}).t)>10
gdat_data.t = uvs_signals.(uvs_signals_source{i,1}).t; % all have same time base, could use time signal
end
if ~isempty(uvs_signals.(uvs_signals_source{i,1}).data) && numel(uvs_signals.(uvs_signals_source{i,1}).data) == numel(gdat_data.t);
gdat_data.data(i,:) = uvs_signals.(uvs_signals_source{i,1}).data; % all have same time base
else
gdat_data.data(i,:) = NaN;
end
gdat_data.units{i} = uvs_signals_source{i,2};
end
gdat_data.data_fullpath = 'from UVS and uvs_signals_source';
gdat_data.uvs_signals_source = uvs_signals_source;
gdat_data.label = uvs_signals_source(:,1)';
gdat_data.dim{2} = gdat_data.t;
gdat_data.dimunits{2} = 's';
gdat_data.dim{1} = [1:size(gdat_data.data,1)];
gdat_data.dimunits{1} = 'uvs_signals_source index';
gdat_data.x = gdat_data.dim{1};
gdat_data.mapping_for.aug.timedim = 1;
% note also available in UVS, not commented the same way on ISIS
uvd_signals_source=[{'CFCu01T','PV01','empty comment'}; ...
{'CFCo02A','PV02','valve flux, normally for prefill'}; ...
{'CFFo02A','PV03','valve flux,'}; ...
{'CFA13B','PV04','valve flux, in-vessel pipe for gas imaging'}; ...
{'CFA03B','PV05','valve flux,'}; ...
{'CFFo07A','PV06','valve flux,'}; ...
{'CFDu05X','PV07','valve flux, normally with N2'}; ...
{'CFDu05B','PV08','valve flux, normally with D2'}; ...
{'CFCo10A','PV09','valve flux, in-vessel pipe into ICRH limiter'}; ...
{'CFDu01B','PV10','valve flux, normally with D2'}; ...
{'CFDu09B','PV11','valve flux, normally with D2'}; ...
{'CFFo10A','PV12','valve flux,'}; ...
{'CFFo14A','PV13','valve flux,'}; ...
{'CFA03C','PV14','valve flux, short feeding pipe for rare gases'}; ...
{'CFA13A','PV15','valve flux,'}; ...
{'CFA03A','PV16','valve flux,'}; ...
{'CFDu09X','PV17','valve flux, normally with N2'}; ...
{'CFDu13X','PV18','valve flux, normally with N2'}; ...
{'CFDu13B','PV19','valve flux, normally with D2'}; ...
{'CFDu01X','PV20','valve flux, normally with N2'}];
gdat_data.pvxx.t = [];
gdat_data.pvxx.t = [];
for i=1:size(uvd_signals_source,1)
uvd_signals.(uvd_signals_source{i,2}) = gdat_aug(shot,{'UVD',uvd_signals_source{i,1}});
if isempty(gdat_data.pvxx.t) && numel(uvd_signals.(uvd_signals_source{i,2}).t)>10
gdat_data.pvxx.t = uvd_signals.(uvd_signals_source{i,2}).t; % all have same time base
end
if ~isempty(uvd_signals.(uvd_signals_source{i,2}).data) && numel(uvd_signals.(uvd_signals_source{i,2}).data) == numel(gdat_data.pvxx.t);
gdat_data.pvxx.data(i,:) = uvd_signals.(uvd_signals_source{i,2}).data; % all have same time base
else
gdat_data.pvxx.data(i,:) = NaN;
end
gdat_data.pvxx.units{i} = [uvd_signals_source{i,2} ': ' uvd_signals_source{i,3}];
end
gdat_data.pvxx.data_fullpath = 'from UVD and uvd_signals_source';
gdat_data.pvxx.uvd_signals_source = uvd_signals_source;
gdat_data.pvxx.label = uvd_signals_source(:,2)';
gdat_data.pvxx.dim{2} = gdat_data.t;
gdat_data.pvxx.dimunits{2} = 's';
gdat_data.pvxx.dim{1} = [1:size(gdat_data.pvxx.data,1)];
gdat_data.pvxx.dimunits{1} = 'PVxx index';
gdat_data.pvxx.x = gdat_data.dim{1};
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
case {'ids'}
params_eff = gdat_data.gdat_params;
......
......@@ -574,7 +574,15 @@ elseif strcmp(mapping_for_jet.method,'switchcase')
end
else
% assume same time for all
% mds_dir = '/home/amerle/public/mds-ssh';
mds_dir = '/home/amerle/public/mds-ssh3';
if exist(mds_dir,'dir') && ~strcmp(which('mdsipmex'),fullfile(mds_dir,'mdsipmex.mexa64'))
addpath(mds_dir);
end
mdsconnect(['ssh://' gdat_params.jet_user '@mdsplus.jetdata.eu']);
if exist(mds_dir,'dir') && ~strcmp(which('mdsipmex'),fullfile(mds_dir,'mdsipmex.mexa64'))
rmpath(mds_dir);
end
rda_data_request = ['ppf/kk3/' num2str(i,'te%.2d')];
bb = mdsvalue(['_bb=jet("' rda_data_request '",' num2str(shot) ')']);
if ~isempty(bb) && numel(bb)==size(aa.data,2)
......
......@@ -34,7 +34,8 @@ end
if usemdsplus
% use mdsplus
mds_dir = '/home/amerle/codes/mds-ssh';
% mds_dir = '/home/amerle/public/mds-ssh';
mds_dir = '/home/amerle/public/mds-ssh3';
if exist(mds_dir,'dir') && ~strcmp(which('mdsipmex'),fullfile(mds_dir,'mdsipmex.mexa64'))
addpath(mds_dir);
end
......@@ -170,6 +171,9 @@ if usemdsplus
if ~unix('test -d /home/duval/mdsplus')
rmpath('/home/duval/mdsplus')
end
if exist(mds_dir,'dir') && ~strcmp(which('mdsipmex'),fullfile(mds_dir,'mdsipmex.mexa64'))
rmpath(mds_dir);
end
else
% use RDA
......
......@@ -342,18 +342,18 @@ if do_mdsopen_mdsclose
%%% if liuqe_version_eff==-1
if ~iscell(mapping_for_tcv.expression) && any(strfind(mapping_for_tcv.expression,'\rtc::'))
mdsdisconnect;
ishot = mdsopen('rtc',shot); % sub-tree
[ishot,shot_stat] = mdsopen('rtc',shot); % sub-tree
if any(strfind(data_request_eff,'\rtc::'))
data_request_eff = data_request_eff(7:end);
end
mapping_for_tcv.expression = mapping_for_tcv.expression(7:end);
elseif shot==-1 || liuqe_version_eff==-1
ishot = mdsopen('pcs', shot);
[ishot,shot_stat] = mdsopen('pcs', shot);
else
ishot = mdsopen(shot); % if ishot equal to shot, then mdsclose at the end
[ishot,shot_stat] = mdsopen(shot); % if ishot equal to shot, then mdsclose at the end
end
if isempty(ishot) || ishot~=shot
if gdat_params.nverbose>=1; warning(['cannot open shot= ' num2str(shot)]); end
if mod(shot_stat,2)==0
if gdat_params.nverbose>=1; warning('error opening shot %d. Value returned:%d',shot,ishot); end
return
end
end
......@@ -2501,7 +2501,7 @@ elseif strcmp(mapping_for_tcv.method,'switchcase')
if isempty(model_data.dim)
fprintf('And it was NOT requested \n');
else
fprintf('And it was requested. Check if plasma was a blip or if NB1 did not work \n');
fprintf('And it was requested. Check if plasma was a blip or if NB1 did not work \n');
end
end
end
......@@ -2532,7 +2532,7 @@ elseif strcmp(mapping_for_tcv.method,'switchcase')
end
%
if any(strmatch('nbi2',gdat_data.gdat_params.source))
% NB2
% NB2
nodenameeff = '\results::NB2:POWR_TCV';
nb2_data_tdi = tdi(nodenameeff);
if ~isempty(nb2_data_tdi.dim) && ~ischar(nb2_data_tdi.data) && ~isempty(nb2_data_tdi.dim)
......@@ -2565,15 +2565,15 @@ elseif strcmp(mapping_for_tcv.method,'switchcase')
if isempty(model_data.dim)
fprintf('And it was NOT requested \n');
else
fprintf('And it was requested. Check if plasma was a blip or if NB1 did not work \n');
fprintf('And it was requested. Check if plasma was a blip or if NB1 did not work \n');
end
end
end
end
end
if any(strmatch('dnbi',gdat_data.gdat_params.source))
% NB2
nodenameeff = '\RESULTS::DNBI:POWR_TCV';
% NB2
nodenameeff = '\RESULTS::DNBI:POWR_TCV';
nb2_data_tdi = tdi(nodenameeff);
if ~isempty(nb2_data_tdi.data) && ~ischar(nb2_data_tdi.data) && ~isempty(nb2_data_tdi.dim)
nbi_neutral_power_tot = nb2_data_tdi.data.*1e6; % in W
......
......@@ -107,6 +107,7 @@ global_quantities_desc.volume = params_eff.data_request;
params_eff.data_request = 'w_mhd';
global_quantities.w_mhd = gdat(params_equilibrium.shot,params_eff);
global_quantities_desc.w_mhd = params_eff.data_request;
ids_equilibrium_description.global_quantities = global_quantities_desc;
global_quantities_fieldnames = fieldnames(global_quantities);
special_fields = {'magnetic_axis', 'psi_axis', 'q_min'}; % fields needing non-automatic treatments
......@@ -214,9 +215,10 @@ for it=1:ntime
ids_equilibrium.time_slice{it}.boundary.x_point = {};
end
end
ids_equilibrium_description.boundary = boundary_desc;
ids_equilibrium_description.boundary_temp = temp_desc;
%% constraints
% TODO: Add description
% Measured values
liuqe_time = ids_equilibrium.time; % Not necessarily magnetics time so far
......@@ -224,9 +226,15 @@ mag_time = mdsvalue('\magnetics::bpol_003:dim0');
itime = iround_os(mag_time, liuqe_time);
mag_time_req = mdscvt(mag_time(itime),'f');
bpol = mdsvalue('\magnetics::bpol_003[$1,*]',mag_time_req);
nbpol = size(bpol,2);
constraints_desc.bpol_probe.measured = sprintf('from %s i=1:%d','\magnetics::bpol_003[i,*]',nbpol);
flux = mdsvalue('tcv_idealloop("flux")[$1,*]',mag_time_req);
diam = mdsvalue('\results::dmlcor[$1]',mag_time_req);
nflux = size(flux,2);
constraints_desc.flux_loop.measured = sprintf('from %s i=1:%d','tcv_idealloop("flux")[i,*]',nflux);
ip = mdsvalue('\magnetics::iplasma:trapeze[$1]',mag_time_req);
constraints_desc.ip.measured = sprintf('from %s','\magnetics::iplasma:trapeze');
diam = mdsvalue('\results::dmlcor[$1]',mag_time_req);
constraints_desc.diamagnetic_flux.measured = sprintf('from %s','\results::dmlcor');
% Coil currents since dim of constraints pf_current is IDS:pf_active/coil
dim_pol = {'OH_001','OH_002','OH_002','OH_002','OH_002','OH_002','OH_002',...
'E_001','E_002','E_003','E_004','E_005','E_006','E_007','E_008',...
......@@ -236,26 +244,38 @@ ipol = mdsvalue('\magnetics::ipol[$1,$2]',mag_time_req,dim_pol);
ipol(:,27:29) = -ipol(:,27:29); % Bottom G-coils
dim_pol(30:32) = {'TOR_001'};
ipol(:,30:32) = 0; % TOR_001 is not used in LIUQE
nipol = size(ipol,2);
constraints_desc.pf_current.measured = sprintf('from %s, ii from %s','\magnetics::ipol[t,ii]',cell2str(dim_pol,15));
% Reconstructed values
ipol_liuqe_order = [18,19*ones(1,6),1:16,17*ones(1,6)]; % LIUQE order is E F G OH
bpol_liuqe = mdsvalue('tcv_eq("b_probe","liuqe.m")');
constraints_desc.bpol_probe.reconstructed = sprintf('%s','tcv_eq("b_probe","liuqe.m")');
flux_liuqe = mdsvalue('tcv_eq("psi_loop","liuqe.m")');
diam_liuqe = mdsvalue('tcv_eq("tor_flux_dml","liuqe.m")');
constraints_desc.flux_liuqe.reconstructed = sprintf('%s','tcv_eq("psi_loop","liuqe.m")');
ip_liuqe = mdsvalue('tcv_eq("i_pl","liuqe.m")');
constraints_desc.ip.reconstructed = sprintf('%s','tcv_eq("i_pl","liuqe.m")');
diam_liuqe = mdsvalue('tcv_eq("tor_flux_dml","liuqe.m")');
constraints_desc.diamagnetic_flux.reconstructed = sprintf('%s','tcv_eq("tor_flux_dml","liuqe.m")');
ipol_liuqe = mdsvalue('tcv_eq("i_pol","liuqe.m")');
ipol_liuqe = ipol_liuqe(ipol_liuqe_order,:);
ipol_liuqe(27:29,:) = -ipol_liuqe(27:29,:); % Bottom G-coils
ipol_liuqe(30:32,:) = 0; % ... TOR
constraints_desc.ipol_liuqe.reconstructed = sprintf('%s','tcv_eq("i_pol","liuqe.m")');
% Weights (using old parameters tree for now)
bpol_err = mdsvalue('\results::parameters:berr')./mdsvalue('\results::parameters:vvv[0:37]');
constraints_desc.bpol_probe.weight = sprintf('(%s/%s)^2','\results::parameters:vvv[0:37]','\results::parameters:berr');
flux_err = mdsvalue('\results::parameters:ferr')./mdsvalue('\results::parameters:www[0:37]')*2*pi;
diam_err = 0.13e-3./mdsvalue('\results::parameters:idml');
constraints_desc.flux_loop.weight = sprintf('(%s/%s)^2','\results::parameters:www[0:37]','\results::parameters:ferr');
ip_err = mdsvalue('\results::parameters:plcerr')*1e3;
constraints_desc.ip.weight = sprintf('(1e-3/%s)^2','\results::parameters:plcerr');
diam_err = 0.13e-3./mdsvalue('\results::parameters:idml');
constraints_desc.diamagnetic_flux.weight = sprintf('(%s/0.13e-3)^2','\results::parameters:idml');
ipol_err = mdsvalue('\results::parameters:cerr')./mdsvalue('\results::parameters:uuu[0:18]')*1e3;
ipol_err = ipol_err(ipol_liuqe_order);
ipol_err(30:32) = NaN;
constraints_desc.pf_current.weight = sprintf('(1e-3*%s/%s)^2','\results::parameters:uuu[0:18]','\results::parameters:cerr');
if ntime > 0
constraints_orig = ids_equilibrium.time_slice{1}.constraints;
......@@ -263,15 +283,15 @@ if ntime > 0
ununsed_constraints = {'faraday_angle','mse_polarisation_angle','iron_core_segment',...
'n_e','n_e_line','pressure','q','x_point'};
for name = ununsed_constraints, constraints_orig.(name{1})={}; end
constraints_desc.ununsed_constraints = ununsed_constraints;
end
for it = 1:ntime
constraints = constraints_orig;
% bpol_probe
nbpol = size(bpol,2);
bpol_probe(1:nbpol) = constraints.bpol_probe(1);
for ib = 1:nbpol
bpol_probe{ib}.measured = bpol(it,ib);
bpol_probe{ib}.source = sprintf('IDS:magnetics/bpol_probe[%02d]/field',ib);
bpol_probe{ib}.source = sprintf('IDS:equilibrium/../constraints/bpol_probe[%02d]',ib);
bpol_probe{ib}.time_measurement = mag_time(itime(it));
bpol_probe{ib}.exact = 0;
bpol_probe{ib}.weight = 1/(bpol_err(ib)).^2;
......@@ -279,11 +299,10 @@ for it = 1:ntime
end
constraints.bpol_probe = bpol_probe;
% flux_loop
nflux = size(flux,2);
flux_loop(1:nflux) = constraints.flux_loop(1);
for il = 1:nflux
flux_loop{il}.measured = flux(it,il);
flux_loop{il}.source = sprintf('IDS:magnetics/flux_loop[%02d]/flux',il);
flux_loop{il}.source = sprintf('IDS:equilibrium/../constraints/flux_loop[%02d]',il);
flux_loop{il}.time_measurement = mag_time(itime(it));
flux_loop{il}.exact = 0;
flux_loop{il}.weight = 1/(flux_err(il)).^2;
......@@ -292,24 +311,23 @@ for it = 1:ntime
constraints.flux_loop = flux_loop;
% ip
constraints.ip.measured = ip(it);
constraints.ip.source = 'IDS:magnetics/method[1]/ip';
constraints.ip.source = 'IDS:equilibrium/../constraints/ip';
constraints.ip.time_measurement = mag_time(itime(it));
constraints.ip.exact = 0;
constraints.ip.weight = 1/(ip_err).^2;
constraints.ip.reconstructed = ip_liuqe(it);
% diamagnetic_flux
constraints.diamagnetic_flux.measured = diam(it);
constraints.diamagnetic_flux.source = 'IDS:magnetics/method[1]/diamagnetic_flux';
constraints.diamagnetic_flux.source = 'IDS:equilibrium/../constraints/diamagnetic_flux';
constraints.diamagnetic_flux.time_measurement = mag_time(itime(it));
constraints.diamagnetic_flux.exact = 0;
constraints.diamagnetic_flux.weight = 1/(diam_err).^2;
constraints.diamagnetic_flux.reconstructed = diam_liuqe(it);
% pf_current
nipol = size(ipol,2);
pf_current(1:nipol) = constraints.pf_current(1);
for ic = 1:nipol
pf_current{ic}.measured = ipol(it,ic);
pf_current{ic}.source = sprintf('IDS:pf_active/coil[%02d]/current',ic);
pf_current{ic}.source = sprintf('IDS:equilibrium/../constraints/pf_current[%02d]',ic);
pf_current{ic}.time_measurement = mag_time(itime(it));
if strcmp(dim_pol{ic},'TOR_001')
pf_current{ic}.source = [pf_current{ic}.source,' replaced with 0'];
......@@ -321,10 +339,11 @@ for it = 1:ntime
end
end
constraints.pf_current = pf_current;
ids_equilibrium.time_slice{it}.constraints = constraints;
end
ids_equilibrium_description.constraints = constraints_desc;
%
%% profiles_1d (cannot use eqdsk since not same radial mesh)
......@@ -465,6 +484,8 @@ for it=1:ntime
end
end
ids_equilibrium_description.profiles_1d = profiles_1d_desc;
% special cases
for it=1:ntime
ids_equilibrium.time_slice{it}.global_quantities.magnetic_axis.b_field_tor = ids_equilibrium.time_slice{it}.profiles_1d.f(1) ...
......@@ -496,9 +517,13 @@ profiles_2d.grid_type.description = 'Cylindrical R,Z ala eqdsk';
params_eff.data_request = 'psi';
profiles_2d.psi = gdat(params_equilibrium.shot,params_eff); % add psi_bound in a second step in special cases
profiles_2d_desc.psi = [params_eff.data_request ' adding psi_bound in a 2nd step'];
% r = gdat(params_equilibrium.shot,'r','machine',gdat_params.machine); % not to be filled since in grid.dim1
%profiles_2d.r = profiles_2d.psi;
profiles_2d.r.data = repmat(repmat(profiles_2d.psi.dim{1},1,numel(profiles_2d.psi.dim{2})),1,1,numel(profiles_2d.psi.dim{3}));
profiles_2d_desc.r = 'from dim{1} of ''psi'' repeated';
profiles_2d.z.data = repmat(repmat(profiles_2d.psi.dim{2}',numel(profiles_2d.psi.dim{1}),1),1,1,numel(profiles_2d.psi.dim{3}));
profiles_2d_desc.z = 'from dim{2} of ''psi'' repeated';
% theta = gdat(params_equilibrium.shot,'theta','machine',gdat_params.machine);
% z = gdat(params_equilibrium.shot,'z','machine',gdat_params.machine); % not to be filled since in grid.dim2
profiles_2d_fieldnames = fieldnames(profiles_2d);
special_fields = {'grid', 'grid_type'}; % fields needing non-automatic treatments
......@@ -529,6 +554,8 @@ for it=1:ntime
global_quantities.psi_boundary.data(it);
end
ids_equilibrium_description.profiles_2d = profiles_2d_desc;
% make arrays not filled in empty:
ids_equilibrium.grids_ggd = {};
for it=1:numel(ids_equilibrium.time_slice)
......
......@@ -37,6 +37,7 @@ elseif isfield(gdat_data,'gdat_params') && isfield(gdat_data.gdat_params,'doplot
end
end
if doplot==0; return; end
redo_legend_from_Tags = 0;
if all(isfield(gdat_data,{'data','t'})) && ~isempty(gdat_data.data) && ~isempty(gdat_data.t)
fighandle = get(0,'CurrentFigure');
......@@ -106,25 +107,54 @@ if all(isfield(gdat_data,{'data','t'})) && ~isempty(gdat_data.data) && ~isempty(
else
hylabel=ylabel(ylabel_eff,'interpreter','none');
end
if iscell(gdat_data.label) && length(gdat_data.label)>=2;
ab=get(gca,'children');
ab=get(gca,'children');
if iscell(gdat_data.label) && numel(gdat_data.label) > 1;
if numel(ab)==numel(gdat_data.label) || mod(numel(ab),numel(gdat_data.label))==0
% Assumes a single shot with several lines and labels, if mod==0 then this is a new shot, only Tag present lines
for iab=1:numel(gdat_data.label)
set(ab(iab),'Tag',[num2str(gdat_data.shot) ' ' gdat_data.label{end-iab+1}]);
end
if numel(ab)>numel(gdat_data.label), redo_legend_from_Tags = 1; end
end
if iscell(gdat_data.label) && length(ab) < length(gdat_data.label)
if length(ab) == 1
% assume combine label is best
tempaaa = sprintf('%s/',gdat_data.label{:});
hhhleg=legend(tempaaa(1:end-1));
set(ab(1),'Tag',[num2str(gdat_data.shot) ' ' tempaaa(1:min(10,numel(tempaaa)-1))]);
else
% not sure why would get there
hhhleg=legend(gdat_data.label{1:length(ab)});
end
else
elseif numel(ab)==numel(gdat_data.label)
hhhleg=legend(gdat_data.label);
end
set(hhhleg,'Interpreter','none');
if exist('hhhleg','var'), set(hhhleg,'Interpreter','none'); end
else
% assume one line per call
if isempty(gdat_data.label)
set(ab(1),'Tag',[num2str(gdat_data.shot)]);
elseif ischar(gdat_data.label)
% assume one signal, take max 10 chars
set(ab(1),'Tag',[num2str(gdat_data.shot) ' ' gdat_data.label(1:min(10,numel(gdat_data.label)))]);
elseif iscell(gdat_data.label) && numel(gdat_data.label) == 1
if isempty(gdat_data.label{1})
set(ab(1),'Tag',[num2str(gdat_data.shot)]);
else
set(ab(1),'Tag',[num2str(gdat_data.shot) ' ' gdat_data.label{1}(1:min(10,numel(gdat_data.label{1})))]);
end
end
end
if redo_legend_from_Tags
for iab=1:numel(ab)
% Use Tag for DisplayName, when overlay plots of multiple data at this stage
set(ab(iab),'DisplayName',strrep(get(ab(iab),'Tag'),'_','\_'));
end
end
zoom on;
end
maxnblines = 1;
if strcmp(gdat_data.gdat_params.data_request,'powers') && length(ab)==length(gdat_data.label)
if redo_legend_from_Tags || any(strcmp(gdat_data.gdat_params.data_request,'powers')) || (numel(ab)==numel(gdat_data.label) && numel(ab)>1)
% keep legend from label
else
for i=1:numel(linehandles)
......