diff options
Diffstat (limited to 'loading-data-from-files')
-rw-r--r-- | loading-data-from-files/pendulum.txt | 90 | ||||
-rw-r--r-- | loading-data-from-files/pendulum_semicolon.txt | 90 | ||||
-rw-r--r-- | loading-data-from-files/primes.txt | 25 | ||||
-rw-r--r-- | loading-data-from-files/script.rst | 66 |
4 files changed, 254 insertions, 17 deletions
diff --git a/loading-data-from-files/pendulum.txt b/loading-data-from-files/pendulum.txt new file mode 100644 index 0000000..7e07566 --- /dev/null +++ b/loading-data-from-files/pendulum.txt @@ -0,0 +1,90 @@ +1.0000e-01 6.9004e-01 +1.1000e-01 6.9497e-01 +1.2000e-01 7.4252e-01 +1.3000e-01 7.5360e-01 +1.4000e-01 8.3568e-01 +1.5000e-01 8.6789e-01 +1.6000e-01 8.4182e-01 +1.7000e-01 8.5379e-01 +1.8000e-01 8.5762e-01 +1.9000e-01 8.8390e-01 +2.0000e-01 8.9985e-01 +2.1000e-01 9.8436e-01 +2.2000e-01 1.0244e+00 +2.3000e-01 1.0572e+00 +2.4000e-01 9.9077e-01 +2.5000e-01 1.0058e+00 +2.6000e-01 1.0727e+00 +2.7000e-01 1.0943e+00 +2.8000e-01 1.1432e+00 +2.9000e-01 1.1045e+00 +3.0000e-01 1.1867e+00 +3.1000e-01 1.1385e+00 +3.2000e-01 1.2245e+00 +3.3000e-01 1.2406e+00 +3.4000e-01 1.2071e+00 +3.5000e-01 1.2658e+00 +3.6000e-01 1.2995e+00 +3.7000e-01 1.3142e+00 +3.8000e-01 1.2663e+00 +3.9000e-01 1.2578e+00 +4.0000e-01 1.2991e+00 +4.1000e-01 1.3058e+00 +4.2000e-01 1.3478e+00 +4.3000e-01 1.3506e+00 +4.4000e-01 1.4044e+00 +4.5000e-01 1.3948e+00 +4.6000e-01 1.3800e+00 +4.7000e-01 1.4480e+00 +4.8000e-01 1.4168e+00 +4.9000e-01 1.4719e+00 +5.0000e-01 1.4656e+00 +5.1000e-01 1.4399e+00 +5.2000e-01 1.5174e+00 +5.3000e-01 1.4988e+00 +5.4000e-01 1.4751e+00 +5.5000e-01 1.5326e+00 +5.6000e-01 1.5297e+00 +5.7000e-01 1.5372e+00 +5.8000e-01 1.6094e+00 +5.9000e-01 1.6352e+00 +6.0000e-01 1.5843e+00 +6.1000e-01 1.6643e+00 +6.2000e-01 1.5987e+00 +6.3000e-01 1.6585e+00 +6.4000e-01 1.6317e+00 +6.5000e-01 1.7074e+00 +6.6000e-01 1.6654e+00 +6.7000e-01 1.6551e+00 +6.8000e-01 1.6964e+00 +6.9000e-01 1.7143e+00 +7.0000e-01 1.7706e+00 +7.1000e-01 1.7622e+00 +7.2000e-01 1.7260e+00 +7.3000e-01 1.8089e+00 +7.4000e-01 1.7905e+00 +7.5000e-01 1.7428e+00 +7.6000e-01 1.8381e+00 +7.7000e-01 1.8182e+00 +7.8000e-01 1.7865e+00 +7.9000e-01 1.7995e+00 +8.0000e-01 1.8296e+00 +8.1000e-01 1.8625e+00 +8.2000e-01 1.8623e+00 +8.3000e-01 1.8383e+00 +8.4000e-01 1.8593e+00 +8.5000e-01 1.8944e+00 +8.6000e-01 1.9598e+00 +8.7000e-01 1.9000e+00 +8.8000e-01 1.9244e+00 +8.9000e-01 1.9397e+00 +9.0000e-01 1.9440e+00 +9.1000e-01 1.9718e+00 +9.2000e-01 1.9383e+00 +9.3000e-01 1.9555e+00 +9.4000e-01 2.0006e+00 +9.5000e-01 1.9841e+00 +9.6000e-01 2.0066e+00 +9.7000e-01 2.0493e+00 +9.8000e-01 2.0503e+00 +9.9000e-01 2.0214e+00 diff --git a/loading-data-from-files/pendulum_semicolon.txt b/loading-data-from-files/pendulum_semicolon.txt new file mode 100644 index 0000000..409867a --- /dev/null +++ b/loading-data-from-files/pendulum_semicolon.txt @@ -0,0 +1,90 @@ +1.0000e-01;6.9004e-01 +1.1000e-01;6.9497e-01 +1.2000e-01;7.4252e-01 +1.3000e-01;7.5360e-01 +1.4000e-01;8.3568e-01 +1.5000e-01;8.6789e-01 +1.6000e-01;8.4182e-01 +1.7000e-01;8.5379e-01 +1.8000e-01;8.5762e-01 +1.9000e-01;8.8390e-01 +2.0000e-01;8.9985e-01 +2.1000e-01;9.8436e-01 +2.2000e-01;1.0244e+00 +2.3000e-01;1.0572e+00 +2.4000e-01;9.9077e-01 +2.5000e-01;1.0058e+00 +2.6000e-01;1.0727e+00 +2.7000e-01;1.0943e+00 +2.8000e-01;1.1432e+00 +2.9000e-01;1.1045e+00 +3.0000e-01;1.1867e+00 +3.1000e-01;1.1385e+00 +3.2000e-01;1.2245e+00 +3.3000e-01;1.2406e+00 +3.4000e-01;1.2071e+00 +3.5000e-01;1.2658e+00 +3.6000e-01;1.2995e+00 +3.7000e-01;1.3142e+00 +3.8000e-01;1.2663e+00 +3.9000e-01;1.2578e+00 +4.0000e-01;1.2991e+00 +4.1000e-01;1.3058e+00 +4.2000e-01;1.3478e+00 +4.3000e-01;1.3506e+00 +4.4000e-01;1.4044e+00 +4.5000e-01;1.3948e+00 +4.6000e-01;1.3800e+00 +4.7000e-01;1.4480e+00 +4.8000e-01;1.4168e+00 +4.9000e-01;1.4719e+00 +5.0000e-01;1.4656e+00 +5.1000e-01;1.4399e+00 +5.2000e-01;1.5174e+00 +5.3000e-01;1.4988e+00 +5.4000e-01;1.4751e+00 +5.5000e-01;1.5326e+00 +5.6000e-01;1.5297e+00 +5.7000e-01;1.5372e+00 +5.8000e-01;1.6094e+00 +5.9000e-01;1.6352e+00 +6.0000e-01;1.5843e+00 +6.1000e-01;1.6643e+00 +6.2000e-01;1.5987e+00 +6.3000e-01;1.6585e+00 +6.4000e-01;1.6317e+00 +6.5000e-01;1.7074e+00 +6.6000e-01;1.6654e+00 +6.7000e-01;1.6551e+00 +6.8000e-01;1.6964e+00 +6.9000e-01;1.7143e+00 +7.0000e-01;1.7706e+00 +7.1000e-01;1.7622e+00 +7.2000e-01;1.7260e+00 +7.3000e-01;1.8089e+00 +7.4000e-01;1.7905e+00 +7.5000e-01;1.7428e+00 +7.6000e-01;1.8381e+00 +7.7000e-01;1.8182e+00 +7.8000e-01;1.7865e+00 +7.9000e-01;1.7995e+00 +8.0000e-01;1.8296e+00 +8.1000e-01;1.8625e+00 +8.2000e-01;1.8623e+00 +8.3000e-01;1.8383e+00 +8.4000e-01;1.8593e+00 +8.5000e-01;1.8944e+00 +8.6000e-01;1.9598e+00 +8.7000e-01;1.9000e+00 +8.8000e-01;1.9244e+00 +8.9000e-01;1.9397e+00 +9.0000e-01;1.9440e+00 +9.1000e-01;1.9718e+00 +9.2000e-01;1.9383e+00 +9.3000e-01;1.9555e+00 +9.4000e-01;2.0006e+00 +9.5000e-01;1.9841e+00 +9.6000e-01;2.0066e+00 +9.7000e-01;2.0493e+00 +9.8000e-01;2.0503e+00 +9.9000e-01;2.0214e+00 diff --git a/loading-data-from-files/primes.txt b/loading-data-from-files/primes.txt new file mode 100644 index 0000000..384d511 --- /dev/null +++ b/loading-data-from-files/primes.txt @@ -0,0 +1,25 @@ +2 +3 +5 +7 +11 +13 +17 +19 +23 +29 +31 +37 +41 +43 +47 +53 +59 +61 +67 +71 +73 +79 +83 +89 +97 diff --git a/loading-data-from-files/script.rst b/loading-data-from-files/script.rst index f67a8c3..ff4ce19 100644 --- a/loading-data-from-files/script.rst +++ b/loading-data-from-files/script.rst @@ -1,8 +1,30 @@ -======== - Script -======== +.. Objectives +.. ---------- -Welcome to this tutorial on loading data from files. +.. At the end of this tutorial, you will be able to + +.. + Read data from files, containing a single column of data using the +.. ``loadtxt`` command. +.. + Read multiple columns of data, separated by spaces or other +.. delimiters. + + +.. Prerequisites +.. ------------- + +.. 1. getting started with ``ipython`` + +.. Author : + Internal Reviewer : + External Reviewer : + Checklist OK? : <put date stamp here, if OK> [2010-10-05] + +Script +------ + +{{{ Show the slide containing title }}} + +Hello Friends. Welcome to this tutorial on loading data from files. {{{ Screen shows welcome slide }}} @@ -59,15 +81,19 @@ about them, later. Now, let us use the ``loadtxt`` command to read a file that contains two columns of data, ``pendulum.txt``. This file contains the length of the pendulum in the first column and the corresponding time period -in the second. +in the second. Note that ``loadtxt`` needs both the columns to have +equal number of rows. -%%1%% Pause the video here, and use the ``cat`` command to view the -contents of this file and then resume the video. +.. Following is an exercise that you must do. -This is how we look at the contents of the file, ``pendulum.txt`` -:: +.. %%1%% Use the ``cat`` command to view the contents of this file. + +.. Please, pause the video here. Do the exercise and then continue. + +.. This is how we look at the contents of the file, ``pendulum.txt`` +.. :: - cat /home/fossee/pendulum.txt +.. cat /home/fossee/pendulum.txt .. #[Nishanth]: The first column is L values and second is T values from a simle pelculum experiment. @@ -114,13 +140,14 @@ separate sequences instead of one complex sequence. In this tutorial, we have learnt the basic use of the ``loadtxt`` command, which is capable of doing a lot more than we have used it for -until now, for example +until now. Let us look at an example, but before that do this +exercise. -%%2%% Pause the video here, and read the file -``pendulum_semicolon.txt`` which contains the same data as -``pendulum.txt``, but the columns are separated by semi-colons instead -of spaces. Use the IPython help to see how to do this. Once you have -finished, resume the video to look at the solution. +%%1%% Read the file ``pendulum_semicolon.txt`` which contains the same +data as ``pendulum.txt``, but the columns are separated by semi-colons +instead of spaces. Use the IPython help to see how to do this. + +Please, pause the video here. Do the exercise and then continue. {{{ switch back to the terminal }}} :: @@ -142,5 +169,10 @@ You should now be able to do the following, comfortably. + Read multiple columns of data, separated by spaces or other delimiters. -Thank you! +{{{ Show the "sponsored by FOSSEE" slide }}} + +This tutorial was created as a part of FOSSEE project, NME ICT, MHRD India + +Hope you have enjoyed and found it useful. +Thank you! |