Skip to content
Snippets Groups Projects
Commit 24f77900 authored by Antoine Merle's avatar Antoine Merle
Browse files

Use TS system specification in tcv_get_ids_thomson_scattering

parent 04439de4
No related branches found
No related tags found
1 merge request!62Feature/ts systems
Pipeline #41633 passed with stage
in 1 minute and 26 seconds
......@@ -16,94 +16,78 @@ end
if exist('gdat_params','var')
[ids_thomson_scattering, ~] = tcv_ids_headpart(shot, ids_thomson_scattering_empty,'thomson_scattering','homogeneous_time',0,'gdat_params',gdat_params,varargin{:});
% Main system
params_eff = gdat_params;
params_eff.edge = 0;
params_eff.data_request = 'ne';
ne0 = gdat_tcv(shot,params_eff);
params_eff.data_request = 'te';
te0 = gdat_tcv(shot,params_eff);
% Edge system
% All system
params_eff = gdat_params;
params_eff.edge = 1;
if ~isfield(gdat_params,'systems') || isempty(gdat_params,'systems')
params_eff.systems = 'all';
end
params_eff.data_request = 'ne';
ne1 = gdat_tcv(shot,params_eff);
ne = gdat_tcv(shot,params_eff);
params_eff.data_request = 'te';
te1 = gdat_tcv(shot,params_eff);
te = gdat_tcv(shot,params_eff);
else
[ids_thomson_scattering, ~] = tcv_ids_headpart(shot, ids_thomson_scattering_empty,'thomson_scattering','homogeneous_time',0,varargin{:});
% Main system
ne0 = gdat_tcv(shot, 'ne', 'edge',0);
te0 = gdat_tcv(shot, 'te', 'edge',0);
% Edge system
ne1 = gdat_tcv(shot, 'ne', 'edge',1);
te1 = gdat_tcv(shot, 'te', 'edge',1);
ne = gdat_tcv(shot, 'ne', 'systems','all');
te = gdat_tcv(shot, 'te', 'systems','all');
end
ids_thomson_scattering_description = struct();
status = ~ischar(ne0.data) & ~ischar(te0.data) & ~ischar(ne1.data) & ~ischar(te1.data);
status = ~ischar(ne.data) & ~ischar(te.data);
if status
nchannel0 = size(ne0.data_raw,1);
nchannel1 = size(ne1.data_raw,1);
nchannel = nchannel0 + nchannel1;
nchannel = size(ne.data_raw);
ids_thomson_scattering.channel(1:nchannel) = ids_thomson_scattering.channel(1);
for system = {'main','edge'}
switch system{1}
case 'main', nchannel = nchannel0; offset = 0; ne = ne0; te = te0; edge_str = ')';
case 'edge', nchannel = nchannel1; offset = nchannel0; ne = ne1; te = te1; edge_str = ',''edge'',1';
for ii = 1:nchannel
system = ne.system{ii};
ids_thomson_scattering.channel{ii}.name = sprintf('%03d/%s',ii,system);
ids_thomson_scattering_description.channel{ii}.name = sprintf('TS system %s, global index from order in \results::thomson tree',system);
ids_thomson_scattering.channel{ii}.identifier = sprintf('Z=%+5.3gm/%s',ne.x(ii),system);
ids_thomson_scattering_description.channel{ii}.identifier = 'Identifier from Vertical position';
ids_thomson_scattering.channel{ii}.position.r = 0.9;
ids_thomson_scattering_description.channel{ii}.position.r = 'Fixed R=0.9m';
ids_thomson_scattering.channel{ii}.position.z = ne.x(ii);
ids_thomson_scattering_description.channel{ii}.position.z = 'Vertical position ne.x from gdat_tcv(shot,''ne''''systems'',''all'')';
ids_thomson_scattering.channel{ii}.t_e.data = reshape(te.data(ii,:),[],1);
ids_thomson_scattering_description.channel{ii}.t_e.data = 'te.data from gdat_tcv(shot,''te''''systems'',''all'')';
if (ids_thomson_scattering.ids_properties.homogeneous_time == 0)
ids_thomson_scattering.channel{ii}.t_e.time = reshape(te.t,[],1);
ids_thomson_scattering_description.channel{ii}.t_e.time = 'te.t from gdat_tcv(shot,''te''''systems'',''all'')';
end
ids_thomson_scattering.channel{ii}.n_e.data = reshape(ne.data_raw(ii,:),[],1);
ids_thomson_scattering_description.channel{ii}.n_e.data = 'ne.data_raw from gdat_tcv(shot,''ne''''systems'',''all'')';
if (ids_thomson_scattering.ids_properties.homogeneous_time == 0)
ids_thomson_scattering.channel{ii}.n_e.time = reshape(ne.t,[],1);
ids_thomson_scattering_description.channel{ii}.n_e.time = 'ne.t from gdat_tcv(shot,''ne''''systems'',''all'')';
end
for ii = 1:nchannel
jj = ii+offset;
ids_thomson_scattering.channel{jj}.name = sprintf('%s %03d',system{1},ii);
ids_thomson_scattering_description.channel{jj}.name = sprintf('TS system %s, index from order in \results::thomson tree',system{1});
ids_thomson_scattering.channel{jj}.identifier = sprintf('Z=%+5.3gm',ne.x(ii));
ids_thomson_scattering_description.channel{jj}.identifier = 'Identifier from Vertical position';
ids_thomson_scattering.channel{jj}.position.r = 0.9;
ids_thomson_scattering_description.channel{jj}.position.r = 'Fixed R=0.9m';
ids_thomson_scattering.channel{jj}.position.z = ne.x(ii);
ids_thomson_scattering_description.channel{jj}.position.z = ['Vertical position ne.x from gdat_tcv(shot,''ne'',',edge_str,')'];
ids_thomson_scattering.channel{jj}.t_e.data = reshape(te.data(ii,:),[],1);
ids_thomson_scattering_description.channel{jj}.t_e.data = ['te.data from gdat_tcv(shot,''te'',',edge_str,')'];
if (ids_thomson_scattering.ids_properties.homogeneous_time == 0)
ids_thomson_scattering.channel{jj}.t_e.time = reshape(te.t,[],1);
ids_thomson_scattering_description.channel{jj}.t_e.time = ['te.t from gdat_tcv(shot,''te'',',edge_str,')'];
end
ids_thomson_scattering.channel{jj}.n_e.data = reshape(ne.data_raw(ii,:),[],1);
ids_thomson_scattering_description.channel{jj}.n_e.data = ['ne.data_raw from gdat_tcv(shot,''ne'',',edge_str,')'];
if (ids_thomson_scattering.ids_properties.homogeneous_time == 0)
ids_thomson_scattering.channel{jj}.n_e.time = reshape(ne.t,[],1);
ids_thomson_scattering_description.channel{jj}.n_e.time = ['ne.t from gdat_tcv(shot,''ne'',',edge_str,')'];
end
switch error_bar
case 'delta'
ids_thomson_scattering.channel{jj}.t_e.data_error_upper = reshape(abs(te.error_bar(ii,:)),[],1);
ids_thomson_scattering_description.channel{jj}.t_e.data_error_upper = ['abs(te.error_bar) from gdat_tcv(shot,''te'',',edge_str,') for case ',error_bar];
ids_thomson_scattering.channel{jj}.n_e.data_error_upper = reshape(abs(ne.error_bar(ii,:)),[],1);
ids_thomson_scattering_description.channel{jj}.n_e.data_error_upper = ['abs(ne.error_bar) from gdat_tcv(shot,''ne'',',edge_str,') for case ',error_bar];
case 'delta_with_lower'
ids_thomson_scattering.channel{jj}.t_e.data_error_upper = reshape(abs(te.error_bar(ii,:)),[],1);
ids_thomson_scattering_description.channel{jj}.t_e.data_error_upper = ['abs(te.error_bar) from gdat_tcv(shot,''te'',',edge_str,') for case ',error_bar];
ids_thomson_scattering.channel{jj}.t_e.data_error_lower = reshape(abs(te.error_bar(ii,:)),[],1);
ids_thomson_scattering_description.channel{jj}.t_e.data_error_lower = ['abs(te.error_bar) from gdat_tcv(shot,''te'',',edge_str,') for case ',error_bar];
ids_thomson_scattering.channel{jj}.n_e.data_error_upper = reshape(abs(ne.error_bar(ii,:)),[],1);
ids_thomson_scattering_description.channel{jj}.n_e.data_error_upper = ['abs(ne.error_bar) from gdat_tcv(shot,''ne'',',edge_str,') for case ',error_bar];
ids_thomson_scattering.channel{jj}.n_e.data_error_lower = reshape(abs(ne.error_bar(ii,:)),[],1);
ids_thomson_scattering_description.channel{jj}.n_e.data_error_lower = ['abs(ne.error_bar) from gdat_tcv(shot,''ne'',',edge_str,') for case ',error_bar];
case 'added'
ids_thomson_scattering.channel{jj}.t_e.data_error_upper = reshape(te.data(ii,:)+abs(te.error_bar(ii,:)),[],1);
ids_thomson_scattering_description.channel{jj}.t_e.data_error_upper = ['te.data+abs(te.error_bar) from gdat_tcv(shot,''te'',',edge_str,') for case ',error_bar];
ids_thomson_scattering.channel{jj}.t_e.data_error_lower = reshape(te.data(ii,:)-abs(te.error_bar(ii,:)),[],1);
ids_thomson_scattering_description.channel{jj}.t_e.data_error_lower = ['te.data-abs(te.error_bar) from gdat_tcv(shot,''te'',',edge_str,') for case ',error_bar];
ids_thomson_scattering.channel{jj}.n_e.data_error_upper = reshape(ne.data(ii,:)+abs(ne.error_bar(ii,:)),[],1);
ids_thomson_scattering_description.channel{jj}.n_e.data_error_upper = ['ne.data+abs(ne.error_bar) from gdat_tcv(shot,''ne'',',edge_str,') for case ',error_bar];
ids_thomson_scattering.channel{jj}.n_e.data_error_lower = reshape(ne.data(ii,:)-abs(ne.error_bar(ii,:)),[],1);
ids_thomson_scattering_description.channel{jj}.n_e.data_error_lower = ['ne.data-abs(ne.error_bar) from gdat_tcv(shot,''ne'',',edge_str,') for case ',error_bar];
end
switch error_bar
case 'delta'
ids_thomson_scattering.channel{ii}.t_e.data_error_upper = reshape(abs(te.error_bar(ii,:)),[],1);
ids_thomson_scattering_description.channel{ii}.t_e.data_error_upper = ['abs(te.error_bar) from gdat_tcv(shot,''te''''systems'',''all'') for case ',error_bar];
ids_thomson_scattering.channel{ii}.n_e.data_error_upper = reshape(abs(ne.error_bar(ii,:)),[],1);
ids_thomson_scattering_description.channel{ii}.n_e.data_error_upper = ['abs(ne.error_bar) from gdat_tcv(shot,''ne''''systems'',''all'') for case ',error_bar];
case 'delta_with_lower'
ids_thomson_scattering.channel{ii}.t_e.data_error_upper = reshape(abs(te.error_bar(ii,:)),[],1);
ids_thomson_scattering_description.channel{ii}.t_e.data_error_upper = ['abs(te.error_bar) from gdat_tcv(shot,''te''''systems'',''all'') for case ',error_bar];
ids_thomson_scattering.channel{ii}.t_e.data_error_lower = reshape(abs(te.error_bar(ii,:)),[],1);
ids_thomson_scattering_description.channel{ii}.t_e.data_error_lower = ['abs(te.error_bar) from gdat_tcv(shot,''te''''systems'',''all'') for case ',error_bar];
ids_thomson_scattering.channel{ii}.n_e.data_error_upper = reshape(abs(ne.error_bar(ii,:)),[],1);
ids_thomson_scattering_description.channel{ii}.n_e.data_error_upper = ['abs(ne.error_bar) from gdat_tcv(shot,''ne''''systems'',''all'') for case ',error_bar];
ids_thomson_scattering.channel{ii}.n_e.data_error_lower = reshape(abs(ne.error_bar(ii,:)),[],1);
ids_thomson_scattering_description.channel{ii}.n_e.data_error_lower = ['abs(ne.error_bar) from gdat_tcv(shot,''ne''''systems'',''all'') for case ',error_bar];
case 'added'
ids_thomson_scattering.channel{ii}.t_e.data_error_upper = reshape(te.data(ii,:)+abs(te.error_bar(ii,:)),[],1);
ids_thomson_scattering_description.channel{ii}.t_e.data_error_upper = ['te.data+abs(te.error_bar) from gdat_tcv(shot,''te''''systems'',''all'') for case ',error_bar];
ids_thomson_scattering.channel{ii}.t_e.data_error_lower = reshape(te.data(ii,:)-abs(te.error_bar(ii,:)),[],1);
ids_thomson_scattering_description.channel{ii}.t_e.data_error_lower = ['te.data-abs(te.error_bar) from gdat_tcv(shot,''te''''systems'',''all'') for case ',error_bar];
ids_thomson_scattering.channel{ii}.n_e.data_error_upper = reshape(ne.data(ii,:)+abs(ne.error_bar(ii,:)),[],1);
ids_thomson_scattering_description.channel{ii}.n_e.data_error_upper = ['ne.data+abs(ne.error_bar) from gdat_tcv(shot,''ne''''systems'',''all'') for case ',error_bar];
ids_thomson_scattering.channel{ii}.n_e.data_error_lower = reshape(ne.data(ii,:)-abs(ne.error_bar(ii,:)),[],1);
ids_thomson_scattering_description.channel{ii}.n_e.data_error_lower = ['ne.data-abs(ne.error_bar) from gdat_tcv(shot,''ne''''systems'',''all'') for case ',error_bar];
end
end
if (ids_thomson_scattering.ids_properties.homogeneous_time == 1)
ids_thomson_scattering.time = ne0.time(:);
ids_thomson_scattering.time = ne.time(:);
ids_thomson_scattering_description.time = 'ne.t from gdat_tcv(shot,''ne'')';
end
end
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment