slm_open_api_package 0.2.13__tar.gz → 0.2.14__tar.gz

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.
Files changed (39) hide show
  1. {slm_open_api_package-0.2.13 → slm_open_api_package-0.2.14}/PKG-INFO +3 -1
  2. {slm_open_api_package-0.2.13 → slm_open_api_package-0.2.14}/README.md +2 -0
  3. {slm_open_api_package-0.2.13 → slm_open_api_package-0.2.14}/pyproject.toml +1 -1
  4. {slm_open_api_package-0.2.13 → slm_open_api_package-0.2.14}/pyproject.toml.orig +1 -1
  5. {slm_open_api_package-0.2.13 → slm_open_api_package-0.2.14}/src/slm_api/helpers/data_handler.py +11 -0
  6. {slm_open_api_package-0.2.13 → slm_open_api_package-0.2.14}/src/slm_api/helpers/stream_handlers.py +5 -3
  7. {slm_open_api_package-0.2.13 → slm_open_api_package-0.2.14}/src/slm_api/CPB_example.py +0 -0
  8. {slm_open_api_package-0.2.13 → slm_open_api_package-0.2.14}/src/slm_api/__init__.py +0 -0
  9. {slm_open_api_package-0.2.13 → slm_open_api_package-0.2.14}/src/slm_api/enums/fast_log_intervals_enum.py +0 -0
  10. {slm_open_api_package-0.2.13 → slm_open_api_package-0.2.14}/src/slm_api/enums/sequence_id_enum.py +0 -0
  11. {slm_open_api_package-0.2.13 → slm_open_api_package-0.2.14}/src/slm_api/example_multi.py +0 -0
  12. {slm_open_api_package-0.2.13 → slm_open_api_package-0.2.14}/src/slm_api/fast_log_example.py +0 -0
  13. {slm_open_api_package-0.2.13 → slm_open_api_package-0.2.14}/src/slm_api/flac_example.py +0 -0
  14. {slm_open_api_package-0.2.13 → slm_open_api_package-0.2.14}/src/slm_api/helpers/FigureHandler.py +0 -0
  15. {slm_open_api_package-0.2.13 → slm_open_api_package-0.2.14}/src/slm_api/helpers/Leq.py +0 -0
  16. {slm_open_api_package-0.2.13 → slm_open_api_package-0.2.14}/src/slm_api/helpers/__init__.py +0 -0
  17. {slm_open_api_package-0.2.13 → slm_open_api_package-0.2.14}/src/slm_api/helpers/buffer.py +0 -0
  18. {slm_open_api_package-0.2.13 → slm_open_api_package-0.2.14}/src/slm_api/helpers/fft.py +0 -0
  19. {slm_open_api_package-0.2.13 → slm_open_api_package-0.2.14}/src/slm_api/helpers/flac_stream_2_samples.py +0 -0
  20. {slm_open_api_package-0.2.13 → slm_open_api_package-0.2.14}/src/slm_api/helpers/https_requests.py +0 -0
  21. {slm_open_api_package-0.2.13 → slm_open_api_package-0.2.14}/src/slm_api/helpers/measurment_handler.py +0 -0
  22. {slm_open_api_package-0.2.13 → slm_open_api_package-0.2.14}/src/slm_api/helpers/sequence_handler.py +0 -0
  23. {slm_open_api_package-0.2.13 → slm_open_api_package-0.2.14}/src/slm_api/helpers/stream_handler.py +0 -0
  24. {slm_open_api_package-0.2.13 → slm_open_api_package-0.2.14}/src/slm_api/helpers/tmpFileStateMachine.py +0 -0
  25. {slm_open_api_package-0.2.13 → slm_open_api_package-0.2.14}/src/slm_api/helpers/websocket_handler.py +0 -0
  26. {slm_open_api_package-0.2.13 → slm_open_api_package-0.2.14}/src/slm_api/helpers/webxi_helper_functions.py +0 -0
  27. {slm_open_api_package-0.2.13 → slm_open_api_package-0.2.14}/src/slm_api/helpers/webxi_root.pem +0 -0
  28. {slm_open_api_package-0.2.13 → slm_open_api_package-0.2.14}/src/slm_api/leq.py +0 -0
  29. {slm_open_api_package-0.2.13 → slm_open_api_package-0.2.14}/src/slm_api/mp3_example.py +0 -0
  30. {slm_open_api_package-0.2.13 → slm_open_api_package-0.2.14}/src/slm_api/multi_device_flac.py +0 -0
  31. {slm_open_api_package-0.2.13 → slm_open_api_package-0.2.14}/src/slm_api/multi_instrument_example.py +0 -0
  32. {slm_open_api_package-0.2.13 → slm_open_api_package-0.2.14}/src/slm_api/plot_saved_data_example.py +0 -0
  33. {slm_open_api_package-0.2.13 → slm_open_api_package-0.2.14}/src/slm_api/screen_record_example.py +0 -0
  34. {slm_open_api_package-0.2.13 → slm_open_api_package-0.2.14}/src/slm_api/webxi/README.md +0 -0
  35. {slm_open_api_package-0.2.13 → slm_open_api_package-0.2.14}/src/slm_api/webxi/__init__.py +0 -0
  36. {slm_open_api_package-0.2.13 → slm_open_api_package-0.2.14}/src/slm_api/webxi/webxi-header.ksy +0 -0
  37. {slm_open_api_package-0.2.13 → slm_open_api_package-0.2.14}/src/slm_api/webxi/webxi-stream.ksy +0 -0
  38. {slm_open_api_package-0.2.13 → slm_open_api_package-0.2.14}/src/slm_api/webxi/webxi_header.py +0 -0
  39. {slm_open_api_package-0.2.13 → slm_open_api_package-0.2.14}/src/slm_api/webxi/webxi_stream.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: slm_open_api_package
3
- Version: 0.2.13
3
+ Version: 0.2.14
4
4
  Summary: Add your description here
5
5
  Author: Sofus Vingaard
6
6
  Author-email: Sofus Vingaard <sofus.krebsvingaard@hbkworld.com>
@@ -82,6 +82,8 @@ except KeyboardInterrupt:
82
82
 
83
83
  JSON and CSV publish complete snapshots in a background worker, at most once per second while new data arrives, rather than rewriting the file for every sample. They retain records in memory and preserve their existing layouts; full-history snapshot costs still grow with recording length. Construct `JsonDataHandler(path, snapshot_interval=2.0)` or `CsvDataHandler(path, snapshot_interval=2.0)` and attach it with `setDataHandler()` to use a different interval. `close()` waits for the worker and saves all remaining records; background write failures are reported on subsequent updates or during the final flush. WAV still appends each audio chunk without buffering the recording in memory. `stopStream()` stops the measurement, closes saving handlers, and removes the device stream. Measurement saving formats are `"csv"` and `"json"`; audio uses `"wav"`. File extensions are added automatically.
84
84
 
85
+ If snapshot replacement raises `PermissionError` (for example, Windows prevents replacing a CSV open in Excel), the worker warns once per failure episode, continues buffering records, and retries at the next snapshot interval. Close the program holding the output file open, or correct its permissions, to allow saving to resume. A lock still present at `close()` raises an error; unsaved records only remain in memory while the process is alive. Other write failures remain fatal to snapshot saving. `stopStream()` still attempts device cleanup if closing the saving handler fails.
86
+
85
87
  ## Multiple Sequences
86
88
 
87
89
  Based on [example_multi.py](src/slm_api/example_multi.py), use `mode="multi"` for several enabled broadband sequences in a single stream:
@@ -60,6 +60,8 @@ except KeyboardInterrupt:
60
60
 
61
61
  JSON and CSV publish complete snapshots in a background worker, at most once per second while new data arrives, rather than rewriting the file for every sample. They retain records in memory and preserve their existing layouts; full-history snapshot costs still grow with recording length. Construct `JsonDataHandler(path, snapshot_interval=2.0)` or `CsvDataHandler(path, snapshot_interval=2.0)` and attach it with `setDataHandler()` to use a different interval. `close()` waits for the worker and saves all remaining records; background write failures are reported on subsequent updates or during the final flush. WAV still appends each audio chunk without buffering the recording in memory. `stopStream()` stops the measurement, closes saving handlers, and removes the device stream. Measurement saving formats are `"csv"` and `"json"`; audio uses `"wav"`. File extensions are added automatically.
62
62
 
63
+ If snapshot replacement raises `PermissionError` (for example, Windows prevents replacing a CSV open in Excel), the worker warns once per failure episode, continues buffering records, and retries at the next snapshot interval. Close the program holding the output file open, or correct its permissions, to allow saving to resume. A lock still present at `close()` raises an error; unsaved records only remain in memory while the process is alive. Other write failures remain fatal to snapshot saving. `stopStream()` still attempts device cleanup if closing the saving handler fails.
64
+
63
65
  ## Multiple Sequences
64
66
 
65
67
  Based on [example_multi.py](src/slm_api/example_multi.py), use `mode="multi"` for several enabled broadband sequences in a single stream:
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "slm_open_api_package"
3
- version = "0.2.13"
3
+ version = "0.2.14"
4
4
  description = "Add your description here"
5
5
  readme = "README.md"
6
6
  requires-python = ">=3.12"
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "slm_open_api_package"
3
- version = "0.2.13"
3
+ version = "0.2.14"
4
4
  description = "Add your description here"
5
5
  readme = "README.md"
6
6
  authors = [
@@ -70,9 +70,20 @@ class _BufferedFileDataHandler(DataHandler):
70
70
  self._worker.start()
71
71
 
72
72
  def _run_snapshots(self):
73
+ permission_error_reported = False
73
74
  while not self._stop_event.wait(self._snapshot_interval):
74
75
  try:
75
76
  self._flush_snapshot()
77
+ permission_error_reported = False
78
+ except PermissionError as error:
79
+ if not permission_error_reported:
80
+ warnings.warn(
81
+ f"Cannot replace snapshot {self._path}: {error}. "
82
+ "Close any program holding the file open. Records remain "
83
+ "buffered in memory and saving will retry automatically.",
84
+ RuntimeWarning,
85
+ )
86
+ permission_error_reported = True
76
87
  except Exception as error:
77
88
  with self._lock:
78
89
  self._write_error = error
@@ -482,6 +482,8 @@ class WebXiStreamHandler(stream.StreamHandler):
482
482
  print(f"TotalTime: {total}")
483
483
 
484
484
  def stopStream(self):
485
- if self.data_handler is not None and hasattr(self.data_handler, "close"):
486
- self.data_handler.close()
487
- super().stopStream()
485
+ try:
486
+ if self.data_handler is not None and hasattr(self.data_handler, "close"):
487
+ self.data_handler.close()
488
+ finally:
489
+ super().stopStream()