bec-widgets 2.12.1__py3-none-any.whl → 2.12.2__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.
CHANGELOG.md CHANGED
@@ -1,6 +1,14 @@
1
1
  # CHANGELOG
2
2
 
3
3
 
4
+ ## v2.12.2 (2025-06-05)
5
+
6
+ ### Bug Fixes
7
+
8
+ - **waveform**: Safeguard for history data access, closes #571; removed return values "none"
9
+ ([`8570538`](https://github.com/bec-project/bec_widgets/commit/85705383e4aff2f83f76d342db0a13380aeca42f))
10
+
11
+
4
12
  ## v2.12.1 (2025-06-05)
5
13
 
6
14
  ### Bug Fixes
PKG-INFO CHANGED
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: bec_widgets
3
- Version: 2.12.1
3
+ Version: 2.12.2
4
4
  Summary: BEC Widgets
5
5
  Project-URL: Bug Tracker, https://gitlab.psi.ch/bec/bec_widgets/issues
6
6
  Project-URL: Homepage, https://gitlab.psi.ch/bec/bec_widgets
@@ -1,7 +1,7 @@
1
1
  from __future__ import annotations
2
2
 
3
3
  import json
4
- from typing import Literal
4
+ from typing import Any, Literal
5
5
 
6
6
  import lmfit
7
7
  import numpy as np
@@ -163,7 +163,7 @@ class Waveform(PlotBase):
163
163
  self._async_curves = []
164
164
  self._slice_index = None
165
165
  self._dap_curves = []
166
- self._mode: Literal["none", "sync", "async", "mixed"] = "none"
166
+ self._mode = None
167
167
 
168
168
  # Scan data
169
169
  self._scan_done = True # means scan is not running
@@ -1139,7 +1139,7 @@ class Waveform(PlotBase):
1139
1139
  QTimer.singleShot(100, self.update_sync_curves)
1140
1140
  QTimer.singleShot(300, self.update_sync_curves)
1141
1141
 
1142
- def _fetch_scan_data_and_access(self):
1142
+ def _fetch_scan_data_and_access(self) -> tuple[dict, str] | tuple[None, None]:
1143
1143
  """
1144
1144
  Decide whether the widget is in live or historical mode
1145
1145
  and return the appropriate data dict and access key.
@@ -1153,7 +1153,7 @@ class Waveform(PlotBase):
1153
1153
  self.update_with_scan_history(-1)
1154
1154
  if self.scan_item is None:
1155
1155
  logger.info("No scan executed so far; skipping device curves categorisation.")
1156
- return "none", "none"
1156
+ return None, None
1157
1157
 
1158
1158
  if hasattr(self.scan_item, "live_data"):
1159
1159
  # Live scan
@@ -1169,7 +1169,7 @@ class Waveform(PlotBase):
1169
1169
  """
1170
1170
  if self.scan_item is None:
1171
1171
  logger.info("No scan executed so far; skipping device curves categorisation.")
1172
- return "none"
1172
+ return
1173
1173
  data, access_key = self._fetch_scan_data_and_access()
1174
1174
  for curve in self._sync_curves:
1175
1175
  device_name = curve.config.signal.name
@@ -1177,9 +1177,8 @@ class Waveform(PlotBase):
1177
1177
  if access_key == "val":
1178
1178
  device_data = data.get(device_name, {}).get(device_entry, {}).get(access_key, None)
1179
1179
  else:
1180
- device_data = (
1181
- data.get(device_name, {}).get(device_entry, {}).read().get("value", None)
1182
- )
1180
+ entry_obj = data.get(device_name, {}).get(device_entry)
1181
+ device_data = entry_obj.read()["value"] if entry_obj else None
1183
1182
  x_data = self._get_x_data(device_name, device_entry)
1184
1183
  if x_data is not None:
1185
1184
  if len(x_data) == 1:
@@ -1217,7 +1216,8 @@ class Waveform(PlotBase):
1217
1216
  if self._skip_large_dataset_check is False:
1218
1217
  if not self._check_dataset_size_and_confirm(dataset_obj, device_entry):
1219
1218
  continue # user declined to load; skip this curve
1220
- device_data = dataset_obj.get(device_entry, {}).read().get("value", None)
1219
+ entry_obj = dataset_obj.get(device_entry, None)
1220
+ device_data = entry_obj.read()["value"] if entry_obj else None
1221
1221
 
1222
1222
  # if shape is 2D cast it into 1D and take the last waveform
1223
1223
  if len(np.shape(device_data)) > 1:
@@ -1549,15 +1549,21 @@ class Waveform(PlotBase):
1549
1549
  if access_key == "val": # live data
1550
1550
  x_data = data.get(x_name, {}).get(x_entry, {}).get(access_key, [0])
1551
1551
  else: # history data
1552
- x_data = data.get(x_name, {}).get(x_entry, {}).read().get("value", [0])
1552
+ entry_obj = data.get(x_name, {}).get(x_entry)
1553
+ x_data = entry_obj.read()["value"] if entry_obj else [0]
1553
1554
  new_suffix = f" (custom: {x_name}-{x_entry})"
1554
1555
 
1555
1556
  # 2 User wants timestamp
1556
1557
  if self.x_axis_mode["name"] == "timestamp":
1557
1558
  if access_key == "val": # live
1558
- timestamps = data[device_name][device_entry].timestamps
1559
+ x_data = data.get(device_name, {}).get(device_entry, None)
1560
+ if x_data is None:
1561
+ return None
1562
+ else:
1563
+ timestamps = x_data.timestamps
1559
1564
  else: # history data
1560
- timestamps = data[device_name][device_entry].read().get("timestamp", [0])
1565
+ entry_obj = data.get(device_name, {}).get(device_entry)
1566
+ timestamps = entry_obj.read()["timestamp"] if entry_obj else [0]
1561
1567
  x_data = timestamps
1562
1568
  new_suffix = " (timestamp)"
1563
1569
 
@@ -1584,7 +1590,8 @@ class Waveform(PlotBase):
1584
1590
  if access_key == "val":
1585
1591
  x_data = data.get(x_name, {}).get(x_entry, {}).get(access_key, None)
1586
1592
  else:
1587
- x_data = data.get(x_name, {}).get(x_entry, {}).read().get("value", None)
1593
+ entry_obj = data.get(x_name, {}).get(x_entry)
1594
+ x_data = entry_obj.read()["value"] if entry_obj else None
1588
1595
  new_suffix = f" (auto: {x_name}-{x_entry})"
1589
1596
  self._update_x_label_suffix(new_suffix)
1590
1597
  return x_data
@@ -1637,7 +1644,7 @@ class Waveform(PlotBase):
1637
1644
  self.update_with_scan_history(-1)
1638
1645
  if self.scan_item is None:
1639
1646
  logger.info("No scan executed so far; skipping device curves categorisation.")
1640
- return "none"
1647
+ return None
1641
1648
 
1642
1649
  if hasattr(self.scan_item, "live_data"):
1643
1650
  readout_priority = self.scan_item.status_message.info["readout_priority"] # live data
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: bec_widgets
3
- Version: 2.12.1
3
+ Version: 2.12.2
4
4
  Summary: BEC Widgets
5
5
  Project-URL: Bug Tracker, https://gitlab.psi.ch/bec/bec_widgets/issues
6
6
  Project-URL: Homepage, https://gitlab.psi.ch/bec/bec_widgets
@@ -2,11 +2,11 @@
2
2
  .gitlab-ci.yml,sha256=1nMYldzVk0tFkBWYTcUjumOrdSADASheWOAc0kOFDYs,9509
3
3
  .pylintrc,sha256=eeY8YwSI74oFfq6IYIbCqnx3Vk8ZncKaatv96n_Y8Rs,18544
4
4
  .readthedocs.yaml,sha256=ivqg3HTaOxNbEW3bzWh9MXAkrekuGoNdj0Mj3SdRYuw,639
5
- CHANGELOG.md,sha256=aibe9NzesiaBxpYGGLEcieGO0X5K2kNdChWbS1Lkz_8,296944
5
+ CHANGELOG.md,sha256=UD46knQ-Uwrj7v0h-bwRm1V9iyc26qJCjqUDrNHWE-U,297187
6
6
  LICENSE,sha256=Daeiu871NcAp8uYi4eB_qHgvypG-HX0ioRQyQxFwjeg,1531
7
- PKG-INFO,sha256=wptvRuS9Q-MU6MikQcSUQChj8FQ8Wm-AQ86iE9P902s,1254
7
+ PKG-INFO,sha256=Kcd6OF3UQpRgaisKiMd8N-QHda0WVCx6ibH_dBz17UQ,1254
8
8
  README.md,sha256=oY5Jc1uXehRASuwUJ0umin2vfkFh7tHF-LLruHTaQx0,3560
9
- pyproject.toml,sha256=YCScLsK5LsAQvYfmpjvE0C6r1rScg7M9VCG9-I7h7tQ,2835
9
+ pyproject.toml,sha256=fmTjR-mLrzWuJj1LqBPC9hVL4MNj_cmbjVd9AIhsGjg,2835
10
10
  .git_hooks/pre-commit,sha256=n3RofIZHJl8zfJJIUomcMyYGFi_rwq4CC19z0snz3FI,286
11
11
  .github/pull_request_template.md,sha256=F_cJXzooWMFgMGtLK-7KeGcQt0B4AYFse5oN0zQ9p6g,801
12
12
  .github/ISSUE_TEMPLATE/bug_report.yml,sha256=WdRnt7HGxvsIBLzhkaOWNfg8IJQYa_oV9_F08Ym6znQ,1081
@@ -313,7 +313,7 @@ bec_widgets/widgets/plots/toolbar_bundles/save_state.py,sha256=H3fu-bRzNIycCUFb2
313
313
  bec_widgets/widgets/plots/waveform/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
314
314
  bec_widgets/widgets/plots/waveform/curve.py,sha256=KlcGbd60lPO9BYcca08fMhWkfx5qu4O9IbSNTwvajGM,10401
315
315
  bec_widgets/widgets/plots/waveform/register_waveform.py,sha256=pdcLCYKkLkSb-5DqbJdC6M3JyoXQBRVAKf7BZVCto80,467
316
- bec_widgets/widgets/plots/waveform/waveform.py,sha256=_EmQTWiPJmUzDo8PmvLd2gshzE-IECtswfaY7nCTZb4,75499
316
+ bec_widgets/widgets/plots/waveform/waveform.py,sha256=S-9Be3gbzpztZk3GyEI7MDH2m0Xl0l3g7TN5GYcbjpw,75850
317
317
  bec_widgets/widgets/plots/waveform/waveform.pyproject,sha256=X2T6d4JGt9YSI28e-myjXh1YkUM4Yr3kNb0-F84KvUA,26
318
318
  bec_widgets/widgets/plots/waveform/waveform_plugin.py,sha256=2AZPtBHs75l9cdhwQnY3jpIMRPUUqK3RNvQbTvrFyvg,1237
319
319
  bec_widgets/widgets/plots/waveform/settings/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
@@ -407,8 +407,8 @@ bec_widgets/widgets/utility/visual/dark_mode_button/dark_mode_button.py,sha256=O
407
407
  bec_widgets/widgets/utility/visual/dark_mode_button/dark_mode_button.pyproject,sha256=Lbi9zb6HNlIq14k6hlzR-oz6PIFShBuF7QxE6d87d64,34
408
408
  bec_widgets/widgets/utility/visual/dark_mode_button/dark_mode_button_plugin.py,sha256=CzChz2SSETYsR8-36meqWnsXCT-FIy_J_xeU5coWDY8,1350
409
409
  bec_widgets/widgets/utility/visual/dark_mode_button/register_dark_mode_button.py,sha256=rMpZ1CaoucwobgPj1FuKTnt07W82bV1GaSYdoqcdMb8,521
410
- bec_widgets-2.12.1.dist-info/METADATA,sha256=wptvRuS9Q-MU6MikQcSUQChj8FQ8Wm-AQ86iE9P902s,1254
411
- bec_widgets-2.12.1.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
412
- bec_widgets-2.12.1.dist-info/entry_points.txt,sha256=dItMzmwA1wizJ1Itx15qnfJ0ZzKVYFLVJ1voxT7K7D4,214
413
- bec_widgets-2.12.1.dist-info/licenses/LICENSE,sha256=Daeiu871NcAp8uYi4eB_qHgvypG-HX0ioRQyQxFwjeg,1531
414
- bec_widgets-2.12.1.dist-info/RECORD,,
410
+ bec_widgets-2.12.2.dist-info/METADATA,sha256=Kcd6OF3UQpRgaisKiMd8N-QHda0WVCx6ibH_dBz17UQ,1254
411
+ bec_widgets-2.12.2.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
412
+ bec_widgets-2.12.2.dist-info/entry_points.txt,sha256=dItMzmwA1wizJ1Itx15qnfJ0ZzKVYFLVJ1voxT7K7D4,214
413
+ bec_widgets-2.12.2.dist-info/licenses/LICENSE,sha256=Daeiu871NcAp8uYi4eB_qHgvypG-HX0ioRQyQxFwjeg,1531
414
+ bec_widgets-2.12.2.dist-info/RECORD,,
pyproject.toml CHANGED
@@ -4,7 +4,7 @@ build-backend = "hatchling.build"
4
4
 
5
5
  [project]
6
6
  name = "bec_widgets"
7
- version = "2.12.1"
7
+ version = "2.12.2"
8
8
  description = "BEC Widgets"
9
9
  requires-python = ">=3.10"
10
10
  classifiers = [