Skip to content

Commit 984624f

Browse files
committed
refactoring & documentation
1 parent 79416f4 commit 984624f

File tree

11 files changed

+120
-13
lines changed

11 files changed

+120
-13
lines changed

CHANGELOG.rst

+7
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,13 @@
22
Changelog
33
=========
44

5+
0.2.2
6+
------------------
7+
- Added better support for extensions and custom metrics
8+
- Refine implementation of MoS metric according to the the latest findings
9+
- Fixed bug resolving dependencies with conda main channel
10+
11+
512
0.2.1
613
------------------
714
- Added minimal toe clearance metric

CONTRIBUTING.rst

+3
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ gaitalytics could always use more documentation, whether as part of the
2121
official gaitalytics docs, in docstrings, or even on the web in blog posts,
2222
articles, and such.
2323

24+
2425
Feature requests and feedback
2526
=============================
2627

@@ -32,6 +33,8 @@ If you are proposing a feature:
3233
* Keep the scope as narrow as possible, to make it easier to implement.
3334
* Remember that this is a volunteer-driven project, and that code contributions are welcome :)
3435

36+
.. _Development:
37+
3538
Development
3639
===========
3740

README.rst

+3-4
Original file line numberDiff line numberDiff line change
@@ -69,9 +69,6 @@ Fast install with anaconda:
6969
conda install gaitalytics -c DartLab-LLUI
7070
..
7171
72-
.. warning::
73-
| To avoid dependencies issues, make sure conda-forge is the first channel in your conda configuration.
74-
7572
Or with pip:
7673

7774
.. code:: shell
@@ -170,4 +167,6 @@ Simple Pipeline
170167
Documentation
171168
-------------
172169
https://python-gaitalytics.readthedocs.org
173-
170+
https://github.com/DART-Lab-LLUI/python-gaitalytics
171+
https://pypi.org/project/gaitalytics/
172+
https://anaconda.org/dartlab-llui/gaitalytics

docs/conf.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,8 @@
2020
extensions = ['sphinx.ext.autodoc',
2121
'sphinx_codeautolink',
2222
'sphinxcontrib.bibtex',
23-
'sphinx.ext.napoleon',]
23+
'sphinx.ext.napoleon',
24+
'sphinxcontrib.mermaid',]
2425

2526
bibtex_bibfiles = ['_static/Gaitalytics.bib']
2627

docs/extend/features.rst

+46
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
.. meta::
2+
:description: Gaitalytics Feature.
3+
:keywords: gaitalytics, gait-analysis, mocap, c3d, gait-metrics, biomechanics, time-series, data-analysis, data, gait, references
4+
5+
Extend features
6+
===============
7+
8+
.. warning::
9+
Gaitalytics is build to be independent on marker-models and modelling mechanisms through :ref:`configurations <Configuration>`.
10+
In this Tutorial we will not cover the creation of new :ref:`mapping configurations <Config Mapping>` since it will alter core functionality of the library.
11+
Your new features therefore may not work within different setups. To make your features available to the community and integrated to gaitalytics,
12+
please consider :ref:`contributing <Development>` to the project and our staff will take care of the integration.
13+
14+
Before you start creating new features, you should think about the following questions:
15+
16+
- Will my feature be calculated for each gait cycle?
17+
- Are all the needed markers defined through the :ref:`mappings <Config Mapping>`?
18+
19+
If you have answered all the questions, you can start creating your new feature.
20+
21+
Class inheritance
22+
-----------------
23+
24+
With with your answers in mind, you can now decide which class you want to inherit from. The following classes are available in the library:
25+
26+
- :class:`gaitalytics.features.FeatureCalculation`
27+
- :class:`gaitalytics.features.CycleFeaturesCalculation`
28+
- :class:`gaitalytics.features.PointDependentFeature`
29+
30+
The following flowchart will help you to decide which class you should inherit from:
31+
32+
.. mermaid::
33+
34+
flowchart LR
35+
A{Per cycle?}---|Yes|B{Mapped markers?}
36+
A---|No|FeatureCalculation
37+
B---|Yes|PointDependentFeature
38+
B---|No|CycleFeaturesCalculation
39+
40+
..
41+
42+
43+
44+
45+
46+

docs/extend/index.rst

+22
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
.. meta::
2+
:description: Gaitalytics Extensions.
3+
:keywords: gaitalytics, gait-analysis, mocap, c3d, gait-metrics, biomechanics, time-series, data-analysis, data, gait, guide, extend
4+
5+
Extend Functionality
6+
====================
7+
Gaitalytics is build to be extensible and flexible. You can extend the functionality of the framework by adding new features or new event detection algorithms.
8+
In the following pages, we will explain how you can extend the functionality of Gaitalytics for your specific needs.
9+
Additionally, you can also make your extensions available to the community by :ref:`contributing <Development>` to the project.
10+
11+
.. toctree::
12+
:maxdepth: 2
13+
:hidden:
14+
15+
features
16+
17+
..
18+
19+
20+
21+
22+

docs/index.rst

+1
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
usage/index
1919
api
2020
reference/index
21+
extend/index
2122
contributing
2223
authors
2324
changelog

docs/usage/data_loading.rst

+1
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ Here is an example of how to load a c3d file and the corresponding configuration
2626
2727
..
2828
29+
.. _Configuration:
2930

3031
Configuration
3132
-------------

gaitalytics/features.py

+13-5
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ def calculate(self, trial: model.TrialCycles) -> xr.DataArray:
4545
raise NotImplementedError
4646

4747

48-
class _CycleFeaturesCalculation(FeatureCalculation, ABC):
48+
class CycleFeaturesCalculation(FeatureCalculation, ABC):
4949
def calculate(self, trial: model.TrialCycles) -> xr.DataArray:
5050
"""Calculate the features for a trial.
5151
@@ -87,6 +87,8 @@ def _calculate(self, trial: model.Trial) -> xr.DataArray:
8787
8888
Returns:
8989
An xarray DataArray containing the calculated features.
90+
91+
:meta public:
9092
"""
9193
raise NotImplementedError
9294

@@ -211,7 +213,7 @@ def _flatten_features(features: xr.DataArray) -> xr.DataArray:
211213
return new_format
212214

213215

214-
class _PointDependentFeature(_CycleFeaturesCalculation, ABC):
216+
class PointDependentFeature(CycleFeaturesCalculation, ABC):
215217
def _get_marker_data(
216218
self, trial: model.Trial, marker: mapping.MappedMarkers
217219
) -> xr.DataArray:
@@ -223,6 +225,8 @@ def _get_marker_data(
223225
224226
Returns:
225227
An xarray DataArray containing the marker data.
228+
229+
:meta public:
226230
"""
227231
return mocap.get_marker_data(trial, self._config, marker)
228232

@@ -237,6 +241,8 @@ def _get_sacrum_marker(self, trial: model.Trial) -> xr.DataArray:
237241
238242
Returns:
239243
An xarray DataArray containing the sacrum marker data.
244+
245+
:meta public:
240246
"""
241247
return mocap.get_sacrum_marker(trial, self._config)
242248

@@ -270,7 +276,9 @@ def _get_sagittal_vector(self, trial: model.Trial) -> xr.DataArray:
270276
return linalg.get_normal_vector(progression_vector, vertical_vector)
271277

272278

273-
class TimeSeriesFeatures(_CycleFeaturesCalculation):
279+
280+
281+
class TimeSeriesFeatures(CycleFeaturesCalculation):
274282
"""Calculate time series features for a trial.
275283
276284
This class calculates following time series features for a trial.
@@ -420,7 +428,7 @@ def _create_phase_trial(trial: model.Trial, time_slice: slice):
420428
return phase_trial
421429

422430

423-
class TemporalFeatures(_CycleFeaturesCalculation):
431+
class TemporalFeatures(CycleFeaturesCalculation):
424432
"""Calculate temporal features for a trial.
425433
426434
This class calculates following temporal features for a trial.
@@ -499,7 +507,7 @@ def _calculate_supports(
499507
return {"double_support": double_support, "single_support": single_support}
500508

501509

502-
class SpatialFeatures(_PointDependentFeature):
510+
class SpatialFeatures(PointDependentFeature):
503511
"""Calculate spatial features for a trial.
504512
505513
This class calculates following spatial features for a trial.

pixi.lock

+20-2
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pyproject.toml

+2-1
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,8 @@ docs = ["sphinx",
5757
"sphinx-autodoc-typehints",
5858
"sphinx_github_changelog",
5959
"sphinx-codeautolink",
60-
"sphinxcontrib-bibtex"]
60+
"sphinxcontrib-bibtex",
61+
"sphinxcontrib-mermaid",]
6162

6263
[tool.pixi.project]
6364
channels = ["conda-forge"]

0 commit comments

Comments
 (0)