Skip to content

Commit

Permalink
Merge branch 'daredevil' of https://github.com/arafune/arpes into dar…
Browse files Browse the repository at this point in the history
…edevil
  • Loading branch information
arafune committed Feb 6, 2024
2 parents ece8118 + 41b2902 commit 5e02aa4
Show file tree
Hide file tree
Showing 7 changed files with 16 additions and 18 deletions.
1 change: 0 additions & 1 deletion arpes/plotting/bz_tool/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@
from arpes.utilities.ui import combo_box, horizontal, tabs

from .CoordinateOffsetWidget import CoordinateOffsetWidget
from .RangeOrSingleValueWidget import RangeOrSingleValueWidget

if TYPE_CHECKING:
from _typeshed import Incomplete
Expand Down
5 changes: 3 additions & 2 deletions arpes/plotting/dynamic_tool.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Allows for making any function of a spectrum into a dynamic tool."""

from __future__ import annotations

import inspect
Expand Down Expand Up @@ -170,11 +171,11 @@ def build_control_for(
parameter_default,
parameter_type,
validator_settings=config,
id=f"{parameter_name}-control",
id_=f"{parameter_name}-control",
)

if parameter_type == str:
return line_edit(parameter_default, id=f"{parameter_name}-control")
return line_edit(parameter_default, id_=f"{parameter_name}-control")
return None

def before_show(self) -> None:
Expand Down
2 changes: 1 addition & 1 deletion arpes/plotting/qt_ktool/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ def add_contextual_widgets(self) -> None:
numeric_input(
self.data.attrs.get(f"{p}_offset", 0.0),
input_type=float,
id=f"control-{p}",
id_=f"control-{p}",
),
)
for p in pair
Expand Down
8 changes: 4 additions & 4 deletions arpes/plotting/qt_tool/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -192,10 +192,10 @@ class QtTool(SimpleApp):
def __init__(self) -> None:
"""Initialize attributes to safe empty values."""
super().__init__()
self.data: xr.Dataset | xr.DataArray
self.data: xr.DataArray

self.content_layout = None
self.main_layout: QtWidgets.QGridLayout | None = None
self.content_layout: QGridLayout
self.main_layout: QGridLayout

self.axis_info_widgets: list = []
self.binning_info_widgets: list = []
Expand Down Expand Up @@ -527,7 +527,7 @@ def reset_intensity(self) -> None:
"""Autoscales intensity in each marginal plot."""
self.update_cursor_position(self.context["cursor"], force=True, keep_levels=False)

def set_data(self, data: DataType) -> None:
def set_data(self, data: xr.DataArray | xr.Dataset) -> None:
"""Sets the current data to a new value and resets binning."""
data_arr = normalize_to_spectrum(data)

Expand Down
4 changes: 1 addition & 3 deletions arpes/utilities/qt/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,6 @@
import dill
import pyqtgraph as pg
from pyqtgraph import ViewBox
from PySide6.QtCore import QCoreApplication
from PySide6.QtWidgets import QWidget

from arpes._typing import xr_types

Expand All @@ -21,7 +19,7 @@
from .windows import SimpleWindow

if TYPE_CHECKING:
from collections.abc import Callable, Generator, Iterable
from collections.abc import Callable
from typing import Literal, Self

from _typeshed import Incomplete
Expand Down
2 changes: 1 addition & 1 deletion arpes/utilities/qt/windows.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@


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
12 changes: 6 additions & 6 deletions arpes/utilities/ui.py
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@


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 @@ -152,7 +152,7 @@ class CursorMode(NamedTuple):
supported_dimensions: Incomplete


PRETTY_KEYS: str[int, str] = {}
PRETTY_KEYS: dict[Enum, str] = {}
for key, value in vars(QtCore.Qt.Key).items():
if isinstance(value, QtCore.Qt.Key):
PRETTY_KEYS[value] = key.partition("_")[2]
Expand Down Expand Up @@ -522,14 +522,14 @@ def _layout_dataclass_field(dataclass_cls: Incomplete, field_name: str, prefix:
int,
float,
]:
field_input = numeric_input(value=0, input_type=field.type, id=id_for_field)
field_input = numeric_input(value=0, input_type=field.type, id_=id_for_field)
elif field.type == str:
field_input = line_edit("", id=id_for_field)
field_input = line_edit("", id_=id_for_field)
elif issubclass(field.type, enum.Enum):
enum_options = enum_option_names(field.type)
field_input = combo_box(enum_options, id=id_for_field)
field_input = combo_box(enum_options, id_=id_for_field)
elif field.type == bool:
field_input = check_box(field_name, id=id_for_field)
field_input = check_box(field_name, id_=id_for_field)
else:
msg = f"Could not render field: {field}"
raise RuntimeError(msg)
Expand Down

0 comments on commit 5e02aa4

Please sign in to comment.