Rev Author Line No. Line
4413 kaklik 1 {
2 "metadata": {
3 "name": "",
4422 kaklik 4 "signature": "sha256:2b27dc30afc5801b549b86c718ac60f04cf5f54a281bec76ad61772eab7fb3e7"
4413 kaklik 5 },
6 "nbformat": 3,
7 "nbformat_minor": 0,
8 "worksheets": [
9 {
10 "cells": [
11 {
12 "cell_type": "code",
13 "collapsed": false,
14 "input": [
15 "import h5py\n",
16 "import numpy as np\n",
17 "import matplotlib.pyplot as plt"
18 ],
19 "language": "python",
20 "metadata": {},
21 "outputs": [],
4422 kaklik 22 "prompt_number": 2
4413 kaklik 23 },
24 {
25 "cell_type": "code",
26 "collapsed": false,
27 "input": [
28 "file = h5py.File('test_rps.hdf5', 'r') # 'r' means that hdf5 file is open in read-only mode\n",
29 "dataset = file['RPS01']"
30 ],
31 "language": "python",
32 "metadata": {},
33 "outputs": [],
4422 kaklik 34 "prompt_number": 3
4413 kaklik 35 },
36 {
37 "cell_type": "code",
38 "collapsed": false,
39 "input": [
4417 kaklik 40 "print dataset.value[4,2]"
4413 kaklik 41 ],
42 "language": "python",
43 "metadata": {},
44 "outputs": [
45 {
46 "output_type": "stream",
47 "stream": "stdout",
48 "text": [
4417 kaklik 49 "36.7822\n"
4413 kaklik 50 ]
51 }
52 ],
4422 kaklik 53 "prompt_number": 4
4413 kaklik 54 },
55 {
56 "cell_type": "code",
57 "collapsed": false,
58 "input": [
4417 kaklik 59 "plt.plot( dataset.value[:,0], dataset.value[:,2], color = 'r')\n",
60 "#plt.xlim([1.45415117E9,1.4541513E9])\n",
61 "plt.show()"
4413 kaklik 62 ],
63 "language": "python",
64 "metadata": {},
4417 kaklik 65 "outputs": [],
4422 kaklik 66 "prompt_number": 5
4417 kaklik 67 },
68 {
69 "cell_type": "code",
70 "collapsed": false,
71 "input": [
72 "prev_val= dataset.value[0,2]\n",
73 "n = 0\n",
4422 kaklik 74 "angle = np.zeros((dataset.shape[0]))\n",
4417 kaklik 75 "for i in range(dataset.value.shape[0]):\n",
4422 kaklik 76 " if abs(dataset.value[i,2] - prev_val) > 300:\n",
77 " n -= 1\n",
4417 kaklik 78 " angle[i] = dataset.value[i,2] + n*360\n",
4422 kaklik 79 " prev_val = dataset.value[i,2]\n",
80 "# elif (dataset.value[i,2] - prev_val) < -300:\n",
81 "# n -= 1\n",
82 "# angle[i] = dataset.value[i,2] + n*360\n",
83 "# prev_val = dataset.value[i,2]\n",
84 " else:\n",
85 " angle[i] = dataset.value[i,2] + n*360\n",
4417 kaklik 86 " prev_val = dataset.value[i,2]"
87 ],
88 "language": "python",
89 "metadata": {},
90 "outputs": [],
4422 kaklik 91 "prompt_number": 55
4417 kaklik 92 },
93 {
94 "cell_type": "code",
95 "collapsed": false,
96 "input": [
4422 kaklik 97 "fig, ax1 = plt.subplots()\n",
98 "\n",
99 " ax2 = ax1.twinx()\n",
100 " ax1.plot(x, y1, 'g-')\n",
101 " ax2.plot(x, y2, 'b-')\n",
102 "\n",
103 " ax1.set_xlabel('X data')\n",
104 " ax1.set_ylabel('Y1 data', color='g')\n",
105 " ax2.set_ylabel('Y2 data', color='b')\n",
106 "\n",
107 " ax1.plot(dataset.value[:,0], angle,'b',dataset.value[:,0], dataset.value[:,2],'r')\n",
108 " ax2.plot(dataset.value[1:,0], np.diff(angle, n=1, axis=0),'g')\n",
109 "\n",
110 "plt.show()"
4417 kaklik 111 ],
112 "language": "python",
113 "metadata": {},
4413 kaklik 114 "outputs": [
115 {
4422 kaklik 116 "ename": "IndentationError",
117 "evalue": "unexpected indent (<ipython-input-68-85470c16d7f6>, line 3)",
118 "output_type": "pyerr",
119 "traceback": [
120 "\u001b[0;36m File \u001b[0;32m\"<ipython-input-68-85470c16d7f6>\"\u001b[0;36m, line \u001b[0;32m3\u001b[0m\n\u001b[0;31m ax2 = ax1.twinx()\u001b[0m\n\u001b[0m ^\u001b[0m\n\u001b[0;31mIndentationError\u001b[0m\u001b[0;31m:\u001b[0m unexpected indent\n"
121 ]
122 }
123 ],
124 "prompt_number": 68
125 },
126 {
127 "cell_type": "code",
128 "collapsed": false,
129 "input": [
130 "angle.shape"
131 ],
132 "language": "python",
133 "metadata": {},
134 "outputs": [
135 {
4413 kaklik 136 "metadata": {},
137 "output_type": "pyout",
4422 kaklik 138 "prompt_number": 63,
4413 kaklik 139 "text": [
4422 kaklik 140 "(12120,)"
4413 kaklik 141 ]
142 }
143 ],
4422 kaklik 144 "prompt_number": 63
4413 kaklik 145 },
146 {
147 "cell_type": "code",
148 "collapsed": false,
4422 kaklik 149 "input": [
150 "dataset.value[:,0].shape"
151 ],
152 "language": "python",
153 "metadata": {},
154 "outputs": [
155 {
156 "metadata": {},
157 "output_type": "pyout",
158 "prompt_number": 57,
159 "text": [
160 "(12120,)"
161 ]
162 }
163 ],
164 "prompt_number": 57
165 },
166 {
167 "cell_type": "code",
168 "collapsed": false,
169 "input": [
170 "dataset.value[:,0].shape"
171 ],
172 "language": "python",
173 "metadata": {},
174 "outputs": [
175 {
176 "metadata": {},
177 "output_type": "pyout",
178 "prompt_number": 60,
179 "text": [
180 "(12120,)"
181 ]
182 }
183 ],
184 "prompt_number": 60
185 },
186 {
187 "cell_type": "code",
188 "collapsed": false,
189 "input": [
190 "np.diff(angle, n=1, axis=0).shape"
191 ],
192 "language": "python",
193 "metadata": {},
194 "outputs": [
195 {
196 "metadata": {},
197 "output_type": "pyout",
198 "prompt_number": 62,
199 "text": [
200 "(12119,)"
201 ]
202 }
203 ],
204 "prompt_number": 62
205 },
206 {
207 "cell_type": "code",
208 "collapsed": false,
4413 kaklik 209 "input": [],
210 "language": "python",
211 "metadata": {},
212 "outputs": []
213 }
214 ],
215 "metadata": {}
216 }
217 ]
218 }