py4dstem / py4DSTEM

GNU General Public License v3.0
204 stars 141 forks source link

Error using read_data #1

Closed jreadey closed 3 years ago

jreadey commented 5 years ago

Hi, I wanted to try out the package, but it looks like I'm not able to open a file.

I tried this:

from py4DSTEM import read_data
cube = read_data("stack2_60x60+30nmss.h5")

But I'm getting this error:

$ python py4dstem_try.py
Traceback (most recent call last):
  File "py4dstem_try.py", line 1, in <module>
    from py4DSTEM import read_data
  File "/Users/jreadey/anaconda3/envs/4dstem/lib/python3.6/site-packages/py4DSTEM-0.1-py3.6.egg/py4DSTEM/__init__.py", line 1, in <module>
    from . import process
  File "/Users/jreadey/anaconda3/envs/4dstem/lib/python3.6/site-packages/py4DSTEM-0.1-py3.6.egg/py4DSTEM/process/__init__.py", line 1, in <module>
    from .log import *
  File "/Users/jreadey/anaconda3/envs/4dstem/lib/python3.6/site-packages/py4DSTEM-0.1-py3.6.egg/py4DSTEM/process/log.py", line 10, in <module>
    exec(open(pwd+'/../../version.py').read())
FileNotFoundError: [Errno 2] No such file or directory: '/Users/jreadey/anaconda3/envs/4dstem/lib/python3.6/site-packages/py4DSTEM-0.1-py3.6.egg/py4DSTEM/process/../../version.py'
(4dstem) Johns-MBP:gists jreadey$ cat py4dstem_try.py
from py4DSTEM import read_data
cube = read_data("stack2_60x60+30nmss.h5")

Any idea what's up with this?

bsavitzky commented 5 years ago

Hey John, looks like py4DSTEM can't find the version file. From the path in your error message, the quickest thing would be to add a file named version.py with a single line:

version=0.1

in the directory

/Users/jreadey/anaconda3/envs/4dstem/lib/python3.6/site-packages/py4DSTEM-0.1-py3.6.egg/

I'll take care of this bug soon, but for the moment, I think if you add that file on your system you should be good to go. Feel free to let me know if there are any issues, and thanks for checking out the code!

Ben

On Sun, Oct 28, 2018 at 2:17 PM John Readey notifications@github.com wrote:

Hi, I wanted to try out the package, but it looks like I'm not able to open a file.

I tried this:

from py4DSTEM import read_data cube = read_data("stack2_60x60+30nmss.h5")

But I'm getting this error:

$ python py4dstem_try.py Traceback (most recent call last): File "py4dstem_try.py", line 1, in from py4DSTEM import read_data File "/Users/jreadey/anaconda3/envs/4dstem/lib/python3.6/site-packages/py4DSTEM-0.1-py3.6.egg/py4DSTEM/init.py", line 1, in from . import process File "/Users/jreadey/anaconda3/envs/4dstem/lib/python3.6/site-packages/py4DSTEM-0.1-py3.6.egg/py4DSTEM/process/init.py", line 1, in from .log import * File "/Users/jreadey/anaconda3/envs/4dstem/lib/python3.6/site-packages/py4DSTEM-0.1-py3.6.egg/py4DSTEM/process/log.py", line 10, in exec(open(pwd+'/../../version.py').read()) FileNotFoundError: [Errno 2] No such file or directory: '/Users/jreadey/anaconda3/envs/4dstem/lib/python3.6/site-packages/py4DSTEM-0.1-py3.6.egg/py4DSTEM/process/../../version.py' (4dstem) Johns-MBP:gists jreadey$ cat py4dstem_try.py from py4DSTEM import read_data cube = read_data("stack2_60x60+30nmss.h5")

Any idea what's up with this?

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/bsavitzky/py4DSTEM/issues/1, or mute the thread https://github.com/notifications/unsubscribe-auth/AGGMNQy3bkkxr5uQoF3ZT3ZJunGiurAEks5uph7UgaJpZM4X-MGH .

jreadey commented 5 years ago

Yes, that seems to fix it. Though I had to use pythonw rather than python (see this Matplotlib FAQ: https://matplotlib.org/faq/osx_framework.html).

Emboldened, I tried the runGUI.py script, but got a crash:

$ pythonw runGUI.py
WARNING:hyperspy_gui_traitsui:The MacOSX matplotlib backend is not supported by the installed traitsui version and the ETS toolkit has been set to null. To set the ETS toolkit independently from the matplotlib backend, set it before importing matplotlib. See http://hyperspy.readthedocs.io/en/stable/user_guide/getting_started.html for more information.
WARNING:hyperspy_gui_traitsui:The traitsui GUI elements are not available.
QWidget: Must construct a QApplication before a QWidget
/Users/jreadey/anaconda3/envs/4dstem/bin/pythonw: line 3:  5396 Abort trap: 6           /Users/jreadey/anaconda3/envs/4dstem/python.app/Contents/MacOS/python "$@"

The Mac + matplotlib + Qt + Conda combination is a bit funky I know -- it would be useful to document what users on this platform need have setup to get started.

bsavitzky commented 5 years ago

Thanks John. The GUI is definitely still in need of some work to keep it functional across various environments, and this particular bug is one I hadn't seen yet - very good to know. While my focus this week is on some lower level functionality, making sure the GUI is robust is very important, and as you say, this includes some clear documentation. All this coming soon! Thanks for the input :)

Ben

On Mon, Oct 29, 2018 at 12:52 PM John Readey notifications@github.com wrote:

Yes, that seems to fix it. Though I had to use pythonw rather than python (see this Matplotlib FAQ: https://matplotlib.org/faq/osx_framework.html).

Emboldened, I tried the runGUI.py script, but got a crash:

$ pythonw runGUI.py WARNING:hyperspy_gui_traitsui:The MacOSX matplotlib backend is not supported by the installed traitsui version and the ETS toolkit has been set to null. To set the ETS toolkit independently from the matplotlib backend, set it before importing matplotlib. See http://hyperspy.readthedocs.io/en/stable/user_guide/getting_started.html for more information. WARNING:hyperspy_gui_traitsui:The traitsui GUI elements are not available. QWidget: Must construct a QApplication before a QWidget /Users/jreadey/anaconda3/envs/4dstem/bin/pythonw: line 3: 5396 Abort trap: 6 /Users/jreadey/anaconda3/envs/4dstem/python.app/Contents/MacOS/python "$@"

The Mac + matplotlib + Qt + Conda combination is a bit funky I know -- it would be useful to document what users on this platform need have setup to get started.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/bsavitzky/py4DSTEM/issues/1#issuecomment-434054833, or mute the thread https://github.com/notifications/unsubscribe-auth/AGGMNcw6dO06l7td2zDk8vSrVWSK8iF5ks5up1yYgaJpZM4X-MGH .

reiszadeh commented 5 years ago

Hi. I am a new user. when I want to load my output file I encounter with this error: '/home/sevin/software/4dstem/barium.h5' Loading file /home/sevin/software/4dstem/barium.h5 /home/sevin/software/4dstem/barium.h5 is a py4DSTEM file, v0.5. Reading... (224, 128, 8) Traceback (most recent call last): File "/home/sevin/software/py4DSTEM/py4DSTEM/gui/viewer.py", line 317, in update_scan_shape_Nx self.settings.R_Ny.update_value(int(self.datacube.R_N/R_Nx)) AttributeError: 'RealSlice' object has no attribute 'R_N' Aborted (core dumped) would you please help me. by the way, Is there any manual of this code

reiszadeh commented 5 years ago

my input file is: --algorithm:m --num-threads:12 --pixel-size-x:0.1 --pixel-size-y:0.1 --potential-bound:2 --num-FP:1 --slice-thickness:1 --num-slices:0 --zstart-slices:0 --energy:100 --alpha-max:50 --batch-size-cpu:1 --probe-step-x:0.20 --probe-step-y:0.20 --cell-dimension:22.347900 12.202100 7.695500 --tile-uc:1 1 1 --probe-defocus:0.3000 -C3:0 -C5:0 --probe-semiangle:32 --detector-angle-step:2 --probe-xtilt:0 --probe-ytilt:0 --scan-window-x:0 0.99999 --scan-window-y:0 0.99999 --scan-window-xr:0 0 --scan-window-yr:0 0 --random-seed:74399 --thermal-effects:1 --save-3D-output:1 --save-4D-output:0 --save-potential-slices:1 --save-real-space-coords:0 --occupancy:1 --nyquist-sampling:0 --also-do-cpu-work:1 --batch-size-gpu:1 --num-gpus:4 --num-streams:8

yc9690 commented 4 years ago

Hi, i use "read" function to read a hdf5 file. The error is my.hdf5 is not a py4DSTEM file. How can i transfer my.hdf5 file to a a py4DSTEM file. Thank you very much.