/Modules/Mechanical/WINDGAUGE01A/SW/Data_analyser.ipynb
1,7 → 1,7
{
"metadata": {
"name": "",
"signature": "sha256:c35f5f2963a30c62e2bc2437fc0d2422404aec0dbc3c5526df0be8cecdef27ee"
"signature": "sha256:2b27dc30afc5801b549b86c718ac60f04cf5f54a281bec76ad61772eab7fb3e7"
},
"nbformat": 3,
"nbformat_minor": 0,
19,7 → 19,7
"language": "python",
"metadata": {},
"outputs": [],
"prompt_number": 1
"prompt_number": 2
},
{
"cell_type": "code",
31,7 → 31,7
"language": "python",
"metadata": {},
"outputs": [],
"prompt_number": 2
"prompt_number": 3
},
{
"cell_type": "code",
50,7 → 50,7
]
}
],
"prompt_number": 24
"prompt_number": 4
},
{
"cell_type": "code",
63,7 → 63,7
"language": "python",
"metadata": {},
"outputs": [],
"prompt_number": 14
"prompt_number": 5
},
{
"cell_type": "code",
71,47 → 71,141
"input": [
"prev_val= dataset.value[0,2]\n",
"n = 0\n",
"angle = np.zeros_like(dataset.value)\n",
"angle = np.zeros((dataset.shape[0]))\n",
"for i in range(dataset.value.shape[0]):\n",
" if (dataset.value[i,2] - prev_val) > 300: \n",
" n += 1\n",
" if abs(dataset.value[i,2] - prev_val) > 300:\n",
" n -= 1\n",
" angle[i] = dataset.value[i,2] + n*360\n",
" prev_val = dataset.value[i,2]\n",
"# elif (dataset.value[i,2] - prev_val) < -300:\n",
"# n -= 1\n",
"# angle[i] = dataset.value[i,2] + n*360\n",
"# prev_val = dataset.value[i,2]\n",
" else:\n",
" angle[i] = dataset.value[i,2] + n*360\n",
" prev_val = dataset.value[i,2]"
],
"language": "python",
"metadata": {},
"outputs": [],
"prompt_number": 19
"prompt_number": 55
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"angle"
"fig, ax1 = plt.subplots()\n",
"\n",
" ax2 = ax1.twinx()\n",
" ax1.plot(x, y1, 'g-')\n",
" ax2.plot(x, y2, 'b-')\n",
"\n",
" ax1.set_xlabel('X data')\n",
" ax1.set_ylabel('Y1 data', color='g')\n",
" ax2.set_ylabel('Y2 data', color='b')\n",
"\n",
" ax1.plot(dataset.value[:,0], angle,'b',dataset.value[:,0], dataset.value[:,2],'r')\n",
" ax2.plot(dataset.value[1:,0], np.diff(angle, n=1, axis=0),'g')\n",
"\n",
"plt.show()"
],
"language": "python",
"metadata": {},
"outputs": [
{
"ename": "IndentationError",
"evalue": "unexpected indent (<ipython-input-68-85470c16d7f6>, line 3)",
"output_type": "pyerr",
"traceback": [
"\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"
]
}
],
"prompt_number": 68
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"angle.shape"
],
"language": "python",
"metadata": {},
"outputs": [
{
"metadata": {},
"output_type": "pyout",
"prompt_number": 20,
"prompt_number": 63,
"text": [
"array([[ 0., 0., 0.],\n",
" [ 0., 0., 0.],\n",
" [ 0., 0., 0.],\n",
" ..., \n",
" [ 0., 0., 0.],\n",
" [ 0., 0., 0.],\n",
" [ 0., 0., 0.]], dtype=float32)"
"(12120,)"
]
}
],
"prompt_number": 20
"prompt_number": 63
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"dataset.value[:,0].shape"
],
"language": "python",
"metadata": {},
"outputs": [
{
"metadata": {},
"output_type": "pyout",
"prompt_number": 57,
"text": [
"(12120,)"
]
}
],
"prompt_number": 57
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"dataset.value[:,0].shape"
],
"language": "python",
"metadata": {},
"outputs": [
{
"metadata": {},
"output_type": "pyout",
"prompt_number": 60,
"text": [
"(12120,)"
]
}
],
"prompt_number": 60
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"np.diff(angle, n=1, axis=0).shape"
],
"language": "python",
"metadata": {},
"outputs": [
{
"metadata": {},
"output_type": "pyout",
"prompt_number": 62,
"text": [
"(12119,)"
]
}
],
"prompt_number": 62
},
{
"cell_type": "code",
"collapsed": false,
"input": [],
"language": "python",
"metadata": {},