Metadata-Version: 2.4
Name: ccm_analysis_pynb
Version: 1.7.0
Summary: A package for performing Convergent Cross Mapping (CCM) analysis on time series data in Python Notebooks
Home-page: https://github.com/chaseU2/CCM_analysis_Python_Notebook
Author: Karl Balzer
Author-email: klbalzer@web.de
Classifier: Programming Language :: Python :: 3
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: OS Independent
Requires-Python: >=3.6
Description-Content-Type: text/markdown
Requires-Dist: numpy
Requires-Dist: pandas
Requires-Dist: matplotlib
Requires-Dist: seaborn
Requires-Dist: scipy
Requires-Dist: ipywidgets
Dynamic: author
Dynamic: author-email
Dynamic: classifier
Dynamic: description
Dynamic: description-content-type
Dynamic: home-page
Dynamic: requires-dist
Dynamic: requires-python
Dynamic: summary

# CCM Analysis for Python Notebooks
[![PyPI version](https://img.shields.io/pypi/v/ccm-analysis-pynb.svg)](https://pypi.org/project/ccm-analysis-pynb/)

A Python package for performing Convergent Cross Mapping (CCM) analysis on time series data.
> **Note:** This package is optimized for Jupyter Notebooks (`.ipynb`). If you need to perform CCM analysis in a Python script (`.py`), please use [CCM_analysis_Python](https://github.com/chaseU2/CCM_analysis_Python).

## Installation

You can install the package via pip:

```bash
pip install ccm_analysis_pynb
```

## Usage

To use this package in a Jupyter Notebook, import the function and run the analysis:

```python
from ccm_analysis_pynb import run_ccm_analysis_jupyter

df = pd.DataFrame(data)

# Run CCM analysis
result_holder = run_ccm_analysis_jupyter(df, L=100, E=2, tau=1, THRESHOLD=0.8, save_output=False)

# Access the final DataFrame of significant relationships
final_results = result_holder.result
print(final_results)
```

## Parameters

- `data_input`: Either a filepath (str) to tab-separated data or a pandas DataFrame.
- `L`: Length of time series to consider.
- `E`: Embedding dimension.
- `tau`: Time delay.
- `THRESHOLD`: Significance threshold for cross-map scores.
- `save_output`: Whether to save plots and protocol (default: True).
- `output_dir`: Directory to save outputs (default: current working directory).

## Output

The function returns an interactive widget for manual evaluation of relationships. Once the evaluation is completed, it generates a final heatmap and saves the results if `save_output=True`.

## Test Dataset

You can test the `ccm_analysis` package using the sample dataset provided in this repository. You can download the test dataset from the following link:

- [Test Dataset (ccm_test_data.txt)](https://github.com/chaseU2/ccm-analysis-tool/blob/master/ccm_test_data.txt)

  

### Data Format

The dataset is structured as follows:

- **Columns** represent the variables you want to analyze.
- **Rows** represent the time points for each variable.



## Dependencies and Acknowledgements

Parts of this project are based on the Convergent Cross Mapping (CCM) implementation from the following repository from Prince Javier :

- [Convergent Cross Mapping GitHub Repository Prince Javier ](https://github.com/PrinceJavier/causal_ccm.git)

I have utilized parts of the CCM algorithm from this repository to help analyze causality in time series data in my own project.
