py4dstem/py4D-browser

Check py4D-browser file main_actions.py

Closed this issue · 4 comments

Following code is imcompatible with py4DSTEM version 14

from py4DSTEM.io.parsefiletype import _parse_filetype

gives errors. This code below fixes the import issues with .dm4 files.

from py4DSTEM.io.utils import parse_filetype
    if parse_filetype(filepath) == "H5":

please check/fix

sezelt commented

What version of the browser do you have installed? Updating to v0.99 should fix compatibility with py4DSTEM 0.14.x

I originally installed from the dev branch today using:

`git clone https://github.com/sezelt/py4D-browser.git`
pip install -e . 

which gives version 0.99.

I removed the dev version in my repos folder, ran pip uninstall py4d-browser to make sure it was removed and then re-installed using pip install py4D-browser --upgrade which gave version 0.99. The same error arises in the new version installed with pip:

  File "/opt/anaconda3/envs/py4dgui/lib/python3.11/site-packages/py4D_browser/menu_actions.py", line 25, in load_file
    from py4DSTEM.io.parsefiletype import _parse_filetype

So I just modify the source code from:

    from py4DSTEM.io.parsefiletype import _parse_filetype
    if _parse_filetype(filepath) == "H5":

to read:


    from py4DSTEM.io.utils import parse_filetype
    if parse_filetype(filepath) == "H5":

and it solves the data loading problem again. Hence I have to modify the source code using either pip or git. Can you please check the pip and dev branches for the latest version? This is on a mac.

sezelt commented

Are you sure that the environment you've installed into has py4DSTEM v0.14? I just tested on my Mac:

conda create -n py4dtest -c conda-forge py4dstem
conda activate py4dtest
pip install py4D-browser

which works correctly.

The module in py4DSTEM was called parse_filetype in versions v0.13 and earlier, and was renamed to parsefiletype in v0.14.