WorkingOutNipy - Methods

Upload page content

You can upload content for the page named below. If you change the page name, you can also upload content for another page. If the page name is empty, we derive the page name from the file name.

File to load page content from
Page name
Comment
Type the missing letters from: Lodon is th capial of nglnd

location: WorkingOutNipy

Working out NIPY

For a web interface to the code tree: http://projects.scipy.org/neuroimaging/ni/browser/ni/trunk

Useful examples (not quite quick start): http://projects.scipy.org/neuroimaging/ni/browser/ni/trunk/examples/quickstart

For a basic introduction to setting up designs:

To run an example script where we are, start ipython --pylab, then:

run /home/ian/devel_trees/nipy/examples/quickstart/design_models.py

(you need the ipython --pylab option to allow matplotlib to keep producing figures without locking the console).

The generic models code is in scipy.sandbox.models - to find where this is on the system (ipython):

import scipy.sandbox.models
scipy.sandbox.models.__file__

How to estimate a model on data

See: http://projects.scipy.org/scipy/scipy/browser/trunk/Lib/sandbox/models/regression.py for an example, and the models directory in general for the models code.

At interactive prompt, after running the example script above, you have a 'design' variable - which is just a design matrix:

import numpy as N
import scipy.sandbox.models as SSM

# Make some random data
n_time_points = design.shape[1]
rY = N.random.normal(size=(n_time_points,))

# Estimate the model
# Note FMRI design needs transpose to standard rows = timepoints orientation
pain_glm = SSM.glm(design.T)
pain_results = pain_glm.fit(rY)

See also: http://imaging.mrc-cbu.cam.ac.uk/svn/cbumethods/parameters/trunk/scripts/run_models.py for live data example.