mad-lab-fau / BioPsyKit

A Python package for the analysis of biopsychological data.
MIT License
39 stars 8 forks source link

[JOSS review] Get example datasets in README error #10

Closed zen-juen closed 2 years ago

zen-juen commented 2 years ago

Hi there, after installing biopsykit with ease, I've encountered some errors when running the examples listed on the readme, particularly those that are related to retrieving example datasets:

import biopsykit as bp
from biopsykit.example_data import get_saliva_example

saliva_data = get_saliva_example(sample_times=[-20, 0, 10, 20, 30, 40, 50])

I get an error like so:


  File "c:\users\zen juen\downloads\wpy64-3850\python-3.8.5.amd64\lib\site-packages\pandas\io\parsers.py", line 1862, in __init__
    self._open_handles(src, kwds)

  File "c:\users\zen juen\downloads\wpy64-3850\python-3.8.5.amd64\lib\site-packages\pandas\io\parsers.py", line 1357, in _open_handles
    self.handles = get_handle(

  File "c:\users\zen juen\downloads\wpy64-3850\python-3.8.5.amd64\lib\site-packages\pandas\io\common.py", line 642, in get_handle
    handle = open(

FileNotFoundError: [Errno 2] No such file or directory: 'c:\\users\\zen juen\\downloads\\wpy64-3850\\python-3.8.5.amd64\\lib\\example_data\\cortisol_sample.csv'

This also happens for get_sleep_imu_example(), get_questionnaire_example() and get_mist_hr_example(). Might this be to do with the way functions are setting the data path?

(Note: as part of https://github.com/openjournals/joss-reviews/issues/3702)

espenhgn commented 2 years ago

Interestingly, the get_saliva_example code works on my end, but not the TSST and get_questionnaire_example examples of the README.

richrobe commented 2 years ago

Thank you for pointing that out! We assume this is due to the fact that the example data is not included in the package when installing it from PyPi.

We will update our code so that it will first check whether the package was installed manually, by cloning the git repository, then all example data should be downloaded and the examples should work correctly, or via PyPi. In the latter case the example data is not contained and we will download the example data similar to how scikit-learn is handling this (see https://github.com/scikit-learn/scikit-learn/blob/844b4be24/sklearn/datasets/_base.py).

We also updated the minimal working examples in the README, which still contained some bugs, in 6935600009cbc143ef4fd750211c249b9ba09d1e.

richrobe commented 2 years ago

We added the feature of automatically downloading example data if not available yet in 252f33c1dfdaf43877be2135e87cc429852f718d.

zen-juen commented 2 years ago

Hi @richrobe that's great! I think this new version is not yet updated on PyPI though, so I can't review the changes as of now

richrobe commented 2 years ago

Hi @zen-juen, now that this is resolved, I'm closing this issue if that's okay?