Skip to content

Commit

Permalink
💬 Update type hints and doc strings
Browse files Browse the repository at this point in the history
  • Loading branch information
arafune committed Apr 12, 2024
1 parent 007b859 commit 208659a
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 23 deletions.
4 changes: 2 additions & 2 deletions src/arpes/utilities/conversion/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ def slice_along_path( # noqa: PLR0913
interpolation_points: list[Hashable | dict[Hashable, float]],
axis_name: str = "",
resolution: float = 0,
n_points: int | None = None,
n_points: int = 0,
*,
extend_to_edge: bool = False,
) -> xr.Dataset:
Expand Down Expand Up @@ -192,7 +192,7 @@ def slice_along_path( # noqa: PLR0913
for segment in path_segments
],
)
if n_points is None
if not n_points
else path_length / n_points
)
)
Expand Down
38 changes: 17 additions & 21 deletions src/arpes/xarray_extensions.py
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@
UNSPESIFIED = 0.1

LOGLEVELS = (DEBUG, INFO)
LOGLEVEL = LOGLEVELS[0]
LOGLEVEL = LOGLEVELS[1]
logger = getLogger(__name__)
fmt = "%(asctime)s %(levelname)s %(name)s :%(message)s"
formatter = Formatter(fmt)
Expand Down Expand Up @@ -181,7 +181,7 @@ class ARPESAccessorBase:
class _SliceAlongPathKwags(TypedDict, total=False):
axis_name: str
resolution: float
n_points: int | None
n_points: int
extend_to_edge: bool

def along(
Expand All @@ -192,7 +192,7 @@ def along(
"""[TODO:summary].
Args:
directions (NDArray[np.object_]): [TODO:description]
directions (list[Hashable] | dict[Hashable, float]): Direction to slice.
kwargs: axis_name, resolution, n_points, extend_to_edge_shift_gamma
Returns:
Expand All @@ -213,14 +213,14 @@ def find(self, name: str) -> list[str]:
return [n for n in dir(self) if name in n]

@property
def sherman_function(self) -> Incomplete:
"""TODO:summary.
def sherman_function(self) -> float:
"""Return Sherman function from attributes.
Returns: Incomplete
[TODO:description]
Returns: float
Sharman function
Raises: ValueError
[TODO:description]
When no Sherman function related value is found.
ToDo: Test
"""
Expand Down Expand Up @@ -773,9 +773,6 @@ def dshape(self) -> dict[Hashable, int]:
def scan_name(self) -> str:
"""Return scan name.
Args:
self ([TODO:type]): [TODO:description]
Returns: (str)
If "scan" or "file" is set in attrs, return the file name.
If they are not set, return "id" if "id" is set.
Expand Down Expand Up @@ -1363,13 +1360,11 @@ def sample_angles(
def full_coords(
self,
) -> xr.Coordinates:
"""[TODO:summary].
"""Return the coordinate.
Args:
self ([TODO:type]): [TODO:description]
Returns: xr.Coordinates
Coordinates data.
Returns:
[TODO:description]
"""
full_coords: xr.Coordinates

Expand Down Expand Up @@ -1818,8 +1813,7 @@ def angle_unit(self, angle_unit: Literal["Degrees", "Radians"]) -> None:
Angle unit should be "Degrees" or "Radians"
Args:
self ([TODO:type]): [TODO:description]
angle_unit: [TODO:description]
angle_unit: Literal["Degrees", "Radians"]
"""
assert angle_unit in (
"Degrees",
Expand Down Expand Up @@ -1947,9 +1941,11 @@ def _referenced_scans_for_spatial_plot(
) -> Path | tuple[Figure, NDArray[np.object_]]:
"""[TODO:summary].
A Helper function.
Args:
use_id ([TODO:type]): [TODO:description]
pattern ([TODO:type]): [TODO:description]
use_id (bool): [TODO:description]
pattern (str): [TODO:description]
out (str|bool): if str, Path for output figure. if True,
the file name is automatically set. If False/"", no output is given.
"""
Expand Down Expand Up @@ -2520,7 +2516,7 @@ def iterate_axis(
"""Generator to extract data for along the specified axis.
Args:
axis_name_or_axes: [TODO:description]
axis_name_or_axes (list[str] | str): axis (dime) name for iteration.
Returns: (tuple[dict[str, float], XrTypes])
dict object represents the axis(dim) name and it's value.
Expand Down

0 comments on commit 208659a

Please sign in to comment.