chstan / arpes

Mirror of PyARPES (gitlab/lanzara-group/python-arpes) the open source ARPES analysis framework
https://arpes.readthedocs.io
Other
38 stars 25 forks source link

Import error in BZ plotting example #7

Closed abtully closed 2 years ago

abtully commented 2 years ago

I was trying to replicate the example you posted in the BZ plotting section of your docs (https://arpes.readthedocs.io/en/latest/brillouin-zones.html). I installed the package through conda and installed ase through conda as well. When I try to run

from arpes.plotting.bz import bz_plot, plot_data_to_bz
from arpes.utilities.bz import hex_cell_2d
import matplotlib.pyplot as plt
fig, ax = plt.subplots(1)
bz_plot(cell=hex_cell_2d(a=1), paths='GK', linewidth=2, repeat=(2,2), ax=ax)

I get the following error:

---------------------------------------------------------------------------
ImportError                               Traceback (most recent call last)
~\AppData\Local\Temp/ipykernel_18880/827038396.py in <module>
      1 fig, ax = plt.subplots(1)
----> 2 bz_plot(cell=hex_cell_2d(a=1), paths='GK', linewidth=2, repeat=(2,2), ax=ax)

~\anaconda3\envs\ARPES\lib\site-packages\arpes\plotting\bz.py in bz_plot(cell, *args, **kwargs)
    266         return bz3d_plot(cell, *args, **kwargs)
    267 
--> 268     return bz2d_plot(cell, *args, **kwargs)
    269 
    270 

~\anaconda3\envs\ARPES\lib\site-packages\arpes\plotting\bz.py in bz2d_plot(cell, vectors, paths, points, repeat, ax, transformations, offset, hide_ax, set_equal_aspect, **kwargs)
    605 
    606     if isinstance(paths, str):
--> 607         from ase.dft.kpoints import (
    608             get_special_points,
    609             special_paths,

ImportError: cannot import name 'crystal_structure_from_cell' from 'ase.dft.kpoints'

Any help would be much appreciated! And thanks for creating what appears to be such an awesome package.

chstan commented 2 years ago

Hi @abtully,

Offhand, this looks like a version discrepancy relative to ase. I'll have a look at it this week and try to pin the version appropriately. In the meantime, you should probably be able to get around this by downgrading ase. If memory serves, when I added this functionality they may have been on 3.17.

Best, Conrad

abtully commented 2 years ago

Hi @chstan,

Downgrading to ase version 3.17 worked! Thank you so much for the prompt and helpful response -- I really appreciate it.

Best, Alexandra

chstan commented 2 years ago

Hi @abtully,

No worries at all. I'm glad it as straightforward as a version change. Also, thank you for confirming the working ase dependency. I'll look at how to adjust this so that it works with newer versions of ase at some point, but for now I've pinned the dependency to the working version series.

Good luck in your research.

Best, Conrad