Metadata-Version: 2.5
Name: noraxy
Version: 0.1.11
Summary: Format Noraxon MyoData3 (OPENDATA) recordings into clean per-record folders (sensors + video + metadata).
Project-URL: Homepage, https://github.com/cgvalle/noraxy
Project-URL: Repository, https://github.com/cgvalle/noraxy
Project-URL: Issues, https://github.com/cgvalle/noraxy/issues
Author-email: Carlos <cgvallea@gmail.com>
License: MIT
License-File: LICENSE
Keywords: biomechanics,emg,imu,myodata,noraxon,sensors
Classifier: Development Status :: 4 - Beta
Classifier: Intended Audience :: Science/Research
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Topic :: Scientific/Engineering
Requires-Python: >=3.10
Requires-Dist: imageio-ffmpeg>=0.4
Requires-Dist: numpy>=1.24
Requires-Dist: opencv-python>=4.8
Requires-Dist: polars>=0.20
Provides-Extra: dev
Requires-Dist: build>=1.0; extra == 'dev'
Requires-Dist: pytest>=7; extra == 'dev'
Description-Content-Type: text/markdown

# Noraxy

[![CI](https://github.com/cgvalle/noraxy/actions/workflows/ci.yml/badge.svg)](https://github.com/cgvalle/noraxy/actions/workflows/ci.yml)

Format Noraxon MyoData3 (OPENDATA) recordings into clean per-record folders.

Each input record becomes an output folder containing:

- `emg.parquet`, `imu.parquet`, `orientation.parquet`, `sync.parquet` — one file per sensor type, each at its native sampling rate
- `video.mkv` — original video (copied byte-for-byte); pass `--video mp4` to remux/re-encode into an MP4 container instead
- `meta.json` — subject, date, per-sensor rate & column info, and video metadata

## Install

```bash
pip install noraxy
```

## CLI usage

```bash
noraxy <input_folder> -o <output_folder>
```

Full options:

```
noraxy INPUT [-o OUTPUT] [--video mkv|mp4] [--no-video]
```

- `INPUT` — root of a Noraxon MR export (contains `persons/<id>/records/<id>/...`)
- `-o, --output` — destination folder (default: `<input>/../noraxy_out`)
- `--video` — `mkv` (default, byte-for-byte copy) or `mp4` (remux into MP4; if the source codec is not MP4-compatible, re-encodes to H.264 using hardware acceleration when available: `h264_videotoolbox` on macOS, `h264_nvenc`/`h264_qsv`/`h264_amf` on Linux/Windows, falling back to `libx264`)
- `--no-video` — skip the video entirely

Example:

```bash
noraxy "data/Noraxon MR data" -o data/clean --hz 2000
```

You can also invoke it as a module:

```bash
python -m noraxy "data/Noraxon MR data" -o data/clean
```

## Python API

```python
import noraxy

# One-shot: format an entire folder tree
noraxy.format_folder("data/Noraxon MR data", "data/clean")

# Or work with a single record, split by sensor type at native rates
dfs, meta = noraxy.read_record_native("data/Noraxon MR data/persons/.../records/RCP2")
emg_df = dfs["emg"]         # 2000 Hz
imu_df = dfs["imu"]         # 200 Hz

# Aligned sensor + video access
with noraxy.NoraxonRecord(record_dir) as rec:
    sample = rec[42]                # dict with frame, sensors, time
    print(rec.sensor_columns())
```

## Output layout

```
output_dir/
  RCP1/
    emg.parquet
    imu.parquet
    orientation.parquet
    sync.parquet
    video.mkv           # or video.mp4 with --video mp4
    meta.json
  RCP2/
    ...
```

## Development

```bash
git clone https://github.com/cgvalle/noraxy
cd noraxy
pip install -e ".[dev]"
pytest
```

## Publishing

Every push to `main` triggers `.github/workflows/release.yml`, which:

1. Bumps the patch version by `0.0.1` in `src/noraxy/__init__.py`
2. Commits the bump as `chore: release vX.Y.Z [skip ci]` and pushes it back to `main`
3. Creates and pushes a `vX.Y.Z` git tag
4. Builds the sdist + wheel and uploads to PyPI via trusted publishing

To skip a release for a given push, include `[skip ci]` in the commit message.

**One-time PyPI setup**: at https://pypi.org/manage/account/publishing/, add a
pending publisher for project `noraxy`, owner `cgvalle`, repo `noraxy`,
workflow `release.yml`, environment `pypi`.

## License

MIT
