Metadata-Version: 2.4
Name: pyLASAHandwritingDataset
Version: 0.2.0
Summary: LASA Handwriting dataset for Python3
Author-email: Ashrith Sagar <ashrithy@iisc.ac.in>
License-File: LICENSE
Requires-Python: >=3.10
Requires-Dist: numpy>=2.2.6
Requires-Dist: platformdirs>=4.9.4
Requires-Dist: pooch>=1.9.0
Requires-Dist: scipy>=1.15.3
Requires-Dist: tqdm>=4.67.3
Description-Content-Type: text/markdown

# pyLASAHandwritingDataset

[![Ruff](https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/astral-sh/ruff/main/assets/badge/v2.json)](https://github.com/astral-sh/ruff)

[LASA Handwriting dataset](https://bitbucket.org/khansari/lasahandwritingdataset) for Python3

This package provides a typed, lightweight Python interface for loading and accessing the dataset.

## Installation

Install the package from PyPI:

```shell
# Using uv
uv add pylasahandwritingdataset

# Or with pip
pip3 install pylasahandwritingdataset
```

To install from the latest commit:

```shell
uv add git+https://github.com/AshrithSagar/pyLASAHandwritingDataset.git@main
```

## Usage

```python
import pyLASAHandwritingDataset as lasa

# List available motions
motions = lasa.DataSet.handwriting_motions()
print(motions)  # ('Angle', 'BendedLine', 'CShape', 'DoubleBendedLine', 'GShape', 'JShape', 'JShape_2', 'Khamesh', 'LShape', 'Leaf_1', 'Leaf_2', 'Line', 'Multi_Models_1', 'Multi_Models_2', 'Multi_Models_3', 'Multi_Models_4', 'NShape', 'PShape', 'RShape', 'Saeghe', 'Sharpc', 'Sine', 'Snake', 'Spoon', 'Sshape', 'Trapezoid', 'WShape', 'Worm', 'Zshape', 'heee')

# Load a motion pattern
pattern = lasa.DataSet["GShape"]
print(pattern.name)  # "GShape"
print(pattern.dt)
print(len(pattern.demos))  # 7

# Access demonstrations
demo = pattern.demos[0]
t   = demo.t    # shape (1, 1000)
pos = demo.pos  # shape (2, 1000)
vel = demo.vel  # shape (2, 1000)
acc = demo.acc  # shape (2, 1000)

# For typing specification, the motion names are also available in
from pyLASAHandwritingDataset import (
    HandwritingMotion,  # Any handwriting motion: single pattern or multi-model
    SinglePatternMotion,  # Any single pattern handwriting motion
    MultiModelMotion,  # Any multi-model handwriting motion
    #
    ALL_HANDWRITING_MOTIONS,  # A tuple of all handwriting motions
    ALL_SINGLE_PATTERN_MOTIONS,  # A tuple of all single pattern handwriting motions
    ALL_MULTI_MODEL_MOTIONS,  # A tuple of all multi-model handwriting motions
    #
    is_handwriting_motion,  # A TypeGuard to check whether a `str` is a handwriting motion
    is_multi_model_motion,  # A TypeGuard to check whether a `str` is a multi-model handwriting motion
    is_single_pattern_motion,  # A TypeGuard to check whether a `str` is a single pattern handwriting motion
)
```

For documentation, refer to the original dataset repo's [README](https://bitbucket.org/khansari/lasahandwritingdataset/src/master/Readme.txt).

## References

- https://bitbucket.org/khansari/lasahandwritingdataset
- https://www.epfl.ch/labs/lasa/code-datasets/
- https://github.com/epfl-lasa/LASAHandwritingDataset
- https://github.com/justagist/pyLasaDataset

## Acknowledgement

If you use this dataset in research, please cite the original author:

```
S. M. Khansari-Zadeh and A. Billard, "Learning Stable Non-Linear Dynamical
Systems with Gaussian Mixture Models", IEEE Transaction on Robotics, 2011.
```

## License

The LASA Handwriting Dataset is free for non-commercial academic use.

Please refer to the [original dataset repository](https://bitbucket.org/khansari/lasahandwritingdataset) for licensing details.
