Manual
From NeuroTychoWiki
Contents
Python installation manual for Windows
Notice that you must have administrative rights on your computer for this manual.This manual is only for 32bit windows.
Python
- Download "Windows x86 MSI Installer" for Python 2.6.6 from http://www.python.org/download/releases/2.6.6/
- Run the installer.
- Step through the installer program.
- Except as otherwise noted, click "Next" to bring forward Installation.
- Choice "Install for all users" and click "Next."
- Click "next".
- File:Data/050998d9a57e931e46c2c70119982d27.png Click "next".
Numpy
NumPy is a open-source numerical computation module for Python.
- Download "numpy-1.5.1-win32-superpack-python2.6.exe" from http://sourceforge.net/projects/numpy/files/NumPy/1.5.1/.
- File:d9f9e4c26024b18dc4b21b099e7f900d.png]]
- Run the installer.
- Step through the installer program.
Scipy
Scipy is a open-source python module for mathematics, science, and engineering.
- Download "scipy-0.8.0-win32-superpack-python2.6.exe" from http://sourceforge.net/projects/scipy/files/scipy/0.8.0/.
- Run the installer.
- Step through the installer plogram.
Matplotlib
Matplotlib is a plotting library for the Python.
- Visit the official page of matplotlib at http://matplotlib.sourceforge.net/.
- Click on the download link.
- Download "matplotlib-1.0.1.win32-py2.6.exe".
- Run the installer.
- Step through the installer program.
Sample code for analyzing neurotycho data in python
Notice the we assume "C:/neurotycho" as download directory. If You have download neurotycho datasets elsewhere, adapt the pathes below.
plotting
#!/usr/bin/python #-*- coding: utf-8 -*- import numpy as np import scipy.io import scipy import matplotlib import matplotlib.pyplot as plt _indir = "C:/neurotycho/20100604_S1_ST_K2_ToruYanagawa_mat_ECoG128-Event3/" def load_mat(path): """ loading a matlab data using scipy.io """ return scipy.io.loadmat(path) if __name__=="__main__": mat = load_mat(_indir+"ECoG_ch1.mat")#loading ECoG data data = mat["ECoGData_ch1"][0] event = load_mat(_indir+"Event.mat")##loading event data eindex = event["EventIndex"][0]#EventIndex is one-row vector contains indexes when events were occurred in ECoG data. fig = plt.figure() ax = fig.add_subplot(111) ax.plot(data)#plotting ECoGdata ax.annotate('Inject anesthetic drug', xy=(eindex[0],data[eindex[0]]), xytext=(eindex[0]-170000,2000), arrowprops=dict(facecolor='black', shrink=0.1,), ) plt.show()