From 9f771c090f79a98abc19fb7c00b497af5630ad6e Mon Sep 17 00:00:00 2001 From: Ryuichi Arafune Date: Wed, 24 Apr 2024 19:13:21 +0900 Subject: [PATCH] =?UTF-8?q?=F0=9F=94=A7=20=20Update=20pyproject.toml?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pyproject.toml | 27 ++++++++++++++++++++++++++- src/arpes/analysis/moire.py | 18 ++++++++++++++---- src/arpes/utilities/region.py | 6 +++++- src/arpes/xarray_extensions.py | 6 +++++- 4 files changed, 50 insertions(+), 7 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index 519b304e..81348675 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -77,11 +77,36 @@ omit = [ exclude_lines = ["raise NotImplementedError", "pragma: no cover"] [tool.pyright] -typeCheckingMode = "off" +exclude = [ + "**/ALG_spin_TOF.py", + "**/fits_utils.py", + "**/Elettra_spectromicroscopy.py", + "**ALG_main.py", + "ANTARES.py", + "**/MAESTRO.py", + "**/BL10_SARPES.py", + "**/SSRF_NSRL.py", + "**/MGS.py", + "**/kaindl.py", + "**/merlin.py", + # + "**/fit_tool", + "**/qt_tool", + "**/qt_ktool", + "**/bz_tool", + "**/basic_tools", + "**/dynamic_tool.py", + "**/qt/", +] + +typeCheckingMode = "standard" # "off", "basic" "standard" "strict" +include = ["src"] pythonVersion = "3.11" pythonPlatform = "All" +reportMissingTypeStubs = false + [tool.ruff] lint.ignore = [ "PD", # pandas-vet diff --git a/src/arpes/analysis/moire.py b/src/arpes/analysis/moire.py index 126d05a0..93b99eb8 100644 --- a/src/arpes/analysis/moire.py +++ b/src/arpes/analysis/moire.py @@ -12,6 +12,7 @@ import matplotlib.pyplot as plt import numpy as np +from ase.cell import Cell from ase.dft.bz import bz_plot from ase.lattice import HEX2D from scipy.spatial.distance import pdist @@ -21,7 +22,6 @@ if TYPE_CHECKING: from collections.abc import Generator - from ase.cell import Cell from matplotlib.axes import Axes from numpy.typing import NDArray @@ -129,7 +129,17 @@ def calc_commensurate_moire_cell( *, swap_angle: bool = False, ) -> dict[str, Any]: - """Calculates nearly commensurate moire unit cells for two hexagonal lattices.""" + """Calculates nearly commensurate moire unit cells for two hexagonal lattices. + + Args: + underlayer_a: [TODO:description] + overlayer_a: [TODO:description] + relative_angle_rad: [TODO:description] + swap_angle: [TODO:description] + + Returns: + [TODO:description] + """ from ase.dft.bz import bz_vertices from ase.dft.kpoints import get_special_points @@ -151,8 +161,8 @@ def calc_commensurate_moire_cell( if swap_angle: moire_angle = -moire_angle - moire_cell = HEX2D(float(moire_a)) - moire_cell = Rotation.from_rotvec([0, 0, moire_angle]).apply(moire_cell) + moire_cell = HEX2D(float(moire_a)).tocell() + moire_cell = Cell(Rotation.from_rotvec([0, 0, moire_angle]).apply(moire_cell)) moire_icell = moire_cell.reciprocal() moire_bz_points = bz_vertices(moire_icell)[0][0][:, :2] diff --git a/src/arpes/utilities/region.py b/src/arpes/utilities/region.py index 0b42dd13..b3010b56 100644 --- a/src/arpes/utilities/region.py +++ b/src/arpes/utilities/region.py @@ -3,6 +3,7 @@ from __future__ import annotations from enum import Enum +from typing import Literal __all__ = ["REGIONS", "normalize_region", "DesignatedRegions"] @@ -43,7 +44,10 @@ class DesignatedRegions(Enum): } -def normalize_region(region: str | dict) -> dict[str, DesignatedRegions]: +def normalize_region( + region: Literal["copper_prior", "wide_angular", "narrow_angular"] + | dict[str, DesignatedRegions], +) -> dict[str, DesignatedRegions]: """Converts named regions to an actual region.""" if isinstance(region, str): return REGIONS[region] diff --git a/src/arpes/xarray_extensions.py b/src/arpes/xarray_extensions.py index c17c31a8..72245b6e 100644 --- a/src/arpes/xarray_extensions.py +++ b/src/arpes/xarray_extensions.py @@ -1119,7 +1119,11 @@ def meso_effective_selector(self) -> slice: energy_edge = self.find_spectrum_energy_edges() return slice(np.max(energy_edge) - 0.3, np.max(energy_edge) - 0.1) - def region_sel(self, *regions: Incomplete) -> XrTypes: + def region_sel( + self, + *regions: Literal["copper_prior", "wide_angular", "narrow_angular"] + | dict[str, DesignatedRegions], + ) -> XrTypes: def process_region_selector( selector: slice | DesignatedRegions, dimension_name: str,