Ads by Google
Christian Borgelt's Web Pages

PyCoCo - Continuous-time Closed Neuron Assembly Detection for Python

Download

standard MIS-based support
coco.so (433 kb) GNU/Linux Python 3.10 shared object
coco.pyd (121 kb) Windows Python 3.10 dynamic module
 
influence map overlap based support
ccnovl.so (413 kb) GNU/Linux Python 3.10 shared object
ccnovl.pyd (110 kb) Windows Python 3.10 dynamic module
 
pycoco.zip (414 kb) C sources, version 2.44 (2016.11.21)
pycoco.tar.gz (394 kb)
psf+psr.zip (78 kb) Python scripts for Pattern Spectrum Filtering
psf+psr.tar.gz (70 kb) and Pattern Set Reduction

Description

PyCoCo is an extension module that makes the CoCoNAD implementation available as a function in Python 3.10 or later and also includes a function for generating a pattern spectrum with the help of surrogate data and CoCoNAD analysis.

How to use the function coconad can be seen in the script testcoco.py in the source package (directory pycoco/ex). For the function patspec see the script ccn+psf+psr.py in the psf+psr archives. Alternatively, from a Python command prompt interface, call help(coco), help(coconad) (or help(coco.coconad)) and help(patspec) (or help(coco.patspec)) or print coconad.__doc__ and patspec.__doc__ for a description of these functions and their arguments.

The Python scripts in the archives psf+psr implement the full analysis process of parallel (spike) trains/point processes as it is described (although for standard frequent item set mining) in [Picado-Muiño et al. 2013] and [Torre et al. 2013]. A full description of these scripts can be found here. Call the main script ccn+psf+psr.py without any arguments to obtain a help message that shows the invocation and the available options.

If instead of a command prompt interface as the psf+psr scripts provide it, a graphical user interface is desired, the Java-based CoCoGUI program is worth looking at.

Installation: precompiled version

If you have a GNU/Linux system, you can use this extension module by simply downloading the shared object made available above and storing it in a directory that is on your PYTHONPATH (environment variable). A typical (local) installation directory is $HOME/lib/ while a typical (global) installation directory is /usr/local/lib/python3.10/site-packages/ . (Note that you may need root rights to copy into the latter directories.) A typical (local) installation directory for the Anaconda Python distribution is $HOME/anaconda/lib/python310/site-packages/.

If you have a Windows system, downloading the Python dynamic module made available above and placing it into the extension module directory of your Python installation should work. Consult the manual of your Python installation to find the correct directory. A typical directory for (global) installation is C:\Program Files\Python310\Lib\site-packages\ (Note that you may need administrator rights to copy into these directory.) A typical installation directory for the Anaconda Python distribution is C:\Anaconda3\Lib\site-packages\.

If you have trouble on Microsoft Windows, check whether you have the Microsoft Visual C++ Redistributable for Visual Studio 2022 (see under "Other Tools and Frameworks") installed, as the library was compiled with Microsoft Visual Studio 2022.

Installation: using setuptools

Another way to install the extension module for your system is to use the Python script setup_fim.py (in the source package), which uses Python's setuptools package to build and install the module.

On a GNU/Linux system call the script with

./setup_coco.py install

in a terminal window to build and install the extension module. If you get a "Permission denied" error message, check whether the file setup_coco.py is marked as executable. If it is not, add the executable flag with the command

chmod +x setup_coco.py

Alternatively, call the script explicitly through Python:

python3 setup_coco.py install

On a Microsoft Windows system call the script with

python setup_coco.py install

in a command prompt window to build and install the extension module. Note, however, that this direct call to Python is possible on Microsoft Windows only if the directory, in which the program python.exe resides, is contained in your PATH variable (environment variable, check its contents at a command prompt with echo %PATH%). Otherwise you may have to specify the full path to the Python program. A typical form of the command for this case is

"C:\Program Files\Python310\python.exe" setup_coco.py install

In addition, building the module requires a C compiler. On a GNU/Linux system Python uses the system C compiler, which for GNU/Linux is usually the GNU C compiler gcc. This compiler is essentially part of the system and thus basically always available. One only may have to install the Python development files (package python-dev or python3-dev for Debian based GNU/Linux distributions).

On a Windows system Python commonly uses Microsoft Visual Studio C/C++, which therefore needs to be installed. Note that the Community Edition of this C compiler can be obtained (perfectly legally) free of charge.

Note generally (for GNU/Linux as well as for Microsoft Windows) that installing this extension module for all users may require root/administrator rights in order to copy the shared object/Python dynamic module to the standard extension module directory. Local installations (for individual users) are also possible.

Installation: recompilation with makefiles

On GNU/Linux (provided the Python development files are installed – package python3-dev on Debian based distributions), you may also install the extension module by simply calling

make all

in the source directory pycoco/src and copying the resulting shared object coco.so to a directory that is on your PYTHONPATH (environment variable).

On Windows you may also install the extension module by simply calling

nmake /f pycoco.mak all

in a command prompt of Microsoft Visual Studio C/C++ in the source directory pycoco/src and copying the resulting dynamic module coco.pyd to the extension module directory of your Python installation.

Should the compilation fail, check the definition of the variable PYDIR in the makefile (Gnu/Linux) or pycoco.mak (Windows)

If you are using the Anaconda Python distribution, you may use the special makefile pycoco_conda.mak, which is configured for Anaconda 1.8.0 installed in the default path. If you have a different version or installed to a non-standard path, you may have to adapt the definitions of CONDAINC and CONDALIB in pycoco_conda.mak.

References

More information about the CoCoNAD algorithm can be found in the following papers:

The use of pattern spectra to evaluate the statistical significance of found frequent item sets is explained in these papers (although for standard frequent item set mining, but the idea can be transferred, with a few adaptations, to CoCoNAD):