neurogeriatricskiel / KielMAT

Python based toolbox for processing motion data
https://neurogeriatricskiel.github.io/KielMAT/
Other
6 stars 1 forks source link

Should we issue a new (sub-)release? #91

Closed rmndrs89 closed 3 months ago

rmndrs89 commented 4 months ago

Hi all,

I encounter the following problem:

---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)
Cell In[5], [line 1](vscode-notebook-cell:?execution_count=5&line=1)
----> [1](vscode-notebook-cell:?execution_count=5&line=1) recording = keepcontrol.load_recording(
      [2](vscode-notebook-cell:?execution_count=5&line=2)     RAW_DATA_PATH.joinpath(f"sub-{SUBJECT_ID}/motion/sub-{SUBJECT_ID}_task-{TASK}_run-{RUN}_tracksys-imu_motion.tsv"),
      [3](vscode-notebook-cell:?execution_count=5&line=3)     tracking_systems=["omc", "imu"],
      [4](vscode-notebook-cell:?execution_count=5&line=4)     tracked_points={
      [5](vscode-notebook-cell:?execution_count=5&line=5)         "omc": [
      [6](vscode-notebook-cell:?execution_count=5&line=6)             f"{lr}_{tp}"
      [7](vscode-notebook-cell:?execution_count=5&line=7)             for lr in "lr"
      [8](vscode-notebook-cell:?execution_count=5&line=8)             for tp in ["heel", "toe", "ank"]
      [9](vscode-notebook-cell:?execution_count=5&line=9)         ]
     [10](vscode-notebook-cell:?execution_count=5&line=10)     }
     [11](vscode-notebook-cell:?execution_count=5&line=11) )

File d:\Projects\esmac24\.venv\lib\site-packages\ngmt\datasets\keepcontrol.py:53, in load_recording(file_name, tracking_systems, tracked_points)
     [51](file:///D:/Projects/esmac24/.venv/lib/site-packages/ngmt/datasets/keepcontrol.py:51) # From the file_name, extract the tracking system
     [52](file:///D:/Projects/esmac24/.venv/lib/site-packages/ngmt/datasets/keepcontrol.py:52) search_str = "_tracksys-"
---> [53](file:///D:/Projects/esmac24/.venv/lib/site-packages/ngmt/datasets/keepcontrol.py:53) idx_from = file_name.find(search_str) + len(search_str)
     [54](file:///D:/Projects/esmac24/.venv/lib/site-packages/ngmt/datasets/keepcontrol.py:54) idx_to = idx_from + file_name[idx_from:].find("_")
     [55](file:///D:/Projects/esmac24/.venv/lib/site-packages/ngmt/datasets/keepcontrol.py:55) current_tracksys = file_name[idx_from:idx_to]

AttributeError: 'WindowsPath' object has no attribute 'find'

To get there, I have taken the following steps:

cd D:\\Projects
mkdir mynewproject
cd mynewproject
python  -m venv .venv
.\.venv\Scripts\activate
pip install ngmt

This issue has already been addressed on the main branch, since the file_name now only accepts a pathlib.Path , and then str(file_name) is called, however this is not updated in the release. Or is there another workaround?

Ciao, Robbin

rmndrs89 commented 3 months ago
robbin@Z390:~/Projects$ mkdir test
robbin@Z390:~/Projects$ cd test/
robbin@Z390:~/Projects/test$ python3 -m venv testenv
robbin@Z390:~/Projects/test$ source testenv/bin/activate
(testenv) robbin@Z390:~/Projects/test$ pip install --index-url https://test.pypi.org/simple ngmt
Looking in indexes: https://test.pypi.org/simple
Collecting ngmt
  Downloading https://test-files.pythonhosted.org/packages/ea/4f/2fbace31be202580978c2fdfddff3b16e7f9e57278fe9ff6dd3a5fc49a8f/ngmt-0.0.4-py3-none-any.whl (105 kB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 105.5/105.5 KB 1.7 MB/s eta 0:00:00
Collecting actipy<4.0.0,>=3.0.5
  Downloading https://test-files.pythonhosted.org/packages/2b/9e/204fd8170baf6b376af53d87c5031533b16149afe8d9661768a2c1ae0c5a/actipy-3.0.6-py3-none-any.whl (54 kB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 54.5/54.5 KB 2.3 MB/s eta 0:00:00
ERROR: Could not find a version that satisfies the requirement tqdm<5.0.0,>=4.66.4 (from ngmt) (from versions: none)
ERROR: No matching distribution found for tqdm<5.0.0,>=4.66.4

It seems that I am not able to install ngmt from the Test PyPI repository. @JuliusWelzel do you have any suggestion?

Otherwise, to mitigate this, I will publish my current branch (fetch-mobilised-data) and after you have updated fetching the data for keepcontrol, we can check how it works? (Or publish a version 0.0.5 to PyPI for testing, and if it works, publish as 1.0.0

# Switch to the desired branch
git checkout fetch-mobilised-data

# Configure the Test PyPI repository
poetry config repositories.testpypi https://test.pypi.org/legacy/

# Optionally, set the Test PyPI token
poetry config pypi-token.testpypi <your-test-pypi-token>

# Build the package
poetry build

# Publish the package to Test PyPI
poetry publish -r testpypi
rmndrs89 commented 3 months ago

With the new way of fetching datasets, and the upgrade to KielMAT 0.0.5, this issue can be closed :)