Newer
Older
<!DOCTYPE html
PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html><head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<!--
This HTML was auto-generated from MATLAB code.
To make changes, update the MATLAB code and republish this document.
--><title>gdat tutorial: some basic calls and functionalities</title><meta name="generator" content="MATLAB 8.3"><link rel="schema.DC" href="http://purl.org/dc/elements/1.1/"><meta name="DC.date" content="2015-10-14"><meta name="DC.source" content="gdat_tutorial.m"><style type="text/css">
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
html,body,div,span,applet,object,iframe,h1,h2,h3,h4,h5,h6,p,blockquote,pre,a,abbr,acronym,address,big,cite,code,del,dfn,em,font,img,ins,kbd,q,s,samp,small,strike,strong,sub,sup,tt,var,b,u,i,center,dl,dt,dd,ol,ul,li,fieldset,form,label,legend,table,caption,tbody,tfoot,thead,tr,th,td{margin:0;padding:0;border:0;outline:0;font-size:100%;vertical-align:baseline;background:transparent}body{line-height:1}ol,ul{list-style:none}blockquote,q{quotes:none}blockquote:before,blockquote:after,q:before,q:after{content:'';content:none}:focus{outine:0}ins{text-decoration:none}del{text-decoration:line-through}table{border-collapse:collapse;border-spacing:0}
html { min-height:100%; margin-bottom:1px; }
html body { height:100%; margin:0px; font-family:Arial, Helvetica, sans-serif; font-size:10px; color:#000; line-height:140%; background:#fff none; overflow-y:scroll; }
html body td { vertical-align:top; text-align:left; }
h1 { padding:0px; margin:0px 0px 25px; font-family:Arial, Helvetica, sans-serif; font-size:1.5em; color:#d55000; line-height:100%; font-weight:normal; }
h2 { padding:0px; margin:0px 0px 8px; font-family:Arial, Helvetica, sans-serif; font-size:1.2em; color:#000; font-weight:bold; line-height:140%; border-bottom:1px solid #d6d4d4; display:block; }
h3 { padding:0px; margin:0px 0px 5px; font-family:Arial, Helvetica, sans-serif; font-size:1.1em; color:#000; font-weight:bold; line-height:140%; }
a { color:#005fce; text-decoration:none; }
a:hover { color:#005fce; text-decoration:underline; }
a:visited { color:#004aa0; text-decoration:none; }
p { padding:0px; margin:0px 0px 20px; }
img { padding:0px; margin:0px 0px 20px; border:none; }
p img, pre img, tt img, li img, h1 img, h2 img { margin-bottom:0px; }
ul { padding:0px; margin:0px 0px 20px 23px; list-style:square; }
ul li { padding:0px; margin:0px 0px 7px 0px; }
ul li ul { padding:5px 0px 0px; margin:0px 0px 7px 23px; }
ul li ol li { list-style:decimal; }
ol { padding:0px; margin:0px 0px 20px 0px; list-style:decimal; }
ol li { padding:0px; margin:0px 0px 7px 23px; list-style-type:decimal; }
ol li ol { padding:5px 0px 0px; margin:0px 0px 7px 0px; }
ol li ol li { list-style-type:lower-alpha; }
ol li ul { padding-top:7px; }
ol li ul li { list-style:square; }
.content { font-size:1.2em; line-height:140%; padding: 20px; }
pre, code { font-size:12px; }
tt { font-size: 1.2em; }
pre { margin:0px 0px 20px; }
pre.codeinput { padding:10px; border:1px solid #d3d3d3; background:#f7f7f7; }
pre.codeoutput { padding:10px 11px; margin:0px 0px 20px; color:#4c4c4c; }
pre.error { color:red; }
@media print { pre.codeinput, pre.codeoutput { word-wrap:break-word; width:100%; } }
span.keyword { color:#0000FF }
span.comment { color:#228B22 }
span.string { color:#A020F0 }
span.untermstring { color:#B20000 }
span.syscmd { color:#B28C00 }
.footer { width:auto; padding:10px 0px; margin:25px 0px 0px; border-top:1px dotted #878787; font-size:0.8em; line-height:140%; font-style:italic; color:#878787; text-align:left; float:none; }
.footer p { margin:0px; }
.footer a { color:#878787; }
.footer a:hover { color:#878787; text-decoration:underline; }
.footer a:visited { color:#878787; }
table th { padding:7px 5px; text-align:left; vertical-align:middle; border: 1px solid #d6d4d4; font-weight:bold; }
table td { padding:7px 5px; text-align:left; vertical-align:top; border:1px solid #d6d4d4; }
</style></head><body><div class="content"><h1>gdat tutorial: some basic calls and functionalities</h1><!--introduction--><p>gdat calls in fact the main function MACHINE/gdat_machine.m within the gdat folder gdat can be call with one of the available "data_request" keyword or with a full trace_name</p><p>The basic call is: data_out_struct = gdat(shot,data_request,'option1',option1_val,...);</p><p>But sub-cases are also valid and explained below</p><!--/introduction--><h2>Contents</h2><div><ul><li><a href="#1">getting the list of available predefined data_request names</a></li><li><a href="#2">list of data_request names for a specific machine</a></li><li><a href="#3">a simple example: get plasma current</a></li><li><a href="#4">a 2D example with Te profiles</a></li><li><a href="#5">Explaination of main fields</a></li><li><a href="#6">Explanation of basic parameters fields of gdat_params</a></li></ul></div><h2>getting the list of available predefined data_request names<a name="1"></a></h2><pre class="codeinput">gdat_data = gdat;
<span class="comment">%</span>
<span class="comment">% This is the simplest call and returns 3 useful information:</span>
gdat_data.gdat_request <span class="comment">% contains the list of available data_request names</span>
gdat_data.gdat_params <span class="comment">% contains the list of basic parameters, including :</span>
gdat_data.gdat_params.machine <span class="comment">% the (default) machine name</span>
<span class="comment">%</span>
<span class="comment">% in addition</span>
gdat_data.gdat_call <span class="comment">% always contains the string so that the same gdat call can be performed (using eval(), see below)</span>
</pre><pre class="codeoutput">
ans =
'b0'
'betan'
'betap'
'cxrs'
'delta'
'delta_bottom'
'delta_top'
'ece'
'eqdsk'
'halpha'
'ioh'
'ip'
'kappa'
'mhd'
'ne'
'neint'
'nel'
'ne_rho'
'nete_rho'
'psi_axis'
'psi_edge'
'powers'
'q0'
'q95'
'qedge'
'rgeom'
'rhotor_edge'
'rhotor'
'rhovol'
'rmag'
'sxr'
'te'
'vloop'
'volume'
'volume_rho'
'zeff'
'zgeom'
'zmag'
ans =
data_request: ''
machine: 'tcv'
doplot: 0
nverbose: 1
help: [1x1 struct]
ans =
tcv
ans =
gdat; % nargout = 1
</pre><h2>list of data_request names for a specific machine<a name="2"></a></h2><pre class="codeinput">gdat_data = gdat(<span class="string">'machine'</span>,<span class="string">'aug'</span>);
gdat_data.gdat_request
</pre><pre class="codeoutput">
ans =
''
</pre><h2>a simple example: get plasma current<a name="3"></a></h2><pre class="codeinput">gdat_data = gdat(48836,<span class="string">'ip'</span>); <span class="comment">% shot number is for TCV (default machine if run at CRPP)</span>
gdat_data = gdat(48836,<span class="string">'ip'</span>,<span class="string">'doplot'</span>,1);
gdat_data = gdat(48836,<span class="string">'Ip'</span>);
<span class="comment">% Note that the return data_request name is 'ip', since lower case is used throughout</span>
gdat_data.gdat_request
</pre><pre class="codeoutput">
ans =
ip
</pre><img vspace="5" hspace="5" src="gdat_tutorial_01.png" alt=""> <h2>a 2D example with Te profiles<a name="4"></a></h2><pre class="codeinput">gdat_data = gdat(48836,<span class="string">'te'</span>); <span class="comment">% return thomson data, thus versus Z (vertical height) of local measurements</span>
gdat_data = gdat(48836,<span class="string">'te'</span>,<span class="string">'doplot'</span>,1); <span class="comment">% default plot is always versus time, using gdat_data.t</span>
<span class="comment">% for more specific plots, use gdat_plot(gdat_data,...) function</span>
</pre><img vspace="5" hspace="5" src="gdat_tutorial_02.png" alt=""> <h2>Explaination of main fields<a name="5"></a></h2><pre class="codeinput">gdat_data = gdat(48836,<span class="string">'te'</span>);
gdat_data
<span class="comment">% The following fields are always present:</span>
<span class="comment">% gdat_data.data % (as well as .units) providing the data</span>
<span class="comment">% gdat_data.dim % (as well as .dimunits) providing the coordinates</span>
<span class="comment">% gdat_data.t % corresponding to the time coordinate (copied from dim{timecoord})</span>
<span class="comment">% gdat_data.x % all coordinates but time (typically radial if 2D signal or channel number)</span>
<span class="comment">% gdat_data.shot</span>
<span class="comment">% gdat_data.gdat_request</span>
<span class="comment">% gdat_data.gdat_params</span>
<span class="comment">% gdat_data.data_fullpath % provides information on tracename origin within the database</span>
<span class="comment">% gdat_data.gdat_call % string corresponding to the current call to gdat</span>
<span class="comment">% Some extra fields might be present:</span>
<span class="comment">% gdat_data.label % usually present, used as label in plots</span>
<span class="comment">% gdat_data.error_bar % error_bars to be used in errorbar plot e.g: errorbar(gdat_data.x,gdat_data.data(:,20),gdat_data.error_bar(:,20),'*-')</span>
<span class="comment">% gdat_data.mapping_for_tcv % information used to fetch the data,</span>
<span class="comment">% contains information on the time index, useful for multi-D data</span>
<span class="comment">%</span>
</pre><pre class="codeoutput">
gdat_data =
data: [23x49 double]
units: 'eV'
dim: {2x1 cell}
dimunits: {2x1 cell}
t: [49x1 double]
x: [23x1 double]
shot: 48836
gdat_request: 'te'
gdat_params: [1x1 struct]
data_fullpath: '\results::thomson:te; error_bar'
request_description: 'Electron temperature'
label: 'Te'
mapping_for: [1x1 struct]
error_bar: [23x49 double]
gdat_call: 'gdat(48836,'te'); % nargout = 1'
</pre><h2>Explanation of basic parameters fields of gdat_params<a name="6"></a></h2><pre class="codeinput">gdat_data = gdat(48836,<span class="string">'te'</span>);
disp(<span class="string">' '</span>);disp(<span class="string">'after "te"'</span>);disp(<span class="string">' gdat_data.gdat_params:'</span>);disp(gdat_data.gdat_params) <span class="comment">% at this stage contains few elements, will depend on specific data_request</span>
<span class="comment">%</span>
<span class="comment">% gdat_params should contain all the information necessary to recall gdat</span>
<span class="comment">% and get the same information, except the shot number, thus</span>
<span class="comment">% gdat_data2 = gdat(48836,gdat_data.gdat_params);</span>
<span class="comment">% should return the same values. This allows to quickly load the similar data from different shot</span>
shotlist=[48836, 48837, 48839];
<span class="keyword">for</span> ishot=1:length(shotlist)
gdat_data_te{ishot} = gdat(shotlist(ishot),gdat_data.gdat_params);
<span class="keyword">end</span>
gdat_plot(gdat_data_te{3});
<span class="comment">%</span>
<span class="comment">% In some cases we can see the various options after a first call, where</span>
<span class="comment">% defaults are set:</span>
gdat_data = gdat(48836,<span class="string">'eqdsk'</span>);
disp(<span class="string">' '</span>);disp(<span class="string">'after "eqdsk"'</span>);disp(<span class="string">' gdat_data.gdat_params:'</span>);disp(gdat_data.gdat_params)
<span class="comment">% shows that 'time' should be given (can be an array) and 'zshift' (to shift vertically to zaxis=0 if 'zshift',1 is provided</span>
<span class="comment">% It also show you can give the cocos out you want, for example for CHEASE type coordinates you would do:</span>
<span class="comment">% gdat_data = gdat(48836,'eqdsk','cocos',2);</span>
<span class="comment">% (see O. Sauter and S. Y Medvedev, Tokamak Coordinate Conventions: COCOS , Comput. Phys. Commun. 184 (2013) 293 )</span>
<span class="comment">%</span>
<span class="comment">% gdat_params contains a sub-structure "help" which contains explanations</span>
<span class="comment">% for the respective optional parameter specified in the gdat_params structure</span>
<span class="comment">% In this case we have:</span>
disp(<span class="string">' '</span>);disp(<span class="string">'after "eqdsk"'</span>);disp(<span class="string">' gdat_data.gdat_params.help:'</span>);disp(gdat_data.gdat_params.help)
</pre><pre class="codeoutput">
after "te"
gdat_data.gdat_params:
data_request: 'te'
machine: 'tcv'
doplot: 0
nverbose: 1
help: [1x1 struct]
edge: 0
Wrote /tmp/sauter/EQDSK_48836t1.0000_COCOS17
Wrote /tmp/sauter/EQDSK_48836t1.0000_COCOS17_IpB0positive
after "eqdsk"
gdat_data.gdat_params:
data_request: 'eqdsk'
machine: 'tcv'
doplot: 0
liuqe: 1
nverbose: 1
help: [1x1 struct]
time: 1
zshift: 0
cocos: 17
after "eqdsk"
gdat_data.gdat_params.help:
data_request: 'automatically filled in by gdat, name of request used i...'
machine: 'machine name like 'TCV', 'AUG', case insensitive'
doplot: '0 (default), if 1 calls gdat_plot for a new figure, -1 ...'
liuqe: 'liuqe version 1 (default), 2, 3 for LIUQE1, 2, 3 resp. ...'
nverbose: '1 (default) displays warnings, 0: only errors, >=3: dis...'
time: 'time(s) value(s) if relevant, for example eqdsk is prov...'
zshift: 'vertical shift of equilibrium, either for eqdsk or for ...'
cocos: 'cocos value desired in output, uses eqdsk_cocos_transfo...'
</pre><p class="footer"><br><a href="http://www.mathworks.com/products/matlab/">Published with MATLAB® R2014a</a><br></p></div><!--
##### SOURCE BEGIN #####
%% gdat tutorial: some basic calls and functionalities
% gdat calls in fact the main function MACHINE/gdat_machine.m within the gdat folder
% gdat can be call with one of the available "data_request" keyword or with a full trace_name
%
% The basic call is:
% data_out_struct = gdat(shot,data_request,'option1',option1_val,...);
%
% But sub-cases are also valid and explained below
%
%% getting the list of available predefined data_request names
%
gdat_data = gdat;
%
% This is the simplest call and returns 3 useful information:
gdat_data.gdat_request % contains the list of available data_request names
gdat_data.gdat_params % contains the list of basic parameters, including :
gdat_data.gdat_params.machine % the (default) machine name
%
% in addition
gdat_data.gdat_call % always contains the string so that the same gdat call can be performed (using eval(), see below)
%% list of data_request names for a specific machine
gdat_data = gdat('machine','aug');
gdat_data.gdat_request
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
%% a simple example: get plasma current
gdat_data = gdat(48836,'ip'); % shot number is for TCV (default machine if run at CRPP)
gdat_data = gdat(48836,'ip','doplot',1);
gdat_data = gdat(48836,'Ip');
% Note that the return data_request name is 'ip', since lower case is used throughout
gdat_data.gdat_request
%% a 2D example with Te profiles
gdat_data = gdat(48836,'te'); % return thomson data, thus versus Z (vertical height) of local measurements
gdat_data = gdat(48836,'te','doplot',1); % default plot is always versus time, using gdat_data.t
% for more specific plots, use gdat_plot(gdat_data,...) function
%% Explaination of main fields
gdat_data = gdat(48836,'te');
gdat_data
% The following fields are always present:
% gdat_data.data % (as well as .units) providing the data
% gdat_data.dim % (as well as .dimunits) providing the coordinates
% gdat_data.t % corresponding to the time coordinate (copied from dim{timecoord})
% gdat_data.x % all coordinates but time (typically radial if 2D signal or channel number)
% gdat_data.shot
% gdat_data.gdat_request
% gdat_data.gdat_params
% gdat_data.data_fullpath % provides information on tracename origin within the database
% gdat_data.gdat_call % string corresponding to the current call to gdat
% Some extra fields might be present:
% gdat_data.label % usually present, used as label in plots
% gdat_data.error_bar % error_bars to be used in errorbar plot e.g: errorbar(gdat_data.x,gdat_data.data(:,20),gdat_data.error_bar(:,20),'*-')
% gdat_data.mapping_for_tcv % information used to fetch the data,
% contains information on the time index, useful for multi-D data
%
%% Explanation of basic parameters fields of gdat_params
gdat_data = gdat(48836,'te');
disp(' ');disp('after "te"');disp(' gdat_data.gdat_params:');disp(gdat_data.gdat_params) % at this stage contains few elements, will depend on specific data_request
%
% gdat_params should contain all the information necessary to recall gdat
% and get the same information, except the shot number, thus
% gdat_data2 = gdat(48836,gdat_data.gdat_params);
% should return the same values. This allows to quickly load the similar data from different shot
shotlist=[48836, 48837, 48839];
for ishot=1:length(shotlist)
gdat_data_te{ishot} = gdat(shotlist(ishot),gdat_data.gdat_params);
end
gdat_plot(gdat_data_te{3});
%
% In some cases we can see the various options after a first call, where
% defaults are set:
gdat_data = gdat(48836,'eqdsk');
disp(' ');disp('after "eqdsk"');disp(' gdat_data.gdat_params:');disp(gdat_data.gdat_params)
% shows that 'time' should be given (can be an array) and 'zshift' (to shift vertically to zaxis=0 if 'zshift',1 is provided
% It also show you can give the cocos out you want, for example for CHEASE type coordinates you would do:
% gdat_data = gdat(48836,'eqdsk','cocos',2);
% (see O. Sauter and S. Y Medvedev, Tokamak Coordinate Conventions: COCOS , Comput. Phys. Commun. 184 (2013) 293 )
% gdat_params contains a sub-structure "help" which contains explanations
% for the respective optional parameter specified in the gdat_params structure
% In this case we have:
disp(' ');disp('after "eqdsk"');disp(' gdat_data.gdat_params.help:');disp(gdat_data.gdat_params.help)
##### SOURCE END #####
--></body></html>