comparison m-toolbox/html_help/help/ug/ltpda_training_topic_1_6.html @ 0:f0afece42f48

Import.
author Daniele Nicolodi <nicolodi@science.unitn.it>
date Wed, 23 Nov 2011 19:22:13 +0100
parents
children
comparison
equal deleted inserted replaced
-1:000000000000 0:f0afece42f48
1 <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
2 "http://www.w3.org/TR/1999/REC-html401-19991224/loose.dtd">
3
4 <html lang="en">
5 <head>
6 <meta name="generator" content=
7 "HTML Tidy for Mac OS X (vers 1st December 2004), see www.w3.org">
8 <meta http-equiv="Content-Type" content=
9 "text/html; charset=us-ascii">
10
11 <title>Constructing AOs from data files (LTPDA Toolbox)</title>
12 <link rel="stylesheet" href="docstyle.css" type="text/css">
13 <meta name="generator" content="DocBook XSL Stylesheets V1.52.2">
14 <meta name="description" content=
15 "Presents an overview of the features, system requirements, and starting the toolbox.">
16 </head>
17
18 <body>
19 <a name="top_of_page" id="top_of_page"></a>
20
21 <p style="font-size:1px;">&nbsp;</p>
22
23 <table class="nav" summary="Navigation aid" border="0" width=
24 "100%" cellpadding="0" cellspacing="0">
25 <tr>
26 <td valign="baseline"><b>LTPDA Toolbox</b></td><td><a href="../helptoc.html">contents</a></td>
27
28 <td valign="baseline" align="right"><a href=
29 "ltpda_training_topic_1_5.html"><img src="b_prev.gif" border="0" align=
30 "bottom" alt="Saving and loading AOs"></a>&nbsp;&nbsp;&nbsp;<a href=
31 "ltpda_training_topic_1_7.html"><img src="b_next.gif" border="0" align=
32 "bottom" alt="Writing LTPDA scripts"></a></td>
33 </tr>
34 </table>
35
36 <h1 class="title"><a name="f3-12899" id="f3-12899"></a>Constructing AOs from data files</h1>
37 <hr>
38
39 <p>
40 <p>
41 You can build AOs from existing ASCII data files. Various formats are supported,
42 for example, multiple columns, files containing comments.
43 </p>
44 <br>
45 <h2>Install the data pack</h2>
46 <br>
47 <p>
48 The data-pack for this training session should be downloaded from the <a href="http://www.lisa.aei-hannover.de/ltpda/training_sessions/training_session_1/training_session_1.html">LTPDA web-site</a>.
49 The zip file will expand to a top-level directory. This should contain sub-directories
50 for each topic of the training session.
51 </p>
52 <p>
53 The rest of the tutorial will assume that you have changed directories in MATLAB
54 to the data-pack directory so that filenames are relative to that directory. To
55 change the working directory of MATLAB, either use the MATLAB interface
56 or type
57 </p>
58 <div class="fragment"><pre>
59 cd /path/to/my/data/pack
60 </pre></div>
61 <br>
62 <h2>Create an AO from a simple ASCII file</h2>
63 <br>
64 <p>
65 The data-pack contains a simple two-column text file which represents a time-series
66 sampled at 10Hz. The first column contains the time-stamps, the second column the amplitude values.
67 </p>
68 <p>
69 To convert this data file to an AO, use the following command:
70 </p>
71 <div class="fragment"><pre>
72 >> pl = plist(<span class="string">'filename'</span>, <span class="string">'topic1/simpleASCII.txt'</span>, ...
73 <span class="string">'columns'</span>, [1 2], ...
74 <span class="string">'type'</span>, <span class="string">'tsdata'</span>);
75 >> a = ao(pl)
76 M: constructing from plist
77 M: load file: simpleASCII.txt
78 M: constructing from filename and/or plist
79 M: constructing from data object tsdata
80 ----------- ao 01: simpleASCII.txt_01_02 -----------
81
82 name: simpleASCII.txt_01_02
83 data: (0,1.13549060238654) (0.1,2.37202031808076) (0.2,-0.531181753855465) (0.3,1.25684477541224) (0.4,1.30895517480354) ...
84 -------- tsdata 01 ------------
85
86 fs: 10
87 x: [1000 1], double
88 y: [1000 1], double
89 dx: [0 0], double
90 dy: [0 0], double
91 xunits: []
92 yunits: []
93 nsecs: 100
94 t0: 1970-01-01 00:00:00.000
95 -------------------------------
96
97 hist: ao / ao / SId: fromDatafile.m,v 1.39 2011/04/18 16:55:26 ingo Exp S-->SId: ao.m,v 1.346 2011/05/07 06:56:17 mauro Exp S
98 description:
99 UUID: bde61c39-2c7e-4e77-9c15-6e6a4cc29e12
100 ----------------------------------------------------
101 </pre></div>
102 <p>
103 From the output on the screen you can see that
104 <ol>
105 <li>the name of the AO has automatically been set based on the filename and
106 the columns of data loaded</li>
107 <li>the sample rate of the data is 10Hz, as expected</li>
108 <li>the length of the data is 100s</li>
109 </ol>
110 </p>
111 <p>
112 You can plot this data and see that it is just a randon noise time-series.
113 </p>
114 <br>
115 <h2>Create an AO from a multi-column ASCII file</h2>
116 <br>
117 <p>
118 The data-pack contains a data file which contains multiple columns of data. Here
119 we will load only selected columns from the file and produce multiple AOs, one
120 for each column loaded. Column 1 of the file contains the time-stamps; columns
121 2-6 contain sine waves at frequencies 1-5Hz.
122 </p>
123 <p>
124 Let's load the 2Hz and 4Hz sine waves from the file. At the same time, we'll
125 give the AOs names, Y units, and descriptions.
126 </p>
127 <div class="fragment"><pre>
128 sigs = ao(plist(<span class="string">'filename'</span>, <span class="string">'topic1/multicolumnASCII.txt'</span>, ...
129 <span class="string">'type'</span>, <span class="string">'tsdata'</span>, ...
130 <span class="string">'columns'</span>, [1 3 1 5], ...
131 <span class="string">'name'</span>, {<span class="string">'sin2'</span>, <span class="string">'sin4'</span>}, ...
132 <span class="string">'yunits'</span>, {<span class="string">'m'</span>, <span class="string">'m'</span>}, ...
133 <span class="string">'description'</span>, {<span class="string">'sine wave at 2Hz'</span>, <span class="string">'sine wave at 4Hz'</span>}))
134 </pre></div>
135 <p>
136 You can plot the results and focus on the first 2 seconds of data
137 </p>
138 <div class="fragment"><pre>
139 sigs.iplot(plist(<span class="string">'XRanges'</span>, [0 2]))
140 </pre></div>
141
142
143
144
145
146
147
148 </p>
149
150 <br>
151 <br>
152 <table class="nav" summary="Navigation aid" border="0" width=
153 "100%" cellpadding="0" cellspacing="0">
154 <tr valign="top">
155 <td align="left" width="20"><a href="ltpda_training_topic_1_5.html"><img src=
156 "b_prev.gif" border="0" align="bottom" alt=
157 "Saving and loading AOs"></a>&nbsp;</td>
158
159 <td align="left">Saving and loading AOs</td>
160
161 <td>&nbsp;</td>
162
163 <td align="right">Writing LTPDA scripts</td>
164
165 <td align="right" width="20"><a href=
166 "ltpda_training_topic_1_7.html"><img src="b_next.gif" border="0" align=
167 "bottom" alt="Writing LTPDA scripts"></a></td>
168 </tr>
169 </table><br>
170
171 <p class="copy">&copy;LTP Team</p>
172 </body>
173 </html>