Skip to content

Commit

Permalink
name changed to Kiel Motion Analysis Toolbox (KMAT)
Browse files Browse the repository at this point in the history
  • Loading branch information
masoudabedinifar committed Jul 17, 2024
1 parent 32d62a3 commit 2a11cda
Show file tree
Hide file tree
Showing 64 changed files with 274 additions and 274 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/test-and-lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ jobs:
poetry install
- name: Testing with coverage
run: |
poetry run pytest ngmt/test/ --cov=ngmt --cov-report=xml
poetry run pytest kmat/test/ --cov=kmat --cov-report=xml
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v2
env:
Expand Down
4 changes: 2 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
# See: https://git-scm.com/docs/gitignore
__pycache__/
projects/
/ngmt.egg-info
/kmat.egg-info

my_messy_code/mytestconde.py

/my_messy_code/*
ngmt/examples_gait_sqeuence.py
kmat/examples_gait_sqeuence.py

examples/data

Expand Down
20 changes: 10 additions & 10 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,35 +6,35 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [0.0.4]

Forth release of NGMT for for JOSS publication.
Forth release of KAMT for for JOSS publication.

### Fixed
- Gait sequence detection with datetime [[#61]](https://github.com/neurogeriatricskiel/NGMT/pull/61)
- Gait sequence detection with datetime [[#61]](https://github.com/neurogeriatricskiel/KMAT/pull/61)

### Changed
- Reworked documentation [[#60]](https://github.com/neurogeriatricskiel/NGMT/pull/60)
- Reworked documentation [[#60]](https://github.com/neurogeriatricskiel/KMAT/pull/60)

## [0.0.3] - 2024-02-27

Third unofficial release of NGMT for testing purposes.
Third unofficial release of KMAT for testing purposes.

### Added
- Pyarrow as dependency [[ADD]](https://github.com/neurogeriatricskiel/NGMT/commit/22e401a5519cc9adde37b5c752a361a07d8166ac)
- Testing coverage [[ADD]](https://github.com/neurogeriatricskiel/NGMT/commit/f6a919100e7a9d7319a4af77592a78bd6949bb69)
- Pyarrow as dependency [[ADD]](https://github.com/neurogeriatricskiel/KMAT/commit/22e401a5519cc9adde37b5c752a361a07d8166ac)
- Testing coverage [[ADD]](https://github.com/neurogeriatricskiel/KMAT/commit/f6a919100e7a9d7319a4af77592a78bd6949bb69)

### Fixed
- Existing algorithms adapted to new dataclass structure [[FIX]](https://github.com/neurogeriatricskiel/NGMT/commit/3adf7756d9998b36454dccc86d9e2283200d72ed)
- Existing algorithms adapted to new dataclass structure [[FIX]](https://github.com/neurogeriatricskiel/KMAT/commit/3adf7756d9998b36454dccc86d9e2283200d72ed)

## [0.0.2] - 2024-01-22

Second unofficial release of NGMT for testing purposes.
Second unofficial release of KMAT for testing purposes.

### Added
- Physical acitivity monitoring algorithm [[#29]](https://github.com/neurogeriatricskiel/NGMT/commit/a8d9067cde00f0c9a0dba8b7fc623ba4eeb32d0a)
- Physical acitivity monitoring algorithm [[#29]](https://github.com/neurogeriatricskiel/KMAT/commit/a8d9067cde00f0c9a0dba8b7fc623ba4eeb32d0a)

## [0.0.1] - 2023-11-21

This is the first unofficial release of NGMT.
This is the first unofficial release of KMAT.
Therefore, we do not have a proper changelog for this release.

### Added
Expand Down
36 changes: 18 additions & 18 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
[![codecov](https://codecov.io/gh/neurogeriatricskiel/NGMT/graph/badge.svg?token=L578RHZ699)](https://codecov.io/gh/neurogeriatricskiel/NGMT)
[![build docs](https://github.com/neurogeriatricskiel/NGMT/actions/workflows/mkdocs.yml/badge.svg)](https://github.com/neurogeriatricskiel/NGMT/actions/workflows/mkdocs.yml)
[![codecov](https://codecov.io/gh/neurogeriatricskiel/KMAT/graph/badge.svg?token=L578RHZ699)](https://codecov.io/gh/neurogeriatricskiel/KMAT)
[![build docs](https://github.com/neurogeriatricskiel/KMAT/actions/workflows/mkdocs.yml/badge.svg)](https://github.com/neurogeriatricskiel/KMAT/actions/workflows/mkdocs.yml)
[![Code style: black](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/psf/black)
![GitHub issues](https://img.shields.io/github/issues-raw/neurogeriatricskiel/NGMT)
![GitHub contributors](https://img.shields.io/github/contributors/neurogeriatricskiel/NGMT)
[![lint-and-test](https://github.com/neurogeriatricskiel/NGMT/actions/workflows/test-and-lint.yml/badge.svg)](https://github.com/neurogeriatricskiel/NGMT/actions/workflows/test-and-lint.yml)
![PyPI - Python Version](https://img.shields.io/pypi/pyversions/ngmt)
![GitHub issues](https://img.shields.io/github/issues-raw/neurogeriatricskiel/KMAT)
![GitHub contributors](https://img.shields.io/github/contributors/neurogeriatricskiel/KMAT)
[![lint-and-test](https://github.com/neurogeriatricskiel/KMAT/actions/workflows/test-and-lint.yml/badge.svg)](https://github.com/neurogeriatricskiel/KMAT/actions/workflows/test-and-lint.yml)
![PyPI - Python Version](https://img.shields.io/pypi/pyversions/kmat)


![NGMTLogo](ngmt_logo_transBG.png)
![KMATLogo](kmat_logo_transBG.png)

Welcome to the NeuroGeriatricsMotionToolbox (NGMT). We are a Python based toolbox for processing motion data.
Welcome to the Kiel Motion Analysis Toolbox (KMAT). We are a Python based toolbox for processing motion data.

The toolbox is aimed at motion researchers who want to use Python-based open-source software to process their data. We have implemented validated algorithms in modules to process motion data, as shown in the table below:

Expand All @@ -26,21 +26,21 @@ The idea is that various motion data can be loaded into our dedicated dataclass
## Data classes
### Data classes: conceptual framework

Motion data is recorded with many different systems and modalities, each with their own proprietary data format. NGMT deals with this by organizing both data and metadata in a [BIDS-like format](https://bids-specification.readthedocs.io/en/stable/modality-specific-files/motion.html). The BIDS format suggests that [motion recording data](https://bids-specification.readthedocs.io/en/stable/modality-specific-files/motion.html#motion-recording-data) from a single tracking system is organized in a single `*_tracksys-<label>_motion.tsv` file.
Motion data is recorded with many different systems and modalities, each with their own proprietary data format. KMAT deals with this by organizing both data and metadata in a [BIDS-like format](https://bids-specification.readthedocs.io/en/stable/modality-specific-files/motion.html). The BIDS format suggests that [motion recording data](https://bids-specification.readthedocs.io/en/stable/modality-specific-files/motion.html#motion-recording-data) from a single tracking system is organized in a single `*_tracksys-<label>_motion.tsv` file.

!!! note

A tracking system is defined as a group of motion channels that share hardware properties (the recording device) and software properties (the recording duration and number of samples).

In NGMT, data from a single tracking system is therefore loaded into a single `pandas.DataFrame`. The column headers of this `pandas.DataFrame` refer to the channels, and the corresponding [channels information](https://bids-specification.readthedocs.io/en/stable/modality-specific-files/motion.html#channels-description-_channelstsv) is likewise available as a `pandas.DataFrame`.
In KMAT, data from a single tracking system is therefore loaded into a single `pandas.DataFrame`. The column headers of this `pandas.DataFrame` refer to the channels, and the corresponding [channels information](https://bids-specification.readthedocs.io/en/stable/modality-specific-files/motion.html#channels-description-_channelstsv) is likewise available as a `pandas.DataFrame`.

Similarly, if any [events](https://bids-specification.readthedocs.io/en/stable/modality-specific-files/task-events.html) are available for the given recording, these are loaded into a single `pandas.DataFrame` for each tracking system as well. The events derived from the toolbox can be exported to a BIDS like '*_events.tsv' file.

### Data classes: in practice
These concepts are translated into a NGMT dataclass for each recording: `NGMTRecording`:
These concepts are translated into a KMAT dataclass for each recording: `KMATRecording`:
```mermaid
classDiagram
class NGMTRecording {
class KMATRecording {
data: dict[str, pd.DataFrame]
channels: dict[str, pd.DataFrame]
info: None | dict[str, Any] = None
Expand All @@ -52,9 +52,9 @@ classDiagram
}
```
A recording consists of the motion data from one or more tracking systems, where each tracking system may consist motion data from one or more tracked points. Therefore, the motion data (`NGMTRecording.data`) are organized as a dictionary where the dictionary keys refer to the tracking systems, and the corresponding values the actual (raw) data as a `pandas.DataFrame`. The description of data channels (`NGMTRecording.channels`) is availabe as a dictionary with the same keys, and the values contain the channels description.
A recording consists of the motion data from one or more tracking systems, where each tracking system may consist motion data from one or more tracked points. Therefore, the motion data (`KMATRecording.data`) are organized as a dictionary where the dictionary keys refer to the tracking systems, and the corresponding values the actual (raw) data as a `pandas.DataFrame`. The description of data channels (`KMATRecording.channels`) is availabe as a dictionary with the same keys, and the values contain the channels description.
```python
>>> from ngmt.datasets import mobilised
>>> from kmat.datasets import mobilised
>>> file_name = "/mnt/neurogeriatrics_data/Mobilise-D/rawdata/sub-3011/Free-living/data.mat"
>>> recording = mobilised.load_recording(file_name, tracking_systems=["SU", "SU_INDIP"], tracked_points=["LowerBack"])
>>> recording.data
Expand Down Expand Up @@ -108,17 +108,17 @@ classDiagram

!!! note

In the examples you find a [tutorial (the basics of NGMT)](https://neurogeriatricskiel.github.io/NGMT/examples/00_tutorial_basics/) that explains the basics of the dataclass and how to work with them.
In the examples you find a [tutorial (the basics of KMAT)](https://neurogeriatricskiel.github.io/KMAT/examples/00_tutorial_basics/) that explains the basics of the dataclass and how to work with them.

## Installation
The toolbox has been released on [pypi](https://pypi.org/project/ngmt/) and can be installed via pip:
The toolbox has been released on [pypi](https://pypi.org/project/kmat/) and can be installed via pip:
```bash
pip install ngmt
pip install kmat
```
It requires Python 3.10 or higher.

## Contributing
We welcome contributions to NGMT! Please refer to our [contributing guide](https://neurogeriatricskiel.github.io/NGMT/contributing) for more details.
We welcome contributions to KMAT! Please refer to our [contributing guide](https://neurogeriatricskiel.github.io/KMAT/contributing) for more details.


## Authors
Expand Down
8 changes: 4 additions & 4 deletions docs/contributing.md
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
## Contributing guide
Thanks for considering contributing to our toolbox! NGMT is an open-source project and we welcome contributions from anyone to further enhance this project
Thanks for considering contributing to our toolbox! KMAT is an open-source project and we welcome contributions from anyone to further enhance this project

There are lots of ways to contribute, such as:
- Use the software, and when you find bugs, tell us about them! We can only fix the bugs we know about.
- Tell us about parts of the documentation that you find confusing or unclear.
- Tell us about things you wish NGMT could do, or things it can do but you wish they were easier.
- Tell us about things you wish KMAT could do, or things it can do but you wish they were easier.
- Fix bugs.
- Implement new features.
- Improve existing tutorials or write new ones.

To report bugs, request new features, or ask about confusing documentation, it’s usually best to open a [new issue](https://github.com/neurogeriatricskiel/NGMT/issues/new/choose) on GitHub. For better reproducibility, be sure to include information about your operating system and NGMT version, and (if applicable) include a reproducible code sample that is as short as possible and ideally uses one of [our example datasets](https://neurogeriatricskiel.github.io/NGMT/datasets/).
To report bugs, request new features, or ask about confusing documentation, it’s usually best to open a [new issue](https://github.com/neurogeriatricskiel/KMAT/issues/new/choose) on GitHub. For better reproducibility, be sure to include information about your operating system and KMAT version, and (if applicable) include a reproducible code sample that is as short as possible and ideally uses one of [our example datasets](https://neurogeriatricskiel.github.io/KMAT/datasets/).

### Overview
In general you'll be working with three different copies of the the NGMT codebase: the official remote copy at [https://github.com/neurogeriatricskiel/NGMT](https://github.com/neurogeriatricskiel/NGMT) (usually called ``upstream``), your remote `fork` of the upstream repository (similar URL, but with your username in place of ``NGMT``, and usually called ``origin``), and the local copy of the codebase on your computer. The typical contribution process is to:
In general you'll be working with three different copies of the the KMAT codebase: the official remote copy at [https://github.com/neurogeriatricskiel/KMAT](https://github.com/neurogeriatricskiel/KMAT) (usually called ``upstream``), your remote `fork` of the upstream repository (similar URL, but with your username in place of ``KMAT``, and usually called ``origin``), and the local copy of the codebase on your computer. The typical contribution process is to:

1. synchronize your local copy with ``upstream``
2. make changes to your local copy
Expand Down
10 changes: 5 additions & 5 deletions docs/dataclass.md
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
In the following the NGMT dataclass is described.
In the following the KMAT dataclass is described.
The dataclass is used to store motion data in a standardized way. We provide some small set of import functions, each of which returns a `pandas.DataFrame` or a dict.
User should easily be able to write their own import functions, to get the their data into the provided dataclass (this step might take some thinking).
After the data is in the dataclass, running functions on the data from our toolbox should be really straight forward.

## NGMT data class
## KMAT data class
```mermaid
classDiagram
class NGMTRecording {
class KMATRecording {
data: dict[str, pd.DataFrame]
channels: dict[str, pd.DataFrame]
info: None | dict[str, Any] = None
Expand All @@ -19,6 +19,6 @@ classDiagram
```

A recording consists of the motion data from one or more tracking systems, where each tracking system may consist motion data from one or more tracked points. Therefore, the motion data (`NGMTRecording.data`) are organized as a dictionary where the dictionary keys refer to the tracking systems, and the corresponding values the actual (raw) data as a `pandas.DataFrame`. The description of data channels (`NGMTRecording.channels`) is availabe as a dictionary with the same keys, and the values contain the channels description.
A recording consists of the motion data from one or more tracking systems, where each tracking system may consist motion data from one or more tracked points. Therefore, the motion data (`KMATRecording.data`) are organized as a dictionary where the dictionary keys refer to the tracking systems, and the corresponding values the actual (raw) data as a `pandas.DataFrame`. The description of data channels (`KMATRecording.channels`) is availabe as a dictionary with the same keys, and the values contain the channels description.

::: utils.ngmt_dataclass
::: utils.kmat_dataclass
2 changes: 1 addition & 1 deletion docs/datasets/keepcontrol.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@

The Keep Control dataset derived from the [Keep Control](https://www.keep-control.eu/) project and is a Industrial Academic Initial Training Network working towards specific diagnosis and treatment of age-related gait and balance deficits. Part of the dataset was made publicly available on [figshare](https://figshare.com/articles/dataset/Full-body_mobility_data_to_validate_inertial_measurement_unit_algorithms_in_healthy_and_neurological_cohorts/20238006), and it was published as Warmerdam *et al*., Data, 2022, Full-Body Mobility Data to Validate Inertial Measurement Unit Algorithms in Healthy and Neurological Cohorts, doi: [10.3390/data7100136](https://doi.org/10.3390/data7100136).

For this dataset a simple load function is provided to load the data into the NGMT dataclasses.
For this dataset a simple load function is provided to load the data into the KMAT dataclasses.

::: datasets.keepcontrol
2 changes: 1 addition & 1 deletion docs/datasets/mobilised.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@

The Mobilise-D dataset derived from the [Mobilise-D](https://mobilise-d.eu/) consortium and is a European project that aims to develop a comprehensive system to monitor and evaluate people's gait based on digital technologies, including sensors worn on the body, such as a low back-worn inertial measurement unit (IMU). Example data were made publicly available as Micó-Amigo *et al*., Zenodo, 2023, Assessing real-world gait with digital technology? Validation, insights and recommendations from the Mobilise-D consortium [[Data set]](https://zenodo.org/records/7547125), doi: [10.5281/zenodo.7547125](https://doi.org/10.5281/zenodo.7547125) and results for the entire dataset were published as Micó-Amigo *et al*., Journal of NeuroEngineering and Rehabilitation, 2023, Assessing real-world gait with digital technology? Validation, insights and recommendations from the Mobilise-D consortium, doi: [10.1186/s12984-023-01198-5](https://doi.org/10.1186/s12984-023-01198-5).

For this dataset a simple load function is provided to load the data into the NGMT dataclasses.
For this dataset a simple load function is provided to load the data into the KMAT dataclasses.

::: datasets.mobilised
10 changes: 5 additions & 5 deletions docs/examples/00_tutorial_basics.md
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
# Tutorial: the basics of NGMT
# Tutorial: the basics of KMAT

**Author:** Robbin Romijnders
**Last update:** Tue 16 Jan 2024

## Learning objectives
By the end of this tutorial:
- you can load data from a recording that belongs to one of the available datasets,
- you know which attributes are available for an instance of the `NGMTRecording`
- you know which attributes are available for an instance of the `KMATRecording`
- you can do some basic selecting and slicing of data

## Imports
Expand All @@ -18,12 +18,12 @@ We start by importing some Python libraries. You should be familiar with most of
import numpy as np
import matplotlib.pyplot as plt
import os
from ngmt.datasets import mobilised
from kmat.datasets import mobilised
```

## Import data

Let us consider a single recording, namely of the randomly selected subject `sub-3011` from the `Mobilise-D` dataset, and load the data. For that we use the `load_recording()` function that is available in the `ngmt.datasets.mobilised` module.
Let us consider a single recording, namely of the randomly selected subject `sub-3011` from the `Mobilise-D` dataset, and load the data. For that we use the `load_recording()` function that is available in the `kmat.datasets.mobilised` module.


```python
Expand Down Expand Up @@ -400,7 +400,7 @@ print(recording.data) # print(recording.__dict__["data"])
[993024 rows x 27 columns]}


We see that that `data` attribute is in the form of a Python `dict`, where the keys correspond to the tracking systems that we have requested when calling the `load_recording()` function. NGMT is setup so that the keys of the `channels` attribute match with these keys, so that the channel descriptions are availbale per tracking system.
We see that that `data` attribute is in the form of a Python `dict`, where the keys correspond to the tracking systems that we have requested when calling the `load_recording()` function. KMAT is setup so that the keys of the `channels` attribute match with these keys, so that the channel descriptions are availbale per tracking system.


```python
Expand Down
Loading

0 comments on commit 2a11cda

Please sign in to comment.