Diff for "WorkingOutNipy" - Methods
location: Diff for "WorkingOutNipy"
Differences between revisions 5 and 6
Revision 5 as of 2007-07-25 18:25:22
Size: 1881
Editor: devel03
Comment:
Revision 6 as of 2013-03-08 10:28:28
Size: 1881
Editor: localhost
Comment: converted to 1.6 markup
No differences found!

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.

None: WorkingOutNipy (last edited 2013-03-08 10:28:28 by localhost)