{
 "metadata": {
  "name": "",
  "signature": "sha256:c35f5f2963a30c62e2bc2437fc0d2422404aec0dbc3c5526df0be8cecdef27ee"
 },
 "nbformat": 3,
 "nbformat_minor": 0,
 "worksheets": [
  {
   "cells": [
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import h5py\n",
      "import numpy as np\n",
      "import matplotlib.pyplot as plt"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [],
     "prompt_number": 1
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "file    = h5py.File('test_rps.hdf5', 'r')   # 'r' means that hdf5 file is open in read-only mode\n",
      "dataset = file['RPS01']"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [],
     "prompt_number": 2
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "print dataset.value[4,2]"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "36.7822\n"
       ]
      }
     ],
     "prompt_number": 24
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "plt.plot( dataset.value[:,0], dataset.value[:,2], color = 'r')\n",
      "#plt.xlim([1.45415117E9,1.4541513E9])\n",
      "plt.show()"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [],
     "prompt_number": 14
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "prev_val= dataset.value[0,2]\n",
      "n = 0\n",
      "angle = np.zeros_like(dataset.value)\n",
      "for i in range(dataset.value.shape[0]):\n",
      "    if (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]"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [],
     "prompt_number": 19
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "angle"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "metadata": {},
       "output_type": "pyout",
       "prompt_number": 20,
       "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)"
       ]
      }
     ],
     "prompt_number": 20
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [],
     "language": "python",
     "metadata": {},
     "outputs": []
    }
   ],
   "metadata": {}
  }
 ]
}