Skip to content

Commit

Permalink
Merge pull request #12 from statefb/feature/github-actions
Browse files Browse the repository at this point in the history
add: main git actions for cicd
  • Loading branch information
statefb authored Mar 31, 2022
2 parents 78d9779 + 4cdcc37 commit 4dd6a2d
Show file tree
Hide file tree
Showing 4 changed files with 59 additions and 9 deletions.
30 changes: 30 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
name: Test and upload to PyPI

on:
push:
branches:
- master

jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: r-lib/actions/setup-r@v2
- run: Rscript -e 'install.packages("dtw")'
- uses: actions/setup-python@v3
with:
python-version: "3.9" # Version range or exact version of a Python version to use, using SemVer's version range syntax
architecture: "x64" # optional x64 or x86. Defaults to x64 if not specified
- run: pip install -e .
- run: pip install -r tests/requirements.txt
- run: python tests/test_cost.py

deploy:
runs-on: ubuntu-latest
steps:
- uses: pypa/[email protected]
with:
user: ${{ secrets.PYPI_USER_NAME }}
password: ${{ secrets.PYPI_API_TOKEN }}
repository_url: https://test.pypi.org/legacy/
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
Pipfile
Pipfile.lock
docs/_build
.env

__pycache__
/dtwalign.egg-info/
Expand Down
36 changes: 27 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,54 +1,72 @@
# DTW (Dynamic Time Warping)

[![Documentation Status](https://readthedocs.org/projects/dtwalign/badge/?version=latest)](https://dtwalign.readthedocs.io/en/latest/?badge=latest)


![cicd workflow](https://github.com/statefb/dtwalign/actions/workflows/main.yml/badge.svg)

Comprehensive dynamic time warping module for python.
Documentation is [available via ReadTheDocs](https://dtwalign.readthedocs.io/en/latest/index.html).

## Installation

```
pip install dtwalign
```

## Features

### Fast computation

---

by [Numba](https://numba.pydata.org)

### Partial alignment

---
- before alignment

- before alignment

![](docs/img/partial_org.png)

- after alignment
- after alignment

![](docs/img/partial_res.png)

### Local constraint (step pattern)

---

example:

| Symmetric2 | AsymmetricP2 | TypeIVc |
|:-----------:|:------------:|:------------:|
| Symmetric2 | AsymmetricP2 | TypeIVc |
| :--------------------------: | :----------------------------: | :-----------------------: |
| ![](docs/img/symmetric2.png) | ![](docs/img/asymmetricP2.png) | ![](docs/img/typeIVc.png) |

### Global constraint (windowing)

---

example:

| Sakoechiba | Itakura | User defined |
|:-----------:|:------------:|:------------:|
| Sakoechiba | Itakura | User defined |
| :--------------------------: | :-----------------------: | :------------------------: |
| ![](docs/img/sakoechiba.png) | ![](docs/img/itakura.png) | ![](docs/img/user_win.png) |

### Alignment path visualization

---

![](docs/img/partial_path.png)

## Usage

see [example](https://htmlpreview.github.io/?https://github.com/statefb/dtwalign/blob/master/example/example.html)

## Reference

1. Sakoe, H.; Chiba, S., Dynamic programming algorithm optimization for spoken word recognition, Acoustics, Speech, and Signal Processing

* Paolo Tormene, Toni Giorgino, Silvana Quaglini, Mario Stefanelli (2008). Matching Incomplete Time Series with Dynamic Time Warping: An Algorithm and an Application to Post-Stroke Rehabilitation. Artificial Intelligence in Medicine, 45(1), 11-34.
- Paolo Tormene, Toni Giorgino, Silvana Quaglini, Mario Stefanelli (2008). Matching Incomplete Time Series with Dynamic Time Warping: An Algorithm and an Application to Post-Stroke Rehabilitation. Artificial Intelligence in Medicine, 45(1), 11-34.

* Toni Giorgino (2009). Computing and Visualizing Dynamic Time Warping Alignments in R: The dtw Package. Journal of Statistical Software, 31(7), 1-24.
- Toni Giorgino (2009). Computing and Visualizing Dynamic Time Warping Alignments in R: The dtw Package. Journal of Statistical Software, 31(7), 1-24.
1 change: 1 addition & 0 deletions tests/requirements.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
rpy2

0 comments on commit 4dd6a2d

Please sign in to comment.