Skip to content

thejanzimmermann/pycar

 
 

Repository files navigation

Author : Kevin S. Brown (kevin.s.brown@uconn.edu, github.com/thelahunginjeet)

A python package that contains implementations of the following algorithms:

RAICAR : See Z. Yang, S. LaConte, X. Weng, and X. Hu, Human Brain Mapping 29: 711-725 (2008) for the original RAICAR algorithm and Brown, Grafton, and Carlson, 
PLoS ONE 7: e50268 (2012) and Brown et al., Journal of Neuroscience Methods 219: 205-219 (2013) for the modifications I have made.

BICAR : Brown, Grafton, Carlson, PLoS ONE 7: e50268 (2012) and Brown et al., Journal of Neuroscience Methods 219: 205-219 (2013) for details of the BICAR algorithm.

Both RAICAR and BICAR need an external module to run Independent Component Analysis.  They have been written with my pyica and rpy2ica packages in mind (also available on github), but this is not necessary.  RAICAR/BICAR have constructor arguments icaMethod and icaOptions.  icaMethod should be a function to run ICA that has the call signature:

	A,W,S = my_ica_function(X,nSources,**kwargs)

A is the mixing matrix, W the unmixing matrix, and S the sources.  If you don't return the tuple this way, RAICAR/BICAR will fail.  The additional keyword arguments can be anything; they are simply passed along.  The default behavior is to use pyica.fastica with "sensible" options.

For a 'quick start' in RAICAR (using fastica from pyica):

>>from pycar.raicar import RAICAR
>>from pyica import fastica 
>>raicar = RAICAR(projDirectory='scratch',icaMethod=fastica)
>>raicar.clean_project()
>>raicar.runall(X)

X should be a matrix of size Nmixtures x Nsamples, where (ideally) Nsamples >> Nmixtures.  See the documentation on BICAR and RAICAR for full details.

BICAR is significantly more complicated that RAICAR.  Along with the two data matrices, information relating the sampling rates of the two data modalities must be supplied to BICAR, as well as an assumed LTI transfer function (via the BICARTransferFunction object).  See tests/test_bicar_pytest.py for an example of how to set up a BICAR run.

For quick tests to see if things are working, run

~>python setup.py test

The tests will fail if run manually from within tests/, since the relative paths are not correct.

About

python code for RAICAR and BICAR

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Python 100.0%