author | Nishanth <nishanth@fossee.in> |
Thu, 23 Sep 2010 11:54:36 +0530 | |
changeset 192 | 3a839dca2bdb |
parent 144 | 476ea1730aee |
child 199 | 680a0692529f |
permissions | -rw-r--r-- |
144
476ea1730aee
Added rst files for scripts.
Puneeth Chaganti <punchagan@gmail.com>
parents:
diff
changeset
|
1 |
======== |
476ea1730aee
Added rst files for scripts.
Puneeth Chaganti <punchagan@gmail.com>
parents:
diff
changeset
|
2 |
Script |
476ea1730aee
Added rst files for scripts.
Puneeth Chaganti <punchagan@gmail.com>
parents:
diff
changeset
|
3 |
======== |
476ea1730aee
Added rst files for scripts.
Puneeth Chaganti <punchagan@gmail.com>
parents:
diff
changeset
|
4 |
|
476ea1730aee
Added rst files for scripts.
Puneeth Chaganti <punchagan@gmail.com>
parents:
diff
changeset
|
5 |
Welcome to this tutorial on loading data from files. |
476ea1730aee
Added rst files for scripts.
Puneeth Chaganti <punchagan@gmail.com>
parents:
diff
changeset
|
6 |
|
476ea1730aee
Added rst files for scripts.
Puneeth Chaganti <punchagan@gmail.com>
parents:
diff
changeset
|
7 |
{{{ Screen shows welcome slide }}} |
476ea1730aee
Added rst files for scripts.
Puneeth Chaganti <punchagan@gmail.com>
parents:
diff
changeset
|
8 |
|
476ea1730aee
Added rst files for scripts.
Puneeth Chaganti <punchagan@gmail.com>
parents:
diff
changeset
|
9 |
Until now, all the plots we have made use analytic functions. We have |
476ea1730aee
Added rst files for scripts.
Puneeth Chaganti <punchagan@gmail.com>
parents:
diff
changeset
|
10 |
been using analytic functions to generate a sequence of points and |
476ea1730aee
Added rst files for scripts.
Puneeth Chaganti <punchagan@gmail.com>
parents:
diff
changeset
|
11 |
plotting them, against another sequence of points. But, this is not |
476ea1730aee
Added rst files for scripts.
Puneeth Chaganti <punchagan@gmail.com>
parents:
diff
changeset
|
12 |
what we do most often. We often require to plot points obtained from |
476ea1730aee
Added rst files for scripts.
Puneeth Chaganti <punchagan@gmail.com>
parents:
diff
changeset
|
13 |
experimental observations. |
476ea1730aee
Added rst files for scripts.
Puneeth Chaganti <punchagan@gmail.com>
parents:
diff
changeset
|
14 |
|
192
3a839dca2bdb
reviewed loading_data_from_files
Nishanth <nishanth@fossee.in>
parents:
144
diff
changeset
|
15 |
.. #[punch: the initial part of the paragraph may be removed, to make |
3a839dca2bdb
reviewed loading_data_from_files
Nishanth <nishanth@fossee.in>
parents:
144
diff
changeset
|
16 |
this a more generic LO?] |
3a839dca2bdb
reviewed loading_data_from_files
Nishanth <nishanth@fossee.in>
parents:
144
diff
changeset
|
17 |
|
3a839dca2bdb
reviewed loading_data_from_files
Nishanth <nishanth@fossee.in>
parents:
144
diff
changeset
|
18 |
.. #[Nishanth]: The paragraph can be removed. |
144
476ea1730aee
Added rst files for scripts.
Puneeth Chaganti <punchagan@gmail.com>
parents:
diff
changeset
|
19 |
|
476ea1730aee
Added rst files for scripts.
Puneeth Chaganti <punchagan@gmail.com>
parents:
diff
changeset
|
20 |
In this tutorial we shall learn to read data from files and save it |
476ea1730aee
Added rst files for scripts.
Puneeth Chaganti <punchagan@gmail.com>
parents:
diff
changeset
|
21 |
into sequences that can later be used to plot. |
476ea1730aee
Added rst files for scripts.
Puneeth Chaganti <punchagan@gmail.com>
parents:
diff
changeset
|
22 |
|
476ea1730aee
Added rst files for scripts.
Puneeth Chaganti <punchagan@gmail.com>
parents:
diff
changeset
|
23 |
{{{ Show the outline for this tutorial }}} |
476ea1730aee
Added rst files for scripts.
Puneeth Chaganti <punchagan@gmail.com>
parents:
diff
changeset
|
24 |
|
476ea1730aee
Added rst files for scripts.
Puneeth Chaganti <punchagan@gmail.com>
parents:
diff
changeset
|
25 |
We shall use the ``loadtxt`` command to load data from files. We will |
476ea1730aee
Added rst files for scripts.
Puneeth Chaganti <punchagan@gmail.com>
parents:
diff
changeset
|
26 |
be looking at how to get multiple columns of data into multiple |
476ea1730aee
Added rst files for scripts.
Puneeth Chaganti <punchagan@gmail.com>
parents:
diff
changeset
|
27 |
sequences. |
476ea1730aee
Added rst files for scripts.
Puneeth Chaganti <punchagan@gmail.com>
parents:
diff
changeset
|
28 |
|
192
3a839dca2bdb
reviewed loading_data_from_files
Nishanth <nishanth@fossee.in>
parents:
144
diff
changeset
|
29 |
.. #[Nishanth]: can be "How to read a file with multiple columns of |
3a839dca2bdb
reviewed loading_data_from_files
Nishanth <nishanth@fossee.in>
parents:
144
diff
changeset
|
30 |
data and load each column of data into a sequence." |
3a839dca2bdb
reviewed loading_data_from_files
Nishanth <nishanth@fossee.in>
parents:
144
diff
changeset
|
31 |
|
144
476ea1730aee
Added rst files for scripts.
Puneeth Chaganti <punchagan@gmail.com>
parents:
diff
changeset
|
32 |
{{{ switch back to the terminal }}} |
476ea1730aee
Added rst files for scripts.
Puneeth Chaganti <punchagan@gmail.com>
parents:
diff
changeset
|
33 |
|
476ea1730aee
Added rst files for scripts.
Puneeth Chaganti <punchagan@gmail.com>
parents:
diff
changeset
|
34 |
As usual, let us start IPython, using |
476ea1730aee
Added rst files for scripts.
Puneeth Chaganti <punchagan@gmail.com>
parents:
diff
changeset
|
35 |
:: |
476ea1730aee
Added rst files for scripts.
Puneeth Chaganti <punchagan@gmail.com>
parents:
diff
changeset
|
36 |
|
476ea1730aee
Added rst files for scripts.
Puneeth Chaganti <punchagan@gmail.com>
parents:
diff
changeset
|
37 |
ipython -pylab |
476ea1730aee
Added rst files for scripts.
Puneeth Chaganti <punchagan@gmail.com>
parents:
diff
changeset
|
38 |
|
476ea1730aee
Added rst files for scripts.
Puneeth Chaganti <punchagan@gmail.com>
parents:
diff
changeset
|
39 |
Now, Let us begin with reading the file primes.txt, which contains |
476ea1730aee
Added rst files for scripts.
Puneeth Chaganti <punchagan@gmail.com>
parents:
diff
changeset
|
40 |
just a list of primes listed in a column, using the loadtxt command. |
476ea1730aee
Added rst files for scripts.
Puneeth Chaganti <punchagan@gmail.com>
parents:
diff
changeset
|
41 |
The file, in our case, is present in ``/home/fossee/primes.txt``. |
476ea1730aee
Added rst files for scripts.
Puneeth Chaganti <punchagan@gmail.com>
parents:
diff
changeset
|
42 |
|
192
3a839dca2bdb
reviewed loading_data_from_files
Nishanth <nishanth@fossee.in>
parents:
144
diff
changeset
|
43 |
.. #[punch: do we need a slide for showing the path?] |
144
476ea1730aee
Added rst files for scripts.
Puneeth Chaganti <punchagan@gmail.com>
parents:
diff
changeset
|
44 |
|
476ea1730aee
Added rst files for scripts.
Puneeth Chaganti <punchagan@gmail.com>
parents:
diff
changeset
|
45 |
We use the ``cat`` command to see the contents of this file. |
476ea1730aee
Added rst files for scripts.
Puneeth Chaganti <punchagan@gmail.com>
parents:
diff
changeset
|
46 |
|
476ea1730aee
Added rst files for scripts.
Puneeth Chaganti <punchagan@gmail.com>
parents:
diff
changeset
|
47 |
#[punch: should we show the cat command here? seems like a good place |
476ea1730aee
Added rst files for scripts.
Puneeth Chaganti <punchagan@gmail.com>
parents:
diff
changeset
|
48 |
to do it] :: |
476ea1730aee
Added rst files for scripts.
Puneeth Chaganti <punchagan@gmail.com>
parents:
diff
changeset
|
49 |
|
476ea1730aee
Added rst files for scripts.
Puneeth Chaganti <punchagan@gmail.com>
parents:
diff
changeset
|
50 |
cat /home/fossee/primes.txt |
476ea1730aee
Added rst files for scripts.
Puneeth Chaganti <punchagan@gmail.com>
parents:
diff
changeset
|
51 |
|
192
3a839dca2bdb
reviewed loading_data_from_files
Nishanth <nishanth@fossee.in>
parents:
144
diff
changeset
|
52 |
.. #[Nishanth]: A problem for windows users. |
3a839dca2bdb
reviewed loading_data_from_files
Nishanth <nishanth@fossee.in>
parents:
144
diff
changeset
|
53 |
Should we simply open the file and show them the data |
3a839dca2bdb
reviewed loading_data_from_files
Nishanth <nishanth@fossee.in>
parents:
144
diff
changeset
|
54 |
so that we can be fine with GNU/Linux ;) and windows? |
3a839dca2bdb
reviewed loading_data_from_files
Nishanth <nishanth@fossee.in>
parents:
144
diff
changeset
|
55 |
|
144
476ea1730aee
Added rst files for scripts.
Puneeth Chaganti <punchagan@gmail.com>
parents:
diff
changeset
|
56 |
Now let us read this list into the variable ``primes``. |
476ea1730aee
Added rst files for scripts.
Puneeth Chaganti <punchagan@gmail.com>
parents:
diff
changeset
|
57 |
:: |
476ea1730aee
Added rst files for scripts.
Puneeth Chaganti <punchagan@gmail.com>
parents:
diff
changeset
|
58 |
|
476ea1730aee
Added rst files for scripts.
Puneeth Chaganti <punchagan@gmail.com>
parents:
diff
changeset
|
59 |
primes = loadtxt('/home/fossee/primes.txt') |
476ea1730aee
Added rst files for scripts.
Puneeth Chaganti <punchagan@gmail.com>
parents:
diff
changeset
|
60 |
|
476ea1730aee
Added rst files for scripts.
Puneeth Chaganti <punchagan@gmail.com>
parents:
diff
changeset
|
61 |
``primes`` is now a sequence of primes, that was listed in the file, |
476ea1730aee
Added rst files for scripts.
Puneeth Chaganti <punchagan@gmail.com>
parents:
diff
changeset
|
62 |
``primes.txt``. |
476ea1730aee
Added rst files for scripts.
Puneeth Chaganti <punchagan@gmail.com>
parents:
diff
changeset
|
63 |
|
476ea1730aee
Added rst files for scripts.
Puneeth Chaganti <punchagan@gmail.com>
parents:
diff
changeset
|
64 |
We now type, ``print primes`` to see the sequence printed. |
476ea1730aee
Added rst files for scripts.
Puneeth Chaganti <punchagan@gmail.com>
parents:
diff
changeset
|
65 |
|
476ea1730aee
Added rst files for scripts.
Puneeth Chaganti <punchagan@gmail.com>
parents:
diff
changeset
|
66 |
We observe that all of the numbers end with a period. This is so, |
476ea1730aee
Added rst files for scripts.
Puneeth Chaganti <punchagan@gmail.com>
parents:
diff
changeset
|
67 |
because these numbers are actually read as ``floats``. We shall learn |
476ea1730aee
Added rst files for scripts.
Puneeth Chaganti <punchagan@gmail.com>
parents:
diff
changeset
|
68 |
about them, later. |
476ea1730aee
Added rst files for scripts.
Puneeth Chaganti <punchagan@gmail.com>
parents:
diff
changeset
|
69 |
|
476ea1730aee
Added rst files for scripts.
Puneeth Chaganti <punchagan@gmail.com>
parents:
diff
changeset
|
70 |
Now, let us use the ``loadtxt`` command to read a file that contains |
476ea1730aee
Added rst files for scripts.
Puneeth Chaganti <punchagan@gmail.com>
parents:
diff
changeset
|
71 |
two columns of data, ``pendulum.txt``. This file contains the length |
476ea1730aee
Added rst files for scripts.
Puneeth Chaganti <punchagan@gmail.com>
parents:
diff
changeset
|
72 |
of the pendulum in the first column and the corresponding time period |
476ea1730aee
Added rst files for scripts.
Puneeth Chaganti <punchagan@gmail.com>
parents:
diff
changeset
|
73 |
in the second. |
476ea1730aee
Added rst files for scripts.
Puneeth Chaganti <punchagan@gmail.com>
parents:
diff
changeset
|
74 |
|
476ea1730aee
Added rst files for scripts.
Puneeth Chaganti <punchagan@gmail.com>
parents:
diff
changeset
|
75 |
%%1%% Pause the video here, and use the ``cat`` command to view the |
476ea1730aee
Added rst files for scripts.
Puneeth Chaganti <punchagan@gmail.com>
parents:
diff
changeset
|
76 |
contents of this file and then resume the video. |
476ea1730aee
Added rst files for scripts.
Puneeth Chaganti <punchagan@gmail.com>
parents:
diff
changeset
|
77 |
|
476ea1730aee
Added rst files for scripts.
Puneeth Chaganti <punchagan@gmail.com>
parents:
diff
changeset
|
78 |
This is how we look at the contents of the file, ``pendulum.txt`` |
476ea1730aee
Added rst files for scripts.
Puneeth Chaganti <punchagan@gmail.com>
parents:
diff
changeset
|
79 |
:: |
476ea1730aee
Added rst files for scripts.
Puneeth Chaganti <punchagan@gmail.com>
parents:
diff
changeset
|
80 |
|
476ea1730aee
Added rst files for scripts.
Puneeth Chaganti <punchagan@gmail.com>
parents:
diff
changeset
|
81 |
cat /home/fossee/pendulum.txt |
476ea1730aee
Added rst files for scripts.
Puneeth Chaganti <punchagan@gmail.com>
parents:
diff
changeset
|
82 |
|
192
3a839dca2bdb
reviewed loading_data_from_files
Nishanth <nishanth@fossee.in>
parents:
144
diff
changeset
|
83 |
.. #[Nishanth]: The first column is L values and second is T values |
3a839dca2bdb
reviewed loading_data_from_files
Nishanth <nishanth@fossee.in>
parents:
144
diff
changeset
|
84 |
from a simle pelculum experiment. |
3a839dca2bdb
reviewed loading_data_from_files
Nishanth <nishanth@fossee.in>
parents:
144
diff
changeset
|
85 |
Since you are using the variable names later in the |
3a839dca2bdb
reviewed loading_data_from_files
Nishanth <nishanth@fossee.in>
parents:
144
diff
changeset
|
86 |
script. |
3a839dca2bdb
reviewed loading_data_from_files
Nishanth <nishanth@fossee.in>
parents:
144
diff
changeset
|
87 |
Not necessary but can be included also. |
3a839dca2bdb
reviewed loading_data_from_files
Nishanth <nishanth@fossee.in>
parents:
144
diff
changeset
|
88 |
|
144
476ea1730aee
Added rst files for scripts.
Puneeth Chaganti <punchagan@gmail.com>
parents:
diff
changeset
|
89 |
Let us, now, read the data into the variable ``pend``. Again, it is |
476ea1730aee
Added rst files for scripts.
Puneeth Chaganti <punchagan@gmail.com>
parents:
diff
changeset
|
90 |
assumed that the file is in ``/home/fossee/`` |
476ea1730aee
Added rst files for scripts.
Puneeth Chaganti <punchagan@gmail.com>
parents:
diff
changeset
|
91 |
:: |
476ea1730aee
Added rst files for scripts.
Puneeth Chaganti <punchagan@gmail.com>
parents:
diff
changeset
|
92 |
|
476ea1730aee
Added rst files for scripts.
Puneeth Chaganti <punchagan@gmail.com>
parents:
diff
changeset
|
93 |
pend = loadtxt('/home/fossee/pendulum.txt') |
476ea1730aee
Added rst files for scripts.
Puneeth Chaganti <punchagan@gmail.com>
parents:
diff
changeset
|
94 |
|
476ea1730aee
Added rst files for scripts.
Puneeth Chaganti <punchagan@gmail.com>
parents:
diff
changeset
|
95 |
Let us now print the variable ``pend`` and see what's in it. |
476ea1730aee
Added rst files for scripts.
Puneeth Chaganti <punchagan@gmail.com>
parents:
diff
changeset
|
96 |
:: |
476ea1730aee
Added rst files for scripts.
Puneeth Chaganti <punchagan@gmail.com>
parents:
diff
changeset
|
97 |
|
476ea1730aee
Added rst files for scripts.
Puneeth Chaganti <punchagan@gmail.com>
parents:
diff
changeset
|
98 |
print pend |
476ea1730aee
Added rst files for scripts.
Puneeth Chaganti <punchagan@gmail.com>
parents:
diff
changeset
|
99 |
|
476ea1730aee
Added rst files for scripts.
Puneeth Chaganti <punchagan@gmail.com>
parents:
diff
changeset
|
100 |
Notice that ``pend`` is not a simple sequence like ``primes``. It has |
476ea1730aee
Added rst files for scripts.
Puneeth Chaganti <punchagan@gmail.com>
parents:
diff
changeset
|
101 |
two sequences, containing both the columns of the data file. Let us |
476ea1730aee
Added rst files for scripts.
Puneeth Chaganti <punchagan@gmail.com>
parents:
diff
changeset
|
102 |
use an additional argument of the ``loadtxt`` command, to read it into |
476ea1730aee
Added rst files for scripts.
Puneeth Chaganti <punchagan@gmail.com>
parents:
diff
changeset
|
103 |
two separate, simple sequences. |
476ea1730aee
Added rst files for scripts.
Puneeth Chaganti <punchagan@gmail.com>
parents:
diff
changeset
|
104 |
:: |
476ea1730aee
Added rst files for scripts.
Puneeth Chaganti <punchagan@gmail.com>
parents:
diff
changeset
|
105 |
|
476ea1730aee
Added rst files for scripts.
Puneeth Chaganti <punchagan@gmail.com>
parents:
diff
changeset
|
106 |
L, T = loadtxt('/home/fossee/pendulum.txt', unpack=True) |
476ea1730aee
Added rst files for scripts.
Puneeth Chaganti <punchagan@gmail.com>
parents:
diff
changeset
|
107 |
|
192
3a839dca2bdb
reviewed loading_data_from_files
Nishanth <nishanth@fossee.in>
parents:
144
diff
changeset
|
108 |
.. #[Nishanth]: It has a sequence of items in which each item contains |
3a839dca2bdb
reviewed loading_data_from_files
Nishanth <nishanth@fossee.in>
parents:
144
diff
changeset
|
109 |
two values. first is l and second is t |
3a839dca2bdb
reviewed loading_data_from_files
Nishanth <nishanth@fossee.in>
parents:
144
diff
changeset
|
110 |
|
144
476ea1730aee
Added rst files for scripts.
Puneeth Chaganti <punchagan@gmail.com>
parents:
diff
changeset
|
111 |
Let us now, print the variables L and T, to see what they contain. |
476ea1730aee
Added rst files for scripts.
Puneeth Chaganti <punchagan@gmail.com>
parents:
diff
changeset
|
112 |
:: |
476ea1730aee
Added rst files for scripts.
Puneeth Chaganti <punchagan@gmail.com>
parents:
diff
changeset
|
113 |
|
476ea1730aee
Added rst files for scripts.
Puneeth Chaganti <punchagan@gmail.com>
parents:
diff
changeset
|
114 |
print L |
476ea1730aee
Added rst files for scripts.
Puneeth Chaganti <punchagan@gmail.com>
parents:
diff
changeset
|
115 |
print T |
476ea1730aee
Added rst files for scripts.
Puneeth Chaganti <punchagan@gmail.com>
parents:
diff
changeset
|
116 |
|
192
3a839dca2bdb
reviewed loading_data_from_files
Nishanth <nishanth@fossee.in>
parents:
144
diff
changeset
|
117 |
.. #[Nishanth]: Stress on ``unpack=True`` ?? |
3a839dca2bdb
reviewed loading_data_from_files
Nishanth <nishanth@fossee.in>
parents:
144
diff
changeset
|
118 |
|
144
476ea1730aee
Added rst files for scripts.
Puneeth Chaganti <punchagan@gmail.com>
parents:
diff
changeset
|
119 |
Notice, that L and T now contain the first and second columns of data |
476ea1730aee
Added rst files for scripts.
Puneeth Chaganti <punchagan@gmail.com>
parents:
diff
changeset
|
120 |
from the data file, ``pendulum.txt``, and they are both simple |
476ea1730aee
Added rst files for scripts.
Puneeth Chaganti <punchagan@gmail.com>
parents:
diff
changeset
|
121 |
sequences. |
476ea1730aee
Added rst files for scripts.
Puneeth Chaganti <punchagan@gmail.com>
parents:
diff
changeset
|
122 |
|
476ea1730aee
Added rst files for scripts.
Puneeth Chaganti <punchagan@gmail.com>
parents:
diff
changeset
|
123 |
{{{ show the slide with loadtxt --- other features }}} |
476ea1730aee
Added rst files for scripts.
Puneeth Chaganti <punchagan@gmail.com>
parents:
diff
changeset
|
124 |
|
476ea1730aee
Added rst files for scripts.
Puneeth Chaganti <punchagan@gmail.com>
parents:
diff
changeset
|
125 |
In this tutorial, we have learnt the basic use of the ``loadtxt`` |
476ea1730aee
Added rst files for scripts.
Puneeth Chaganti <punchagan@gmail.com>
parents:
diff
changeset
|
126 |
command, which is capable of doing a lot more than we have used it for |
476ea1730aee
Added rst files for scripts.
Puneeth Chaganti <punchagan@gmail.com>
parents:
diff
changeset
|
127 |
until now, for example |
476ea1730aee
Added rst files for scripts.
Puneeth Chaganti <punchagan@gmail.com>
parents:
diff
changeset
|
128 |
|
476ea1730aee
Added rst files for scripts.
Puneeth Chaganti <punchagan@gmail.com>
parents:
diff
changeset
|
129 |
%%2%% Pause the video here, and read the file |
476ea1730aee
Added rst files for scripts.
Puneeth Chaganti <punchagan@gmail.com>
parents:
diff
changeset
|
130 |
``pendulum_semicolon.txt`` which contains the same data as |
476ea1730aee
Added rst files for scripts.
Puneeth Chaganti <punchagan@gmail.com>
parents:
diff
changeset
|
131 |
``pendulum.txt``, but the columns are separated by semi-colons instead |
476ea1730aee
Added rst files for scripts.
Puneeth Chaganti <punchagan@gmail.com>
parents:
diff
changeset
|
132 |
of spaces. Use the IPython help to see how to do this. Once you have |
476ea1730aee
Added rst files for scripts.
Puneeth Chaganti <punchagan@gmail.com>
parents:
diff
changeset
|
133 |
finished, resume the video to look at the solution. |
476ea1730aee
Added rst files for scripts.
Puneeth Chaganti <punchagan@gmail.com>
parents:
diff
changeset
|
134 |
|
476ea1730aee
Added rst files for scripts.
Puneeth Chaganti <punchagan@gmail.com>
parents:
diff
changeset
|
135 |
{{{ switch back to the terminal }}} |
476ea1730aee
Added rst files for scripts.
Puneeth Chaganti <punchagan@gmail.com>
parents:
diff
changeset
|
136 |
:: |
476ea1730aee
Added rst files for scripts.
Puneeth Chaganti <punchagan@gmail.com>
parents:
diff
changeset
|
137 |
|
192
3a839dca2bdb
reviewed loading_data_from_files
Nishanth <nishanth@fossee.in>
parents:
144
diff
changeset
|
138 |
L, T = loadtxt('/home/fossee/pendulum.txt', unpack=True, delimiter=';') |
144
476ea1730aee
Added rst files for scripts.
Puneeth Chaganti <punchagan@gmail.com>
parents:
diff
changeset
|
139 |
|
476ea1730aee
Added rst files for scripts.
Puneeth Chaganti <punchagan@gmail.com>
parents:
diff
changeset
|
140 |
print L |
476ea1730aee
Added rst files for scripts.
Puneeth Chaganti <punchagan@gmail.com>
parents:
diff
changeset
|
141 |
|
476ea1730aee
Added rst files for scripts.
Puneeth Chaganti <punchagan@gmail.com>
parents:
diff
changeset
|
142 |
print T |
476ea1730aee
Added rst files for scripts.
Puneeth Chaganti <punchagan@gmail.com>
parents:
diff
changeset
|
143 |
|
192
3a839dca2bdb
reviewed loading_data_from_files
Nishanth <nishanth@fossee.in>
parents:
144
diff
changeset
|
144 |
.. #[Nishanth]: L, T = loadtxt('/home/fossee/pendulum_semicolon.txt', ...) |
3a839dca2bdb
reviewed loading_data_from_files
Nishanth <nishanth@fossee.in>
parents:
144
diff
changeset
|
145 |
|
144
476ea1730aee
Added rst files for scripts.
Puneeth Chaganti <punchagan@gmail.com>
parents:
diff
changeset
|
146 |
This brings us to the end of this tutorial. |
476ea1730aee
Added rst files for scripts.
Puneeth Chaganti <punchagan@gmail.com>
parents:
diff
changeset
|
147 |
|
476ea1730aee
Added rst files for scripts.
Puneeth Chaganti <punchagan@gmail.com>
parents:
diff
changeset
|
148 |
{{{ show the summary slide }}} |
476ea1730aee
Added rst files for scripts.
Puneeth Chaganti <punchagan@gmail.com>
parents:
diff
changeset
|
149 |
|
476ea1730aee
Added rst files for scripts.
Puneeth Chaganti <punchagan@gmail.com>
parents:
diff
changeset
|
150 |
You should now be able to do the following, comfortably. |
476ea1730aee
Added rst files for scripts.
Puneeth Chaganti <punchagan@gmail.com>
parents:
diff
changeset
|
151 |
|
476ea1730aee
Added rst files for scripts.
Puneeth Chaganti <punchagan@gmail.com>
parents:
diff
changeset
|
152 |
+ Read data from files, containing a single column of data using the |
476ea1730aee
Added rst files for scripts.
Puneeth Chaganti <punchagan@gmail.com>
parents:
diff
changeset
|
153 |
``loadtxt`` command. |
476ea1730aee
Added rst files for scripts.
Puneeth Chaganti <punchagan@gmail.com>
parents:
diff
changeset
|
154 |
+ Read multiple columns of data, separated by spaces or other |
476ea1730aee
Added rst files for scripts.
Puneeth Chaganti <punchagan@gmail.com>
parents:
diff
changeset
|
155 |
delimiters. |
476ea1730aee
Added rst files for scripts.
Puneeth Chaganti <punchagan@gmail.com>
parents:
diff
changeset
|
156 |
|
476ea1730aee
Added rst files for scripts.
Puneeth Chaganti <punchagan@gmail.com>
parents:
diff
changeset
|
157 |
Thank you! |
476ea1730aee
Added rst files for scripts.
Puneeth Chaganti <punchagan@gmail.com>
parents:
diff
changeset
|
158 |
|
476ea1730aee
Added rst files for scripts.
Puneeth Chaganti <punchagan@gmail.com>
parents:
diff
changeset
|
159 |