From b7e7250856de7ad3f13b9028410a9d3f07f0d9bf Mon Sep 17 00:00:00 2001 From: Ryuichi Arafune Date: Fri, 12 Jan 2024 19:19:09 +0900 Subject: [PATCH] =?UTF-8?q?=F0=9F=92=84=20=20Reduing=20the=20number=20of?= =?UTF-8?q?=20args=20by=20using=20tuple.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- arpes/plotting/annotations.py | 6 +----- arpes/simulation.py | 28 +++++++++++----------------- 2 files changed, 12 insertions(+), 22 deletions(-) diff --git a/arpes/plotting/annotations.py b/arpes/plotting/annotations.py index 3d0e3d70..88d55a9c 100644 --- a/arpes/plotting/annotations.py +++ b/arpes/plotting/annotations.py @@ -16,7 +16,6 @@ if TYPE_CHECKING: from collections.abc import Sequence - from _typeshed import Incomplete from numpy.typing import NDArray from arpes._typing import DataType, ExperimentalConditions, MPLTextParam @@ -155,7 +154,7 @@ def annotate_cuts( plotted_axes: NDArray[np.object_], *, include_text_labels: bool = False, - **kwargs: Incomplete, + **kwargs: tuple | list | NDArray, ) -> None: """Annotates a cut location onto a plot. @@ -174,9 +173,6 @@ def annotate_cuts( assert len(plotted_axes) == TWODimensional for k, v in kwargs.items(): - if not isinstance(v, tuple | list | np.ndarray): - v = [v] - selected = converted_coordinates.sel(**dict([[k, v]]), method="nearest") for coords_dict, obj in selected.G.iterate_axis(k): diff --git a/arpes/simulation.py b/arpes/simulation.py index e2e5e7ae..86bab423 100644 --- a/arpes/simulation.py +++ b/arpes/simulation.py @@ -177,9 +177,9 @@ def cloud_to_arr( cloud_as_image[(int(np.floor(x)) + 1) % shape_x][int(np.floor(y)) % shape_y] += ( 1 - frac_low_x ) * frac_low_y - cloud_as_image[int(np.floor(x)) % shape_x][(int(np.floor(y)) + 1) % shape_y] += ( - frac_low_x * (1 - frac_low_y) - ) + cloud_as_image[int(np.floor(x)) % shape_x][ + (int(np.floor(y)) + 1) % shape_y + ] += frac_low_x * (1 - frac_low_y) cloud_as_image[(int(np.floor(x)) + 1) % shape_x][(int(np.floor(y)) + 1) % shape_y] += ( 1 - frac_low_x ) * (1 - frac_low_y) @@ -416,8 +416,7 @@ def __init__( k: NDArray[np.float_] | None = None, omega: NDArray[np.float_] | None = None, temperature: float = 20, - a: float = 10.0, - b: float = 1.0, + mfl_parameter: tuple[float, float] = (10.0, 1.0), ) -> None: """Initializes from parameters. @@ -425,13 +424,12 @@ def __init__( k: The momentum axis. omega: The energy axis. temperature: The temperature to use for the calculation. Defaults to None. - a: The MFL `a` parameter. Defaults to 10.0. - b: The MFL `b` parameter. Defaults to 1.0. + mfl_parameter (tuple[float, float]): The MFL paramter ('a', and 'b'). + Defaults to (10.0, 1.0) """ super().__init__(k, omega, temperature) - self.a = a - self.b = b + self.a, self.b = mfl_parameter def imag_self_energy(self) -> NDArray[np.float_]: """Calculates the imaginary part of the self energy.""" @@ -450,9 +448,7 @@ def __init__( k: NDArray[np.float_] | None = None, omega: NDArray[np.float_] | None = None, temperature: float = 20, - delta: float = 50, - gamma_s: float = 30, - gamma_p: float = 10, + gap_paramters: tuple[float, float, float] = (50, 30, 0), ) -> None: """Initializes from parameters. @@ -461,12 +457,10 @@ def __init__( omega: The energy axis. temperature: The temperature to use for the calculation. Defaults to None. delta: The gap size. - gamma_s: The s-wave gamma parameter. - gamma_p: The p-wave gamma parameter. + gap_paramter (tuple[float, float, float]): Gap paramter of the BSSCO, + Delta, and two Gamma pamaramters (s- and p-wave) """ - self.delta = delta - self.gamma_s = gamma_s - self.gamma_p = gamma_p + self.delta, self.gamma_s, self.gamma_p = gap_paramters super().__init__(k, omega, temperature) def digest_to_json(self) -> dict[str, Any]: