From 6e05b66401445500f700168a0d22240408e716dd Mon Sep 17 00:00:00 2001 From: Alex Ganose Date: Wed, 11 Oct 2023 11:50:58 +0100 Subject: [PATCH] Fixes from #216 --- setup.py | 2 +- sumo/cli/bandplot.py | 14 ++++---------- sumo/cli/dosplot.py | 18 +++++------------- sumo/plotting/__init__.py | 14 +++++--------- sumo/symmetry/brad_crack_kpath.py | 2 +- 5 files changed, 16 insertions(+), 34 deletions(-) diff --git a/setup.py b/setup.py index bf2db4b4..2053086b 100644 --- a/setup.py +++ b/setup.py @@ -38,7 +38,7 @@ "h5py", "pymatgen>=2020.10.20", "phonopy>=2.1.3", - "matplotlib", + "matplotlib>=3.2.0", "seekpath", "castepxbin<1.0", "colormath", diff --git a/sumo/cli/bandplot.py b/sumo/cli/bandplot.py index 0a1e07f3..ee6483c8 100644 --- a/sumo/cli/bandplot.py +++ b/sumo/cli/bandplot.py @@ -762,24 +762,20 @@ def _get_parser(): "--orbitals", type=_el_orb, metavar="O", - help=( - "orbitals to split into lm-decomposed " - 'contributions (e.g. "Ru.d")' - ), + help="orbitals to split into lm-decomposed contributions (e.g. 'Ru.d')", ) parser.add_argument( "--atoms", type=_atoms, metavar="A", - help=('atoms to include (e.g. "O.1.2.3,Ru.1.2.3")'), + help='atoms to include (e.g. "O.1.2.3,Ru.1.2.3")', ) parser.add_argument( "--spin", type=str, default=None, help=( - "select only one spin channel for a " - "spin-polarised calculation " + "select only one spin channel for a spin-polarised calculation " "(options: up, 1; down, -1)" ), ) @@ -883,9 +879,7 @@ def main(): logging.getLogger("").addHandler(console) if args.config is None: - config_path = os.path.join( - ilr_files("sumo.plotting"), "orbital_colours.conf" - ) + config_path = ilr_files("sumo.plotting") / "orbital_colours.conf" else: config_path = args.config colours = configparser.ConfigParser() diff --git a/sumo/cli/dosplot.py b/sumo/cli/dosplot.py index f9c6d7f1..c062fa3d 100644 --- a/sumo/cli/dosplot.py +++ b/sumo/cli/dosplot.py @@ -441,9 +441,7 @@ def _get_parser(): "--code", default="vasp", metavar="C", - help=( - 'Input file format: "vasp" (vasprun.xml) or ' '"questaal" (opt.ext)' - ), + help='Input file format: "vasp" (vasprun.xml) or "questaal" (opt.ext)', ) parser.add_argument( "-p", "--prefix", metavar="P", help="prefix for the files generated" @@ -463,25 +461,21 @@ def _get_parser(): "--orbitals", type=_el_orb, metavar="O", - help=( - "orbitals to split into lm-decomposed " - 'contributions (e.g. "Ru.d")' - ), + help="orbitals to split into lm-decomposed contributions (e.g. 'Ru.d')", ) parser.add_argument( "-a", "--atoms", type=_atoms, metavar="A", - help=('atoms to include (e.g. "O.1.2.3,Ru.1.2.3")'), + help='atoms to include (e.g. "O.1.2.3,Ru.1.2.3")', ) parser.add_argument( "--spin", type=str, default=None, help=( - "select one spin channel only for a " - "spin-polarised calculation " + "select one spin channel only for a spin-polarised calculation " "(options: up, 1; down, -1)" ), ) @@ -634,9 +628,7 @@ def main(): logging.getLogger("").addHandler(console) if args.config is None: - config_path = os.path.join( - ilr_files("sumo.plotting"), "orbital_colours.conf" - ) + config_path = ilr_files("sumo.plotting") / "orbital_colours.conf" else: config_path = args.config colours = configparser.ConfigParser() diff --git a/sumo/plotting/__init__.py b/sumo/plotting/__init__.py index 3260e35a..da02928b 100644 --- a/sumo/plotting/__init__.py +++ b/sumo/plotting/__init__.py @@ -19,15 +19,11 @@ colour_cache = {} -sumo_base_style = os.path.join(ilr_files("sumo.plotting"), "sumo_base.mplstyle") -sumo_dos_style = os.path.join(ilr_files("sumo.plotting"), "sumo_dos.mplstyle") -sumo_bs_style = os.path.join(ilr_files("sumo.plotting"), "sumo_bs.mplstyle") -sumo_phonon_style = os.path.join( - ilr_files("sumo.plotting"), "sumo_phonon.mplstyle" -) -sumo_optics_style = os.path.join( - ilr_files("sumo.plotting"), "sumo_optics.mplstyle" -) +sumo_base_style = ilr_files("sumo.plotting") / "sumo_base.mplstyle" +sumo_dos_style = ilr_files("sumo.plotting") / "sumo_dos.mplstyle" +sumo_bs_style = ilr_files("sumo.plotting") / "sumo_bs.mplstyle" +sumo_phonon_style = ilr_files("sumo.plotting") / "sumo_phonon.mplstyle" +sumo_optics_style = ilr_files("sumo.plotting") / "sumo_optics.mplstyle" def styled_plot(*style_sheets): diff --git a/sumo/symmetry/brad_crack_kpath.py b/sumo/symmetry/brad_crack_kpath.py index b3349c95..98e32339 100644 --- a/sumo/symmetry/brad_crack_kpath.py +++ b/sumo/symmetry/brad_crack_kpath.py @@ -85,7 +85,7 @@ def _get_bradcrack_data(bravais): 'path': [['\Gamma', 'X', ..., 'P'], ['H', 'N', ...]]} """ - json_file = os.path.join(ilr_files("sumo.symmetry"), "bradcrack.json") + json_file = ilr_files("sumo.symmetry") / "bradcrack.json" with open(json_file) as f: bradcrack_data = load_json(f) return bradcrack_data[bravais]