Newer
Older
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
function [ids_thomson_scattering,ids_thomson_scattering_description] = tcv_get_ids_thomson_scattering(shot, ids_thomson_scattering_empty, gdat_params,varargin)
%
% [ids_thomson_scattering] = tcv_get_ids_thomson_scattering(shot, ids_thomson_scattering_empty,varargin);
%
% Get the thomson scattering diagnostics data
%
% ids_thomson_scattering_empty should at least be the empty thomson_scattering ids structure in input
%
% gdat_params: gdat_data.gdat_params to get all params passed from original call, in particular error_bar options
%
error_bar = 'delta';
if exist('gdat_params','var') && isfield(gdat_params,'error_bar') && ~isempty(gdat_params.error_bar)
error_bar = gdat_params.error_bar;
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
params_eff = gdat_params;
params_eff.edge = 1;
params_eff.data_request = 'ne';
ne1 = gdat_tcv(shot,params_eff);
params_eff.data_request = 'te';
te1 = 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);
end
ids_thomson_scattering_description = struct();
status = ~ischar(ne0.data) & ~ischar(te0.data) & ~ischar(ne1.data) & ~ischar(te1.data);
if status
nchannel0 = size(ne0.data_raw,1);
nchannel1 = size(ne1.data_raw,1);
nchannel = nchannel0 + nchannel1;
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';
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
end
end
if (ids_thomson_scattering.ids_properties.homogeneous_time == 1)
ids_thomson_scattering.time = ne0.time(:);
ids_thomson_scattering_description.time = 'ne.t from gdat_tcv(shot,''ne'')';
end
end
% make arrays not filled in empty
% cocos automatic transform
if false && exist('ids_generic_cocos_nodes_transformation_symbolic','file') % Disabled until added to COCOStransform
[ids_thomson_scattering,~]=ids_generic_cocos_nodes_transformation_symbolic(ids_thomson_scattering,'thomson_scattering',gdat_params.cocos_in, ...
gdat_params.cocos_out,gdat_params.ipsign_out,gdat_params.b0sign_out,gdat_params.ipsign_in,gdat_params.b0sign_in, ...
gdat_params.error_bar,gdat_params.nverbose);
end