essreduce 24.11.2__py3-none-any.whl → 24.11.3__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
ess/reduce/nexus/types.py CHANGED
@@ -91,6 +91,8 @@ Monitor4 = NewType('Monitor4', int)
91
91
  """Identifier for an arbitrary monitor"""
92
92
  Monitor5 = NewType('Monitor5', int)
93
93
  """Identifier for an arbitrary monitor"""
94
+ Monitor6 = NewType('Monitor6', int)
95
+ """Identifier for an arbitrary monitor"""
94
96
  IncidentMonitor = NewType('IncidentMonitor', int)
95
97
  """Incident monitor"""
96
98
  TransmissionMonitor = NewType('TransmissionMonitor', int)
@@ -102,6 +104,7 @@ MonitorType = TypeVar(
102
104
  Monitor3,
103
105
  Monitor4,
104
106
  Monitor5,
107
+ Monitor6,
105
108
  IncidentMonitor,
106
109
  TransmissionMonitor,
107
110
  )
@@ -119,6 +122,7 @@ Component = TypeVar(
119
122
  Monitor3,
120
123
  Monitor4,
121
124
  Monitor5,
125
+ Monitor6,
122
126
  IncidentMonitor,
123
127
  TransmissionMonitor,
124
128
  )
ess/reduce/parameter.py CHANGED
@@ -126,6 +126,11 @@ class StringParameter(Parameter[str]):
126
126
  pass
127
127
 
128
128
 
129
+ @dataclass
130
+ class MultiStringParameter(Parameter[tuple[str, ...]]):
131
+ """Widget for entering multiple strings."""
132
+
133
+
129
134
  @dataclass(kw_only=True)
130
135
  class ParamWithBounds(Parameter[T]):
131
136
  bounds: tuple[T, T]
@@ -10,6 +10,7 @@ from ..parameter import (
10
10
  BooleanParameter,
11
11
  FilenameParameter,
12
12
  MultiFilenameParameter,
13
+ MultiStringParameter,
13
14
  ParamWithOptions,
14
15
  StringParameter,
15
16
  Parameter,
@@ -21,9 +22,11 @@ from ..parameter import (
21
22
  from ._config import default_layout, default_style
22
23
 
23
24
  from ._binedges_widget import BinEdgesWidget
25
+ from ._filename_widget import FilenameWidget, MultiFilenameWidget
24
26
  from ._linspace_widget import LinspaceWidget
25
27
  from ._vector_widget import VectorWidget
26
28
  from ._bounds_widget import BoundsWidget
29
+ from ._string_widget import MultiStringWidget, StringWidget
27
30
  from ._switchable_widget import SwitchWidget
28
31
  from ._optional_widget import OptionalWidget
29
32
 
@@ -101,42 +104,41 @@ def boolean_parameter_widget(param: BooleanParameter):
101
104
 
102
105
  @create_parameter_widget.register(StringParameter)
103
106
  def string_parameter_widget(param: StringParameter):
104
- name = param.name
105
- description = param.description
106
- if param.switchable:
107
- return widgets.Text(
108
- description=name,
109
- tooltip=description,
110
- layout=default_layout,
111
- style=default_style,
112
- )
113
- else:
114
- return widgets.Text(
115
- value=param.default,
116
- description=name,
117
- tooltip=description,
118
- layout=default_layout,
119
- style=default_style,
120
- )
107
+ return StringWidget(
108
+ description=param.name,
109
+ value=param.default,
110
+ layout=default_layout,
111
+ style=default_style,
112
+ )
113
+
114
+
115
+ @create_parameter_widget.register(MultiStringParameter)
116
+ def multi_string_parameter_widget(param: MultiStringParameter):
117
+ return MultiStringWidget(
118
+ description=param.name,
119
+ value=param.default,
120
+ layout=default_layout,
121
+ style=default_style,
122
+ )
121
123
 
122
124
 
123
125
  @create_parameter_widget.register(FilenameParameter)
124
126
  def filename_parameter_widget(param: FilenameParameter):
125
- return widgets.Text(
127
+ return FilenameWidget(
126
128
  description=param.name,
129
+ value=param.default,
127
130
  layout=default_layout,
128
131
  style=default_style,
129
- value=param.default,
130
132
  )
131
133
 
132
134
 
133
135
  @create_parameter_widget.register(MultiFilenameParameter)
134
136
  def multi_filename_parameter_widget(param: MultiFilenameParameter):
135
- return widgets.Text(
137
+ return MultiFilenameWidget(
136
138
  description=param.name,
139
+ value=param.default,
137
140
  layout=default_layout,
138
141
  style=default_style,
139
- value=param.default,
140
142
  )
141
143
 
142
144
 
@@ -182,7 +184,9 @@ __all__ = [
182
184
  'BinEdgesWidget',
183
185
  'BoundsWidget',
184
186
  'EssWidget',
187
+ 'FilenameWidget',
185
188
  'LinspaceWidget',
189
+ 'MultiFilenameWidget',
186
190
  'OptionalWidget',
187
191
  'SwitchWidget',
188
192
  'VectorWidget',
@@ -0,0 +1,10 @@
1
+ # SPDX-License-Identifier: BSD-3-Clause
2
+ # Copyright (c) 2024 Scipp contributors (https://github.com/scipp)
3
+
4
+ from ._string_widget import MultiStringWidget, StringWidget
5
+
6
+
7
+ class FilenameWidget(StringWidget): ...
8
+
9
+
10
+ class MultiFilenameWidget(MultiStringWidget): ...
@@ -0,0 +1,39 @@
1
+ # SPDX-License-Identifier: BSD-3-Clause
2
+ # Copyright (c) 2024 Scipp contributors (https://github.com/scipp)
3
+ from ipywidgets import HBox, Text, ValueWidget
4
+
5
+ from ._config import default_layout
6
+
7
+
8
+ class StringWidget(HBox, ValueWidget):
9
+ def __init__(self, description: str, value: str | None = None, **kwargs):
10
+ super().__init__(layout=default_layout)
11
+ self.text_widget = Text(description=description, value=value, **kwargs)
12
+ self.children = [self.text_widget]
13
+
14
+ @property
15
+ def value(self) -> str | None:
16
+ v = self.text_widget.value.strip()
17
+ if not v:
18
+ return None
19
+ return v
20
+
21
+ @value.setter
22
+ def value(self, value: str | None):
23
+ if value is None:
24
+ self.text_widget.value = ''
25
+ else:
26
+ self.text_widget.value = value
27
+
28
+
29
+ class MultiStringWidget(StringWidget):
30
+ @property
31
+ def value(self) -> tuple[str, ...]:
32
+ v = super().value
33
+ if v is None:
34
+ return ()
35
+ return tuple(s.strip() for s in v.split(','))
36
+
37
+ @value.setter
38
+ def value(self, value: tuple[str, ...]):
39
+ self.text_widget.value = ', '.join(value)
ess/reduce/workflow.py CHANGED
@@ -86,10 +86,7 @@ def assign_parameter_values(pipeline: Pipeline, values: dict[Key, Any]) -> Pipel
86
86
  """Set a value for a parameter in the pipeline."""
87
87
  pipeline = pipeline.copy()
88
88
  for key, value in values.items():
89
- if (
90
- isinstance(value, tuple)
91
- and (mapper := parameter_mappers.get(key)) is not None
92
- ):
89
+ if (mapper := parameter_mappers.get(key)) is not None:
93
90
  pipeline = mapper(pipeline, value)
94
91
  else:
95
92
  pipeline[key] = value
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: essreduce
3
- Version: 24.11.2
3
+ Version: 24.11.3
4
4
  Summary: Common data reduction tools for the ESS facility
5
5
  Author: Scipp contributors
6
6
  License: BSD 3-Clause License
@@ -1,12 +1,12 @@
1
1
  ess/reduce/__init__.py,sha256=-8a2I4mbJdBgNqKxZJe0lAEQJb-lRjX1xmZvGUWCmmU,382
2
2
  ess/reduce/data.py,sha256=vaoeAJ6EpK1YghOiAALLdWiW17TgUnnnt0H-RGiGzXk,3756
3
3
  ess/reduce/logging.py,sha256=6n8Czq4LZ3OK9ENlKsWSI1M3KvKv6_HSoUiV4__IUlU,357
4
- ess/reduce/parameter.py,sha256=9glQk8UgsPDIdxq007bRi3xTKNe24nuAcNDYzYyTydk,4443
4
+ ess/reduce/parameter.py,sha256=R3y2SMk9EIHWfT7_89Sx6Km2mtni5qCWLVGRi8hVO7A,4560
5
5
  ess/reduce/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
6
6
  ess/reduce/streaming.py,sha256=nEO1Xg6LbQ36F44UaVmSNe2MSWmpwz97y9tnlc-z0zA,7493
7
7
  ess/reduce/ui.py,sha256=EjzyMUODHn-5-aHRXE3DDWUsaPbsQRiUP2F4o1Hq260,8427
8
8
  ess/reduce/uncertainty.py,sha256=UrS7wB2aK8QoLD3qG2Ud-XmjDl7Y9dANY31k83-cZKs,6982
9
- ess/reduce/workflow.py,sha256=v0_QlTEub9FLeZAbbZMV_NrLJUT61jTRCFa9Wjli7sE,3125
9
+ ess/reduce/workflow.py,sha256=sL34T_2Cjl_8iFlegujxI9VyOUwo6erVC8pOXnfWgYw,3060
10
10
  ess/reduce/live/__init__.py,sha256=jPQVhihRVNtEDrE20PoKkclKV2aBF1lS7cCHootgFgI,204
11
11
  ess/reduce/live/raw.py,sha256=w-h-G-rXIFxwJ9rxIlCLQepGxLmUjtF2rbXtAUxDgZs,18849
12
12
  ess/reduce/live/workflow.py,sha256=bsbwvTqPhRO6mC__3b7MgU7DWwAnOvGvG-t2n22EKq8,4285
@@ -14,20 +14,22 @@ ess/reduce/nexus/__init__.py,sha256=PxJkhlGcFRzVU4SICBhymK5_5FjM5oXPZ8YUpd0v1pE,
14
14
  ess/reduce/nexus/_nexus_loader.py,sha256=-chpzKcZGr2cXmvSYlGiKdKV591mMG-0BsBusGWTer4,16119
15
15
  ess/reduce/nexus/json_generator.py,sha256=ME2Xn8L7Oi3uHJk9ZZdCRQTRX-OV_wh9-DJn07Alplk,2529
16
16
  ess/reduce/nexus/json_nexus.py,sha256=QrVc0p424nZ5dHX9gebAJppTw6lGZq9404P_OFl1giA,10282
17
- ess/reduce/nexus/types.py,sha256=Bthjg4T2qXYF1rjU9i0DRAEqkCuYXbV3qF2zWPl_s-Q,8571
17
+ ess/reduce/nexus/types.py,sha256=YIXECk-bctwexCvimLrlv97GMLj1UnGHLV3C95IcBOw,8677
18
18
  ess/reduce/nexus/workflow.py,sha256=xcOjfJRECQ_CAxPbc0nr-BbGXe3rUISEDcu3g7D87Nk,22868
19
19
  ess/reduce/scripts/grow_nexus.py,sha256=hET3h06M0xlJd62E3palNLFvJMyNax2kK4XyJcOhl-I,3387
20
- ess/reduce/widgets/__init__.py,sha256=f5-wlyiUQtUFe2bi_DTTpTSx8jGF50snLdhoawZfLgE,5106
20
+ ess/reduce/widgets/__init__.py,sha256=cjRJp4qhzCQgXZFtiZgHNmHFJVLo2Z2MozVG_LZYKlI,5281
21
21
  ess/reduce/widgets/_binedges_widget.py,sha256=09VXYAWJammkzyRYvfFpjzn0E2-BSaDco3osnTUuv8c,2720
22
22
  ess/reduce/widgets/_bounds_widget.py,sha256=p5hADiSGfHKMfvEILQqpcqggu_G3bLf5vNrW5rYTA0s,1020
23
23
  ess/reduce/widgets/_config.py,sha256=LywjxYau1hsBZ-c2W1_DQ4CRMaaai3anjA8Q8Hn0Y6Y,222
24
+ ess/reduce/widgets/_filename_widget.py,sha256=jlDZOvECJBBjsmfBHjhn8-ig_DQxp3C-Uy07DITs_nI,262
24
25
  ess/reduce/widgets/_linspace_widget.py,sha256=73nPfNSinxfuHN5-kkBoo2oTuGygbLVXPvxaw35xsaU,1175
25
26
  ess/reduce/widgets/_optional_widget.py,sha256=A7vwcVwykj7CIyHSPVh6XL5o-8Z1uJTuzha8TR09Zlc,2216
27
+ ess/reduce/widgets/_string_widget.py,sha256=r0PrFP4OOU_UTmwlHYDWcaFMlnYS_NUp7iCic9ehBAU,1148
26
28
  ess/reduce/widgets/_switchable_widget.py,sha256=SZi65C1iShTi5Xhh7W0A7uwA-12AVaH5xmiIWOkc27o,1726
27
29
  ess/reduce/widgets/_vector_widget.py,sha256=BvuTtc-NGFTkMKIiZS0Elnl34Hi_3A4rthdNLoDI5fM,1138
28
- essreduce-24.11.2.dist-info/LICENSE,sha256=nVEiume4Qj6jMYfSRjHTM2jtJ4FGu0g-5Sdh7osfEYw,1553
29
- essreduce-24.11.2.dist-info/METADATA,sha256=Lv30Wx2xHZw6RqkkkRTcPX3FyLlk1BYtpDVddaKTNmQ,3619
30
- essreduce-24.11.2.dist-info/WHEEL,sha256=PZUExdf71Ui_so67QXpySuHtCi3-J3wvF4ORK6k_S8U,91
31
- essreduce-24.11.2.dist-info/entry_points.txt,sha256=PMZOIYzCifHMTe4pK3HbhxUwxjFaZizYlLD0td4Isb0,66
32
- essreduce-24.11.2.dist-info/top_level.txt,sha256=0JxTCgMKPLKtp14wb1-RKisQPQWX7i96innZNvHBr-s,4
33
- essreduce-24.11.2.dist-info/RECORD,,
30
+ essreduce-24.11.3.dist-info/LICENSE,sha256=nVEiume4Qj6jMYfSRjHTM2jtJ4FGu0g-5Sdh7osfEYw,1553
31
+ essreduce-24.11.3.dist-info/METADATA,sha256=wpqZdOA7tOrAlGWLiDPzN3E9Nh8-6B6Pk3CFOSSdr-Y,3619
32
+ essreduce-24.11.3.dist-info/WHEEL,sha256=PZUExdf71Ui_so67QXpySuHtCi3-J3wvF4ORK6k_S8U,91
33
+ essreduce-24.11.3.dist-info/entry_points.txt,sha256=PMZOIYzCifHMTe4pK3HbhxUwxjFaZizYlLD0td4Isb0,66
34
+ essreduce-24.11.3.dist-info/top_level.txt,sha256=0JxTCgMKPLKtp14wb1-RKisQPQWX7i96innZNvHBr-s,4
35
+ essreduce-24.11.3.dist-info/RECORD,,