Metadata-Version: 2.4
Name: rtacpy
Version: 0.1.5
Summary: A Python package for calculating RTAC, the rank-transform area coverage coefficient of correlation.
Author: Itai Pelles
License: Apache-2.0
Project-URL: Homepage, https://github.com/itaipelles/rtacpy
Project-URL: Changelog, https://github.com/itaipelles/rtacpy/releases
Project-URL: Issues, https://github.com/itaipelles/rtacpy/issues
Project-URL: CI, https://github.com/itaipelles/rtacpy/actions
Classifier: License :: OSI Approved :: Apache Software License
Requires-Python: <3.13,>=3.9
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: numpy
Requires-Dist: numba
Provides-Extra: test
Requires-Dist: pytest; extra == "test"
Dynamic: license-file

# rtacpy

[![PyPI](https://img.shields.io/pypi/v/rtacpy.svg)](https://pypi.org/project/rtacpy/)
[![Docs](https://readthedocs.org/projects/rtacpy/badge/?version=latest)](https://rtacpy.readthedocs.io/en/latest/)
[![Tests](https://github.com/itaipelles/rtacpy/actions/workflows/test.yml/badge.svg)](https://github.com/itaipelles/rtacpy/actions/workflows/test.yml)
[![Changelog](https://img.shields.io/github/v/release/itaipelles/rtacpy?include_prereleases&label=changelog)](https://github.com/itaipelles/rtacpy/releases)
[![License](https://img.shields.io/badge/license-Apache%202.0-blue.svg)](https://github.com/itaipelles/rtacpy/blob/main/LICENSE)

A Python package for calculating RTAC, the rank-transform area coverage coefficient of correlation. This is the official repository of the paper (link TBD):

"A coefficient of correlation for continuous random variables based on area coverage"

## Installation

Install this library using `pip`:
```bash
pip install rtacpy
```
## Usage

```python
import numpy as np
from rtacpy import calc_rtac, create_null_dist, area_coverage_independence_test
n = 100
x = np.random.rand(n)
y = np.random.rand(n)
null_dist = create_null_dist(n)
rtac, p_value = area_coverage_independence_test(x, y, null_dist=null_dist)
print(f'x and y are independent, rtac = {rtac}, p_value = {p_value}')
y = np.square(x)
rtac, p_value = area_coverage_independence_test(x, y, null_dist=null_dist)
print(f'x and y are dependent, rtac = {rtac}, p_value = {p_value}')

# If p_value is not needed, you can calculate just rtac
rtac_2 = calc_rtac(x,y)
assert rtac == rtac_2
```

## Development

To contribute to this library, first checkout the code. Then create a new virtual environment:
```bash
cd rtacpy
python -m venv venv
source venv/bin/activate
```
Now install the dependencies and test dependencies:
```bash
python -m pip install -e '.[test]'
```
To run the tests:
```bash
python -m pytest
```
