semvec/pypi-packages huggingface dataset:
ratspy 0.1.0a3
Python bindings for RATS, a rust crate for Rapid Augmentations for Time Series.
Requires Python: >=3.8
Keywords: augmentation, time series, rust

# RATSpy

[![License](https://img.shields.io/badge/License-Apache_2.0-blue.svg)](https://opensource.org/licenses/Apache-2.0)
[![ReadTheDocs](https://img.shields.io/badge/Readthedocs-%23000000.svg?style=for-the-badge&logo=readthedocs&logoColor=white)](https://ratspy.readthedocs.io)

RATSpy provides Python bindings for `RATS`, a rust crate for **R**apid **A**ugmentations for **T**ime **S**eries on univariate time series data.

## Installation
Install the package using PyPI
```
pip install ratspy
```
Python version 3.8+ is required.

## Usage
Example to reconstruct the surface from an input file, apply some post-processing methods and write the data back to a file:
```python
import ratspy as rp
import numpy as np

# Dataset from https://timeseriesclassification.com/dataset.php
data = pd.read_csv("./data/Car/Car.csv").to_numpy()

x = data[:,:-1].astype(np.float64)
y = list(map(lambda a: str(a), data[:,-1]))

dataset = rp.Dataset(x, y)

addnoise = rp.AddNoise(rp.NoiseType.Slope, bounds=(0.01, 0.05))
# Only execute the AddNoise augmenter for half of the series in the dataset
addnoise.probability = 0.5

pipeline = (rp.AugmentationPipeline()
            + rp.Repeat(10)
            + rp.Crop(100)
            + addnoise
            + rp.Jittering(0.1))

pipeline.augment_batch(dataset, parallel=True)

# Access augmented data using dataset.features and dataset.labels
```

## Development notes

### Manual Build instructions
1. Clone the repository
2. cd to the `ratspy` directory
3. Install all required Python packages from `requirements.txt` in a virtual environment of your choice: `pip install -r requirements.txt`
4. Now, to build the project, use maturin: `maturin develop -r`
   - Maturin automatically installs the resulting binary in your Python environment

### Stub file generation
To automatically generate a stub file (`ratspy.pyi`) for the package, run `cargo run --bin stub_gen`.

This will expose Rust documentation comments to the Python side as docstrings.

### Sphinx Documentation
To generate the Sphinx documentation, make sure that the package is installed through, e.g., maturin, and then run `make html` in the `docs` directory.
The resulting HTML files will be in `docs/_build/html`.

You also need to install the documentation dependencies from `docs/requirements.txt`.

### Tests
To test the installation of ratspy in your `venv` and run some initial tests, we provide unit tests for each of ratspy's classes as well as the entire pipeline in the `/tests` directory. 

Run the following commands to run tests: 

```shell
cd tests
python -m unittest test_RATSpy
```

### Benchmarking
In `benchmarking/` are scripts that automatically benchmark this library against the Python-native library [`tsaug`](https://tsaug.readthedocs.io/en/stable/). 
Which augmenters should be benchmarked can be configured using the `benchmarking/augmenter_configs.yaml` file.
sphinxcontrib-svg2pdfconverter 2.0.0
Sphinx SVG to PDF or PNG converter extension
Requires Python: >=3.6

********************************************
Sphinx SVG to PDF or PNG Converter Extension
********************************************

This extension converts SVG images to PDF or PNG in case the builder does not support
SVG images natively (e.g. LaTeX).

Internally, either `Inkscape <https://inkscape.org/>`_, ``rsvg-convert``
from `libRSVG <https://wiki.gnome.org/Projects/LibRsvg>`_ or `CairoSVG
<https://cairosvg.org/>`_ as progressively more lightweight alternatives
are used to convert images.


Installation
============

Just install via ``pip``:

.. code-block:: console

   $ pip install sphinxcontrib-svg2pdfconverter

You can choose between Inkscape, libRSVG and CairoSVG by adding
``sphinxcontrib.inkscapeconverter``, ``sphinxcontrib.rsvgconverter`` or
``sphinxcontrib.cairosvgconverter`` to the ``extensions`` list in your
``conf.py``.

Make sure to have either ``inkscape`` or the ``rsvg-convert`` command available
in your systems ``PATH`` and, if necessary, adapt the
``inkscape_converter_bin`` or ``rsvg_converter_bin`` config value respectively.

CairoSVG requires additional dependencies to be installed with:

.. code-block:: console

   $ pip install sphinxcontrib-svg2pdfconverter[CairoSVG]

CairoSVG and its dependencies may require additional tools during the
installation depending on the OS you are using; see the `CairoSVG documentation
<https://cairosvg.org/documentation/#installation>`_ for further details.

Configuration
=============

Inkscape
--------

``inkscape_converter_bin``
    Path to Inkscape binary. By default, this is ``inkscape``.

``inkscape_converter_args``
    Additional command-line arguments for Inkscape, as a list. By
    default, this is ``['--export-area-drawing']``.

RSVG
----

``rsvg_converter_bin``
    Path to RSVG converter binary. By default, this is ``rsvg-convert``.

``rsvg_converter_format``
    The value provided to the RSVG converter's ``--format`` argument when
    converting to PDF. In more recent RSVG builds, the ``pdf1.5`` format will
    generate the fewest warnings with LaTeX backends.
    By default, this is ``pdf``.

``rsvg_converter_args``
    Additional command-line arguments for the RSVG converter, as a list. By
    default, this is the empty list ``[]``.

CairoSVG
--------

No configuration is required.
mni-to-atlas 1.2.0
A simple Python-based tool for finding brain atlas regions based on MNI coordinates.
Requires Python: >=3.10

# mni-to-atlas
A simple Python-based tool for finding brain atlas regions based on MNI coordinates, with basic plotting abilities to show the sagittal, coronal, and axial views of the coordinates on the atlas.

The following atlases are currently supported:
- Automated anatomical labelling atlas [[1]](#References)
- Automated anatomical labelling 3 atlas (1mm<sup>3</sup> voxel version) [[2]](#References)
- Human Connectome Project extended parcellation atlas [[3]](#References)

If there is an atlas you would like to see added, please open an [issue](https://github.com/tsbinns/mni_to_atlas/issues).

Example screenshot of the plotting:
![image](docs/_static/example_plot.png)

## Requirements:
[See here for the list of requirements](requirements.txt).

## Use Example:
1. Install the package into the desired environment using pip `pip install mni-to-atlas`.
2. Import the `AtlasBrowser` class into your workspace.
3. Create an instance of the `AtlasBrowser` class and specify an atlas to use (can be "AAL", "AAL3", or "HCPEx").
4. Provide MNI coordinates to the `AtlasBrowser` object to find the corresponding atlas regions. The brain regions for these coordinates are then returned as a list of strings.
   - The coordinates should be an (n x 3) array, where each row contains an x-, y-, and z-axis MNI coordinate. 
   - By default, plotting the coordinates is not performed, however this can be changed by setting `plot = True` in the `find_regions` method. In this case, a figure will be generated for each set of coordinates.

In case your MNI coordinates do not correspond to a defined atlas region (e.g., the coordinates correspond to electrodes above the brain surface), the `project_to_nearest` method can be used to project the coordinates to the nearest defined atlas region, before finding the brain regions.

<br>

```python
# Import the AtlasBrowser class
from mni_to_atlas import AtlasBrowser
import numpy as np

# Instantiate the AtlasBrowser class and specify the atlas to use
atlas = AtlasBrowser("AAL3")

# Define MNI coordinates as an (n x 3) array
coordinates = np.array([[-24, -53, 73],
                        [-25, 20, 70]])

# Find the brain regions at the MNI coordinates (plotting is optional)
regions = atlas.find_regions(coordinates, plot=True)
assert regions == ["Parietal_Sup_L", "Undefined"]

# Project 'undefined' coordinates to the nearest defined atlas region
projected_coords = atlas.project_to_nearest(coordinates)
projected_regions = atlas.find_regions(projected_coords)
assert np.all(projected_coords == np.array([[-24, -53, 73], [-24, 18, 66]]))
assert projected_regions == ["Parietal_Sup_L", "Frontal_Sup_2_L"]
```

## References:
1. Tzourio-Mazoyer *et al.* (2002) DOI: [10.1006/nimg.2001.0978](https://doi.org/10.1006/nimg.2001.0978)
2. Rolls *et al.* (2020) DOI: [10.1016/j.neuroimage.2019.116189](https://doi.org/10.1016/j.neuroimage.2019.116189)
3. Huang *et al.* (2022) DOI: [10.1007/s00429-021-02421-6](https://doi.org/10.1007/s00429-021-02421-6)