{
  "metadata": {
    "kernelspec": {
      "name": "python3",
      "display_name": "Python 3",
      "language": "python"
    },
    "language_info": {
      "codemirror_mode": {
        "name": "ipython",
        "version": 3
      },
      "name": "python",
      "version": "3.5.2",
      "nbconvert_exporter": "python",
      "pygments_lexer": "ipython3",
      "file_extension": ".py",
      "mimetype": "text/x-python"
    }
  },
  "nbformat_minor": 0,
  "nbformat": 4,
  "cells": [
    {
      "source": [
        "%matplotlib inline"
      ],
      "execution_count": null,
      "outputs": [],
      "cell_type": "code",
      "metadata": {
        "collapsed": false
      }
    },
    {
      "source": [
        "\n# Neo Epoch - example 1 - Rasterplots\n\n\nThis example shows how to use NeoEpoch\n\n\n"
      ],
      "cell_type": "markdown",
      "metadata": {}
    },
    {
      "source": [
        "from neoStructures import *\nimport matplotlib.pyplot as plt\nfrom os.path import isdir, join, isfile\nimport _pickle\nimport seaborn as sns\nsns.set()\nsns.set_context('paper')"
      ],
      "execution_count": null,
      "outputs": [],
      "cell_type": "code",
      "metadata": {
        "collapsed": false
      }
    },
    {
      "source": [
        "Load neoEpoch data with _pickle\n\n"
      ],
      "cell_type": "markdown",
      "metadata": {}
    },
    {
      "source": [
        "data_dir = join('pySpikeAnalysis', 'sample_data') if isdir('pySpikeAnalysis') else join('..', '..', 'pySpikeAnalysis', 'sample_data')\nprint(data_dir)\nneo_epoch_filename = r'neoepoch_070119_1117.p'\nif not isfile(join(data_dir, neo_epoch_filename)):\n    raise ValueError('Cannot find the file {}'.format(join(data_dir, neo_epoch_filename)))\nwith open(join(data_dir, neo_epoch_filename), 'rb') as f:\n    try:\n        neo_epoch = _pickle.load(f)\n    except:\n        raise Exception('Cannot pickle the file {}'.format(join(data_dir, neo_epoch_filename)))\n\nneo_epoch.save_fig = 0"
      ],
      "execution_count": null,
      "outputs": [],
      "cell_type": "code",
      "metadata": {
        "collapsed": false
      }
    },
    {
      "source": [
        "See information about NeoAll\n\n"
      ],
      "cell_type": "markdown",
      "metadata": {}
    },
    {
      "source": [
        "print(neo_epoch)"
      ],
      "execution_count": null,
      "outputs": [],
      "cell_type": "code",
      "metadata": {
        "collapsed": false
      }
    },
    {
      "source": [
        "Plot the raster plot for unit 4\n\n"
      ],
      "cell_type": "markdown",
      "metadata": {}
    },
    {
      "source": [
        "neo_epoch.plot_rasterplot(4)"
      ],
      "execution_count": null,
      "outputs": [],
      "cell_type": "code",
      "metadata": {
        "collapsed": false
      }
    }
  ]
}