{
  "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 - ex_0\n\n\nThis example shows how to create NeoEpoch\n\n\n"
      ],
      "cell_type": "markdown",
      "metadata": {}
    },
    {
      "source": [
        "from neoStructures import NeoAll, NeoEpoch\nimport numpy as np"
      ],
      "execution_count": null,
      "outputs": [],
      "cell_type": "code",
      "metadata": {
        "collapsed": false
      }
    },
    {
      "source": [
        "Replace the next variables with your paths\n\n"
      ],
      "cell_type": "markdown",
      "metadata": {}
    },
    {
      "source": [
        "spykingcircus_dirpath = r'C:\\Users\\deudon\\Desktop\\SpikeSorting\\_Data\\002RM_day4_pointes\\spykingcircus_results'\nresults_filename = r'20150325-103311-001_0'\nevent_filepath = r'C:\\Users\\deudon\\Desktop\\SpikeSorting\\_Data\\002RM_day4_pointes\\Events\\eventFile_part.csv'\nsignal_dirpath = r'C:\\Users\\deudon\\Desktop\\SpikeSorting\\_Data\\002RM_day4_pointes\\signal\\monopolaire_5kHz_d4_post_crise'\nprobe_filepath = r'C:\\Users\\deudon\\Desktop\\SpikeSorting\\_Data\\002RM_day4_pointes\\spykingcircus_paramfiles\\002_RM.prb'\nfigure_dirpath = r'C:\\Users\\deudon\\Desktop\\SpikeSorting\\_Data\\002RM_day4_pointes\\fig'\nartefact_csv_filepath = r'C:\\Users\\deudon\\Desktop\\SpikeSorting\\_Data\\002RM\\Artefact_EDF_reconstruction_d1.csv'"
      ],
      "execution_count": null,
      "outputs": [],
      "cell_type": "code",
      "metadata": {
        "collapsed": false
      }
    },
    {
      "source": [
        "Epoching parameters\n\n"
      ],
      "cell_type": "markdown",
      "metadata": {}
    },
    {
      "source": [
        "csv_delimiter = ';'\nt_pre, t_post = 1, 1\nt_max, srate = -1, 30000\nepoch_t_start = np.array([-0.500, -0.250, -0.050, 0.050, 0.250])\nepoch_duration = np.array([0.250, 0.200, 0.100, 0.200, 0.250])\nepoch_names = ['Pre-IED baseline', 'Pre-IED', 'IED', 'Slow wave', 'Post-IED']"
      ],
      "execution_count": null,
      "outputs": [],
      "cell_type": "code",
      "metadata": {
        "collapsed": false
      }
    },
    {
      "source": [
        "First create a NeoAll instance\n\n"
      ],
      "cell_type": "markdown",
      "metadata": {}
    },
    {
      "source": [
        "neo_all = NeoAll(spykingcircus_dirpath, results_filename, probe_filepath, signal_dirpath=signal_dirpath,\n                event_filepath=event_filepath, fig_dirpath=figure_dirpath, save_fig=1)"
      ],
      "execution_count": null,
      "outputs": [],
      "cell_type": "code",
      "metadata": {
        "collapsed": false
      }
    },
    {
      "source": [
        "And create the NeoEpoch instance\n\n"
      ],
      "cell_type": "markdown",
      "metadata": {}
    },
    {
      "source": [
        "neo_epoch = NeoEpoch(neo_all, event_filepath=event_filepath, time_pre=0.2, time_post=0.2)\nprint(neo_epoch)"
      ],
      "execution_count": null,
      "outputs": [],
      "cell_type": "code",
      "metadata": {
        "collapsed": false
      }
    },
    {
      "source": [
        "You can save it with the save method :\n\n"
      ],
      "cell_type": "markdown",
      "metadata": {}
    },
    {
      "source": [
        "neo_epoch.save(r'C:\\Users\\deudon\\Desktop\\SpikeSorting\\_Scripts\\_Python\\pySpikeAnalysis\\pySpikeAnalysis\\sample_data')"
      ],
      "execution_count": null,
      "outputs": [],
      "cell_type": "code",
      "metadata": {
        "collapsed": false
      }
    }
  ]
}