Skip to content

Commit

Permalink
💄 Reduing the number of args by using tuple.
Browse files Browse the repository at this point in the history
  • Loading branch information
arafune committed Jan 12, 2024
1 parent 5806417 commit b7e7250
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 22 deletions.
6 changes: 1 addition & 5 deletions arpes/plotting/annotations.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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.
Expand All @@ -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):
Expand Down
28 changes: 11 additions & 17 deletions arpes/simulation.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -416,22 +416,20 @@ 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.
Args:
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."""
Expand All @@ -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.
Expand All @@ -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]:
Expand Down

0 comments on commit b7e7250

Please sign in to comment.