This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
timecorr is a Python toolbox for computing and exploring correlational structure in timeseries data. The main functionality is built around the timecorr function which computes dynamic correlations from timeseries observations and finds higher-order structure in the data.
# Install dependencies
pip install -r requirements.txt
# or
make init# Run tests using nosetests
nosetests tests
# or
make test
# Run tests using pytest (alternative)
pytest# Build documentation
cd docs
make html
# Build notebooks (for tutorials)
make notebooks# Install package in development mode
pip install -e .
# Build distribution packages
python setup.py sdist bdist_wheeltimecorr/timecorr.py: Main module containing thetimecorr()function - the primary entry point for computing dynamic correlationstimecorr/helpers.py: Utility functions including:- Weight functions (gaussian_weights, laplace_weights, etc.)
- Correlation functions (isfc, wisfc, autofc, wcorr)
- Data formatting and manipulation utilities
- Dimensionality reduction functions
timecorr/simulate.py: Data simulation utilities for generating test datasets
The timecorr function accepts:
data: Single numpy array/dataframe or list of arrays (one per subject)weights_function: How timepoints contribute to correlations (default: gaussian_weights)cfun: Correlation function -isfc(within/across subjects),wisfc(weighted),autofc(within subject only)rfun: Dimensionality reduction function to prevent feature explosion when computing higher-order correlations
- Input data formatted as timepoints × features matrices
- Weights function determines temporal smoothing
- Correlation function computes moment-by-moment correlations
- Optional reduction function prevents dimensionality explosion
- Output maintains temporal structure with correlational features
- Uses
nosetests(legacy) andpytest(modern) - Tests in
tests/directory - Test files:
test_timecorr.py,test_helpers.py - Uses simulated data from
simulate_data()function - Current tests are basic - more comprehensive tests needed per TODO comments
- Uses Sphinx for documentation generation
- Documentation source in
docs/directory - Examples in
examples/directory - Tutorial notebooks in
docs/tutorial/ - API documentation auto-generated from docstrings
Core dependencies:
- hypertools>=0.7.0
- scipy>=1.2.1
- scikit-learn>=0.19.2
- numpy, pandas (via hypertools)
Development dependencies:
- nose (testing)
- sphinx (documentation)
- duecredit (citations)