Skip to content

Commit 4749282

Browse files
author
André Böni
committed
+ finalize conda build
1 parent 524461a commit 4749282

File tree

8 files changed

+46
-70
lines changed

8 files changed

+46
-70
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,3 +89,4 @@ docs/_build
8989
/out/
9090
/output/bld/rattler-build_gaitalytics_1721919576/work/build_env.bat
9191
/output/bld/rattler-build_gaitalytics_1721919576/work/conda_build.bat
92+
/conda-build/

conda.recipe/meta.yaml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,11 @@ build:
1515
number: 0
1616

1717
requirements:
18+
build:
19+
- pip
20+
- python >=3.11
21+
- setuptools
22+
- setuptools_scm
1823
host:
1924
- python >=3.11
2025
- pip

gaitalytics/_version.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
TYPE_CHECKING = False
44
if TYPE_CHECKING:
55
from typing import Tuple, Union
6+
67
VERSION_TUPLE = Tuple[Union[int, str], ...]
78
else:
89
VERSION_TUPLE = object
@@ -12,5 +13,5 @@
1213
__version_tuple__: VERSION_TUPLE
1314
version_tuple: VERSION_TUPLE
1415

15-
__version__ = version = '0.2.0'
16-
__version_tuple__ = version_tuple = (0, 2, 0)
16+
__version__ = version = "0.2.1.dev0+g524461a.d20240729"
17+
__version_tuple__ = version_tuple = (0, 2, 1, "dev0", "g524461a.d20240729")

gaitalytics/api.py

Lines changed: 23 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ def load_config(config_path: Path | str) -> mapping.MappingConfigs:
6464

6565
@_PathConverter
6666
def load_c3d_trial(
67-
c3d_file: Path | str, configs: mapping.MappingConfigs
67+
c3d_file: Path | str, configs: mapping.MappingConfigs
6868
) -> model.Trial:
6969
"""Loads a Trial from a c3d file.
7070
@@ -93,8 +93,7 @@ def load_c3d_trial(
9393

9494

9595
def detect_events(
96-
trial: model.Trial, config: mapping.MappingConfigs, method: str = "Marker",
97-
**kwargs
96+
trial: model.Trial, config: mapping.MappingConfigs, method: str = "Marker", **kwargs
9897
) -> pd.DataFrame:
9998
"""Detects the events in the trial.
10099
@@ -144,9 +143,9 @@ def check_events(event_table: pd.DataFrame, method: str = "sequence"):
144143

145144
@_PathConverter
146145
def write_events_to_c3d(
147-
c3d_path: Path | str,
148-
event_table: pd.DataFrame,
149-
output_path: Path | str | None = None,
146+
c3d_path: Path | str,
147+
event_table: pd.DataFrame,
148+
output_path: Path | str | None = None,
150149
):
151150
"""Writes the events to the c3d file.
152151
@@ -156,8 +155,7 @@ def write_events_to_c3d(
156155
output_path: The path to write the c3d file with the events.
157156
If None, the original file will be overwritten.
158157
"""
159-
io.C3dEventFileWriter(c3d_path).write_events(event_table,
160-
output_path) # type: ignore
158+
io.C3dEventFileWriter(c3d_path).write_events(event_table, output_path) # type: ignore
161159

162160

163161
def segment_trial(trial: model.Trial, method: str = "HS") -> model.TrialCycles:
@@ -185,7 +183,7 @@ def segment_trial(trial: model.Trial, method: str = "HS") -> model.TrialCycles:
185183

186184

187185
def time_normalise_trial(
188-
trial: model.Trial | model.TrialCycles, method: str = "linear", **kwargs
186+
trial: model.Trial | model.TrialCycles, method: str = "linear", **kwargs
189187
) -> model.Trial | model.TrialCycles:
190188
"""Normalises the time in the trial.
191189
@@ -208,15 +206,15 @@ def time_normalise_trial(
208206

209207

210208
def calculate_features(
211-
trial: model.TrialCycles,
212-
config: mapping.MappingConfigs,
213-
methods: list | tuple = (
214-
features.TimeSeriesFeatures,
215-
features.PhaseTimeSeriesFeatures,
216-
features.TemporalFeatures,
217-
features.SpatialFeatures,
218-
),
219-
**kwargs,
209+
trial: model.TrialCycles,
210+
config: mapping.MappingConfigs,
211+
methods: list | tuple = (
212+
features.TimeSeriesFeatures,
213+
features.PhaseTimeSeriesFeatures,
214+
features.TemporalFeatures,
215+
features.SpatialFeatures,
216+
),
217+
**kwargs,
220218
) -> xr.DataArray:
221219
"""Calculates the features of the trial.
222220
@@ -237,7 +235,7 @@ def calculate_features(
237235

238236

239237
def _create_feature_methods(
240-
methods: list[type] | tuple[type], config: mapping.MappingConfigs, **kwargs
238+
methods: list[type] | tuple[type], config: mapping.MappingConfigs, **kwargs
241239
) -> list[features.FeatureCalculation]:
242240
"""Checks the feature calculation methods.
243241
@@ -258,8 +256,11 @@ def _create_feature_methods(
258256

259257

260258
@_PathConverter
261-
def export_trial(trial: model.Trial | model.TrialCycles, output_path: Path | str,
262-
method: str ="netcdf"):
259+
def export_trial(
260+
trial: model.Trial | model.TrialCycles,
261+
output_path: Path | str,
262+
method: str = "netcdf",
263+
):
263264
"""Exports the trial to a c3d file.
264265
265266
This function will create a folder and save the trial as NetCDF files.
@@ -281,7 +282,6 @@ def export_trial(trial: model.Trial | model.TrialCycles, output_path: Path | str
281282
"""
282283
match method:
283284
case "netcdf":
284-
io.NetCDFTrialExporter(output_path).export_trial(trial)
285+
io.NetCDFTrialExporter(output_path).export_trial(trial) # type: ignore
285286
case _:
286287
raise ValueError(f"Unsupported method: {method}")
287-
io.NetCDFTrialExporter(output_path).export_trial(trial)

gaitalytics/features.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -361,7 +361,7 @@ def _calculate(self, trial: model.Trial) -> xr.DataArray:
361361

362362
context = analysis_data.attrs["context"]
363363

364-
event_ipsi = event_table.loc[
364+
event_ipsi = event_table.loc[ # type: ignore
365365
event_table[io.C3dEventInputFileReader.COLUMN_CONTEXT] == context # type: ignore
366366
]
367367
event_ipsi_fo = event_ipsi.loc[

gaitalytics/io.py

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -254,8 +254,7 @@ class _PyomecaInputFileReader(_BaseFileHandler, ABC):
254254
"""
255255

256256
def __init__(
257-
self, file_path: Path,
258-
pyomeca_class: type[pyomeca.Markers | pyomeca.Analogs]
257+
self, file_path: Path, pyomeca_class: type[pyomeca.Markers | pyomeca.Analogs]
259258
):
260259
"""Initializes a new instance of the MarkersInputFileReader class.
261260
@@ -270,7 +269,7 @@ def __init__(
270269
"""
271270
file_ext = file_path.suffix
272271
if file_ext == ".c3d" and (
273-
pyomeca_class == pyomeca.Analogs or pyomeca_class == pyomeca.Markers
272+
pyomeca_class == pyomeca.Analogs or pyomeca_class == pyomeca.Markers
274273
):
275274
data = pyomeca_class.from_c3d(file_path)
276275
elif file_ext == ".trc" and pyomeca_class == pyomeca.Markers:
@@ -296,7 +295,7 @@ def __init__(
296295

297296
@staticmethod
298297
def _to_absolute_time(
299-
data: xr.DataArray, first_frame: int, rate: float
298+
data: xr.DataArray, first_frame: int, rate: float
300299
) -> xr.DataArray:
301300
"""Converts the time to absolute time.
302301
@@ -455,7 +454,6 @@ def get_analysis(self) -> xr.DataArray:
455454

456455

457456
class _TrialExporter(_BaseFileHandler):
458-
459457
@abstractmethod
460458
def export_trial(self, trial: model.Trial | model.TrialCycles):
461459
"""Export the trial to the output folder.
@@ -530,4 +528,3 @@ def _export_trial_cycles(trial: model.TrialCycles, folder_path: Path):
530528
file_path = folder_path / f"{category.value}.nc"
531529
full_data = xr.Dataset(context_structs).to_dataarray("context")
532530
full_data.to_netcdf(file_path, mode="w", engine="h5netcdf")
533-

pixi.lock

Lines changed: 9 additions & 35 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pyproject.toml

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,6 @@ python = ">=3.11,<3.12"
7171
[tool.pixi.feature.py312.dependencies]
7272
python = ">=3.12.0,<3.13.0"
7373

74-
7574
[tool.pixi.feature.docs.tasks]
7675
clean-docs = "cleanpy --include-builds --exclude .pixi ."
7776
docs = "sphinx-build -M html ./docs ./docs/_build -W --keep-going"
@@ -84,8 +83,7 @@ test-api = "pytest -vv --capture=sys tests/test_api.py"
8483
[tool.pixi.feature.dev.tasks]
8584
ruff-format = "ruff format gaitalytics"
8685
ruff-check = { cmd = "ruff check gaitalytics --fix", depends-on = ["ruff-format"] }
87-
load-stubs = { cmd = "mypy --install-types", depends-on = ["ruff-check"] }
88-
check-code = { cmd = "mypy gaitalytics --check-untyped-defs", depends-on = ["load-stubs"] }
86+
check-code = { cmd = "mypy gaitalytics --check-untyped-defs", depends-on = ["ruff-check"] }
8987

9088
[tool.pixi.feature.build.tasks]
9189
build = "python -m build -n"

0 commit comments

Comments
 (0)