Commit ceadcebd authored by Olivier Sauter's avatar Olivier Sauter
Browse files

add gas to AUG, add Tags to gdat_plot

parent 47396e75
......@@ -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,86 @@ 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) && prod(isfinite(uvs_signals.(uvs_signals_source{i,1}).t)) && isvector(uvs_signals.(uvs_signals_source{i,1}).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 prod(isfinite(uvs_signals.(uvs_signals_source{i,1}).data)) && isvector(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) && prod(isfinite(uvd_signals.(uvd_signals_source{i,2}).t)) && isvector(uvd_signals.(uvd_signals_source{i,2}).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 prod(isfinite(uvd_signals.(uvd_signals_source{i,2}).data)) && isvector(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;
......
......@@ -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'), 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 any(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)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment