Skip to content

Commit

Permalink
Merge pull request #315 from naik-aakash/move_to_src_layout
Browse files Browse the repository at this point in the history
Move to src layout
  • Loading branch information
JaGeo authored Jul 29, 2024
2 parents 20e7899 + 52dd5c7 commit c17d2f4
Show file tree
Hide file tree
Showing 23 changed files with 2,742 additions and 2,749 deletions.
5 changes: 3 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,9 @@ requires = [
build-backend = "setuptools.build_meta"

[tool.setuptools.packages.find]
where = ["src"]
include = ["lobsterpy*"]
exclude = ["docs*", "tests*", "paper*"]
#exclude = ["docs*", "tests*", "paper*"]

[project]
name = "lobsterpy"
Expand Down Expand Up @@ -165,7 +166,7 @@ exclude_lines = [
]

[tool.coverage.run]
include = ["lobsterpy/*"]
include = ["src/"]
omit = [
# omit anything in test directory anywhere
"tests/*",
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
3,464 changes: 1,732 additions & 1,732 deletions lobsterpy/cohp/analyze.py → src/lobsterpy/cohp/analyze.py

Large diffs are not rendered by default.

1,714 changes: 857 additions & 857 deletions lobsterpy/cohp/describe.py → src/lobsterpy/cohp/describe.py

Large diffs are not rendered by default.

File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,141 +1,141 @@
"""
Dictionaries for plotly figure layouts.
Layout inspired by
https://github.com/materialsproject/crystaltoolkit/blob/main/crystal_toolkit/components/bandstructure.py
Contains dicts for
1. general figure layout
2. axes ((I)COHP / energy)
3. traces (Spin.up / Spin.down)
4. legend
"""

layout_dict = {
"titlefont": {"size": 18},
"showlegend": True,
"title_x": 0.1,
"title_y": 0.9,
"hovermode": "closest",
"paper_bgcolor": "rgba(0,0,0,0)",
"plot_bgcolor": "rgba(0,0,0,0)",
}

"""
General layout of Plotly figure.
:param dict titlefont: Line style dictionary.
:param bool showlegend: Legend hide or show.
:param float title_x: x axis title size.
:param float title_y: y axis title size.
:param str hovermode: hover behaviour.
:param str paper_bgcolor: background color.
:param str plot_bgcolor: plot background color.
"""

cohp_axis_style_dict = {
"titlefont": {"size": 20},
"tickfont": {"size": 16},
"ticks": "inside",
"tickwidth": 2,
"showgrid": False,
"showline": True,
"zeroline": True,
"zerolinecolor": "black",
"zerolinewidth": 3,
"mirror": True,
"linewidth": 2,
"linecolor": "black",
}

"""
COXX axis style.
:param dict titlefont: axis title font style.
:param dict tickfont: axis tick font style.
:param str ticks: ticks style.
:param float tickwidth: width of ticks.
:param bool showgrid: show or hide axis grid.
:param bool showline: show or hide axis.
:param bool zeroline: show or hide zero line.
:param str zerolinecolor: color of zero line.
:param float zerolinewidth: width of zero line.
:param bool mirror: mirror axis.
:param float linewidth: width of axis line.
:param str linecolor: color of axis line.
"""

energy_axis_style_dict = {
"titlefont": {"size": 20},
"tickfont": {"size": 16},
"ticks": "inside",
"tickwidth": 2,
"showgrid": False,
"showline": True,
"zeroline": True,
"zerolinecolor": "rgba(0,0,0,0.5)",
"zerolinewidth": 3,
"mirror": True,
"linewidth": 2,
"linecolor": "black",
}

"""
Energy axis style.
:param dict titlefont: axis title font style.
:param dict tickfont: axis tick font style.
:param str ticks: ticks style.
:param float tickwidth: width of ticks.
:param bool showgrid: show or hide axis grid.
:param bool showline: show or hide axis.
:param bool zeroline: show or hide zero line.
:param str zerolinecolor: color of zero line.
:param float zerolinewidth: width of zero line.
:param bool mirror: mirror axis.
:param float linewidth: width of axis line.
:param str linecolor: color of axis line.
"""

spin_up_trace_style_dict = {
"line": {"width": 3},
"mode": "lines",
"visible": "legendonly",
}

"""
Line style for Spin.up traces.
:param dict line: Line style dictionary.
:param str mode: Plotly mode.
:param str visible: Trace visibility.
"""

spin_down_trace_style_dict = {
"line": {"width": 3, "dash": "dash"},
"mode": "lines",
"visible": "legendonly",
}

"""
Line style for Spin.down traces.
:param dict line: Line style dictionary.
:param str mode: Plotly mode.
:param str visible: Trace visibility.
"""

legend_style_dict = {
"bordercolor": "black",
"borderwidth": 2,
"traceorder": "normal",
}

"""
Legend style.
:param str bordercolor: border color of legend.
:param int borderwidth: width of border.
:param str traceorder: order of trace.
"""
"""
Dictionaries for plotly figure layouts.
Layout inspired by
https://github.com/materialsproject/crystaltoolkit/blob/main/crystal_toolkit/components/bandstructure.py
Contains dicts for
1. general figure layout
2. axes ((I)COHP / energy)
3. traces (Spin.up / Spin.down)
4. legend
"""

layout_dict = {
"titlefont": {"size": 18},
"showlegend": True,
"title_x": 0.1,
"title_y": 0.9,
"hovermode": "closest",
"paper_bgcolor": "rgba(0,0,0,0)",
"plot_bgcolor": "rgba(0,0,0,0)",
}

"""
General layout of Plotly figure.
:param dict titlefont: Line style dictionary.
:param bool showlegend: Legend hide or show.
:param float title_x: x axis title size.
:param float title_y: y axis title size.
:param str hovermode: hover behaviour.
:param str paper_bgcolor: background color.
:param str plot_bgcolor: plot background color.
"""

cohp_axis_style_dict = {
"titlefont": {"size": 20},
"tickfont": {"size": 16},
"ticks": "inside",
"tickwidth": 2,
"showgrid": False,
"showline": True,
"zeroline": True,
"zerolinecolor": "black",
"zerolinewidth": 3,
"mirror": True,
"linewidth": 2,
"linecolor": "black",
}

"""
COXX axis style.
:param dict titlefont: axis title font style.
:param dict tickfont: axis tick font style.
:param str ticks: ticks style.
:param float tickwidth: width of ticks.
:param bool showgrid: show or hide axis grid.
:param bool showline: show or hide axis.
:param bool zeroline: show or hide zero line.
:param str zerolinecolor: color of zero line.
:param float zerolinewidth: width of zero line.
:param bool mirror: mirror axis.
:param float linewidth: width of axis line.
:param str linecolor: color of axis line.
"""

energy_axis_style_dict = {
"titlefont": {"size": 20},
"tickfont": {"size": 16},
"ticks": "inside",
"tickwidth": 2,
"showgrid": False,
"showline": True,
"zeroline": True,
"zerolinecolor": "rgba(0,0,0,0.5)",
"zerolinewidth": 3,
"mirror": True,
"linewidth": 2,
"linecolor": "black",
}

"""
Energy axis style.
:param dict titlefont: axis title font style.
:param dict tickfont: axis tick font style.
:param str ticks: ticks style.
:param float tickwidth: width of ticks.
:param bool showgrid: show or hide axis grid.
:param bool showline: show or hide axis.
:param bool zeroline: show or hide zero line.
:param str zerolinecolor: color of zero line.
:param float zerolinewidth: width of zero line.
:param bool mirror: mirror axis.
:param float linewidth: width of axis line.
:param str linecolor: color of axis line.
"""

spin_up_trace_style_dict = {
"line": {"width": 3},
"mode": "lines",
"visible": "legendonly",
}

"""
Line style for Spin.up traces.
:param dict line: Line style dictionary.
:param str mode: Plotly mode.
:param str visible: Trace visibility.
"""

spin_down_trace_style_dict = {
"line": {"width": 3, "dash": "dash"},
"mode": "lines",
"visible": "legendonly",
}

"""
Line style for Spin.down traces.
:param dict line: Line style dictionary.
:param str mode: Plotly mode.
:param str visible: Trace visibility.
"""

legend_style_dict = {
"bordercolor": "black",
"borderwidth": 2,
"traceorder": "normal",
}

"""
Legend style.
:param str bordercolor: border color of legend.
:param int borderwidth: width of border.
:param str traceorder: order of trace.
"""
File renamed without changes.
File renamed without changes.
File renamed without changes.
3 changes: 1 addition & 2 deletions tests/cli/test_cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,8 @@
import matplotlib.style
import numpy as np
import pytest
from matplotlib.figure import Figure

from lobsterpy.cli import get_parser, run
from matplotlib.figure import Figure

CurrentDir = Path(__file__).absolute().parent
TestDir = CurrentDir / "../"
Expand Down
3 changes: 1 addition & 2 deletions tests/cohp/test_analyze.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,11 @@
from pathlib import Path

import pytest
from lobsterpy.cohp.analyze import Analysis
from pymatgen.core import Structure
from pymatgen.io.lobster import Bandoverlaps, Charge, Doscar, Lobsterin, Lobsterout
from pymatgen.io.vasp import Vasprun

from lobsterpy.cohp.analyze import Analysis

CurrentDir = Path(__file__).absolute().parent
TestDir = CurrentDir / "../"

Expand Down
5 changes: 2 additions & 3 deletions tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,10 @@
from pathlib import Path

import pytest
from pymatgen.electronic_structure.cohp import CompleteCohp
from pymatgen.io.lobster import Charge, Doscar, Icohplist

from lobsterpy.cohp.analyze import Analysis
from lobsterpy.cohp.describe import Description
from pymatgen.electronic_structure.cohp import CompleteCohp
from pymatgen.io.lobster import Charge, Doscar, Icohplist

TestDir = Path(__file__).absolute().parent

Expand Down
3 changes: 1 addition & 2 deletions tests/featurize/test_batch.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,14 @@

import pandas as pd
import pytest
from pymatgen.analysis.graphs import StructureGraph

from lobsterpy.featurize.batch import (
BatchCoxxFingerprint,
BatchDosFeaturizer,
BatchStructureGraphs,
BatchSummaryFeaturizer,
)
from lobsterpy.featurize.core import CoxxFingerprint, DosFingerprint
from pymatgen.analysis.graphs import StructureGraph

CurrentDir = Path(__file__).absolute().parent
TestDir = CurrentDir / "../"
Expand Down
1 change: 0 additions & 1 deletion tests/featurize/test_core.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
import numpy as np
import pandas as pd
import pytest

from lobsterpy.featurize.core import (
DosFingerprint,
FeaturizeCharges,
Expand Down
3 changes: 1 addition & 2 deletions tests/featurize/test_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,8 @@
import shutil
from pathlib import Path

from pymatgen.core import Structure

from lobsterpy.featurize import get_file_paths, get_structure_path
from pymatgen.core import Structure

CurrentDir = Path(__file__).absolute().parent
TestDir = CurrentDir / "../"
Expand Down
7 changes: 3 additions & 4 deletions tests/plotting/test_plotting.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,16 @@

import numpy as np
import pytest
from plotly.io import read_json
from pymatgen.electronic_structure.cohp import Cohp
from pymatgen.electronic_structure.core import Spin

from lobsterpy.cohp.describe import Description
from lobsterpy.plotting import (
IcohpDistancePlotter,
InteractiveCohpPlotter,
PlainCohpPlotter,
PlainDosPlotter,
)
from plotly.io import read_json
from pymatgen.electronic_structure.cohp import Cohp
from pymatgen.electronic_structure.core import Spin

CurrentDir = Path(__file__).absolute().parent
TestDir = CurrentDir / "../"
Expand Down
Loading

0 comments on commit c17d2f4

Please sign in to comment.