Difference between revisions of "Manual"

From NeuroTychoWiki
Jump to: navigation, search
Line 1: Line 1:
= Python installation manual for Windows
+
= Python installation manual for Windows =
  
 
Notice that you must have administrative rights on your computer for this manual
 
Notice that you must have administrative rights on your computer for this manual
 
This manual is only for 32bit windows.
 
This manual is only for 32bit windows.
== Python
+
== Python ==
  
 
# Download "Windows x86 MSI Installer" for Python 2.6.6 from http://www.python.org/download/releases/2.6.6/
 
# Download "Windows x86 MSI Installer" for Python 2.6.6 from http://www.python.org/download/releases/2.6.6/
Line 15: Line 15:
 
## [[File:data/050998d9a57e931e46c2c70119982d27.png]] Click "next".
 
## [[File:data/050998d9a57e931e46c2c70119982d27.png]] Click "next".
  
== Numpy
+
== Numpy ==
 
NumPy is a open-source numerical computation module for Python.
 
NumPy is a open-source numerical computation module for Python.
  
Line 26: Line 26:
 
## [[File:5df43fd3c06be4c91191e64e21ec4999.png]] Choice "Python Version 2.6" and click "Next".
 
## [[File:5df43fd3c06be4c91191e64e21ec4999.png]] Choice "Python Version 2.6" and click "Next".
  
== Scipy
+
== Scipy ==
 
Scipy is a open-source python module for mathematics, science, and engineering.
 
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/.
 
# Download "scipy-0.8.0-win32-superpack-python2.6.exe" from http://sourceforge.net/projects/scipy/files/scipy/0.8.0/.

Revision as of 21:15, 26 February 2011

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

  1. Download "Windows x86 MSI Installer" for Python 2.6.6 from http://www.python.org/download/releases/2.6.6/
    1. 0805d491734b39856b5c8e178c9de66e.png
  2. Run the installer.
    1. C926e6405ff303a6c80625204a5b7a9f.png Double click this icon to start installer.
  3. Step through the installer program.
    1. Except as otherwise noted, click "Next" to bring forward Installation.
    2. 743ee27846ed5bd129ed67a12d3bf5de.png Choice "Install for all users" and click "Next."
    3. 94be0d2c7a90dc5450c1581903b6e2fe.png Click "next".
    4. File:Data/050998d9a57e931e46c2c70119982d27.png Click "next".

Numpy

NumPy is a open-source numerical computation module for Python.

  1. Download "numpy-1.5.1-win32-superpack-python2.6.exe" from http://sourceforge.net/projects/numpy/files/NumPy/1.5.1/.
    1. File:d9f9e4c26024b18dc4b21b099e7f900d.png]]
  2. Run the installer.
    1. 347aa09541427e1dcfb7935f86d5c897.png Double click this icon to start installer.
  3. Step through the installer program.
    1. Except as otherwise noted, click "Next" to bring forward Installation.
    2. 5df43fd3c06be4c91191e64e21ec4999.png Choice "Python Version 2.6" and click "Next".

Scipy

Scipy is a open-source python module for mathematics, science, and engineering.

  1. Download "scipy-0.8.0-win32-superpack-python2.6.exe" from http://sourceforge.net/projects/scipy/files/scipy/0.8.0/.
    1. B5e1b8069c20d716069c8a3eb221b87a.png
  2. Run the installer.
    1. 55c0bcade8ab3d8a2c51dd08854a2576.png Double click this icon to start installer.
  3. Step through the installer plogram.
    1. Except as otherwise noted, click "Next" to bring forward Installation.
    2. A2ee9ebb15add7638912245704e55878.png Choice "Python Version 2.6" and click "Next".

== Matplotlib Matplotlib is a plotting library for the Python.

  1. Visit the official page of matplotlib at http://matplotlib.sourceforge.net/.
  2. Click on the http://sourceforge.net/projects/matplotlib/files/matplotlib/matplotlib-1.0.1/ link.
    1. http://gyazo.argmax.jp/data/88d00ceb483579b5c45915a42ad2dbcf.png
  3. Download "matplotlib-1.0.1.win32-py2.6.exe".
    1. B3ac9b2154bafd5809b68f8cdf0ac429.png
  4. Run the installer.
    1. Dea1f1d5e133c39cd9a52559bb8207ab.png Double click this icon to start installer.
  5. Step through the installer program.
    1. Except as otherwise noted, click "Next" to bring forward Installation.
    2. Cd94b01550095502721ca4acc5747f28.png Choice "Python Version 2.6" and click "Next".

= 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()

=== result Ca592b24adff54e62f5e2f7af236e919.png