hed-standard / hed-examples

Example Python, Matlab, and Jupyter notebook code using HED (Hierarchical Event Descriptors). Includes BIDS-compatible test datasets.
https://www.hed-resources.org/en/latest/
MIT License
2 stars 8 forks source link

Comments on HED MATLAB tools documentation #207

Open dungscout96 opened 1 year ago

dungscout96 commented 1 year ago

Some comments/issues as I tried out the HED MATLAB Python tools tutorial:

Error in validateHedInBids (line 12) bids = py.hed.tools.BidsDataset(dataPath);

Error in testScript (line 4) issueString = validateHedInBids(dataPath);

VisLab commented 1 year ago

Thanks for trying ---

* In Step 4, we should instruct users on how to find which pip is associated with their python.
  On MacOS, `python -m pip --version` will give the path to the library. `which pip` supposed to point to pip executable of the python environment the terminal is in

Good idea.

* Typo in Step 4: `system('"C:\Program Files\Python39\Scripts\pip" install hedtools')` has extra double quote

The extra double quotes is required in Windows because of the blank in the directory name. Did it give an error on the MAC?

* `pyrun` was only introduced in MATLAB 2021b, so minimum MATLAB version required would be 2021b

Notice that the wrappers don't use pyrun at all, they call the Python directly.

* python < 3.10 no longer has installer for MacOS. Users would have to install from source, which is difficult. I tried using Python installed via Anaconda and it seemed to work. We might want to add this to the instruction.

@dungscout96 @monique2208 could you collaborate and come up with a paragraph on this for Step 1 and possibly later steps.

* The command at the end of Step 4 doesn't work:
  `pyrun("from hed import _version as vr; print(f'Using HEDTOOLS version: {str(vr.get_versions())}')")`
  Module `_version` was not found, I tried `version` as well but also didn't work

This indicates that the hedtools library was not actually loaded. Did you find it on your system? Was it in the correct place for the Python that MATLAB was using?

* I tried out the example MATLAB wrapper function for HED Python tools and received error:

This also indicates that hedtools was not loaded.

Unable to resolve the name 'py.hed.tools.BidsDataset'.

Error in validateHedInBids (line 12)
    bids = py.hed.tools.BidsDataset(dataPath);

Error in testScript (line 4)
issueString = validateHedInBids(dataPath);

This also indicates that the hedtools was not properly loaded or loaded in the wrong place (that wasn't associated with the Python that was connected to MATLAB).

VisLab commented 1 year ago
  • In Step 4, we should instruct users on how to find which pip is associated with their python. On MacOS, python -m pip --version will give the path to the library. which pip supposed to point to pip executable of the python environment the terminal is in

I think this might give the pip that is in the system path which is not necessarily the same as the one associated with the Python that MATLAB is using.