biosigpy 0.3.2__tar.gz → 0.3.3__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 (88) hide show
  1. {biosigpy-0.3.2 → biosigpy-0.3.3}/CHANGELOG.md +6 -0
  2. {biosigpy-0.3.2/src/biosigpy.egg-info → biosigpy-0.3.3}/PKG-INFO +1 -1
  3. {biosigpy-0.3.2 → biosigpy-0.3.3}/src/biosigpy/_version.py +1 -1
  4. {biosigpy-0.3.2 → biosigpy-0.3.3}/src/biosigpy/tools/snap_to_peak.py +21 -13
  5. {biosigpy-0.3.2 → biosigpy-0.3.3/src/biosigpy.egg-info}/PKG-INFO +1 -1
  6. {biosigpy-0.3.2 → biosigpy-0.3.3}/LICENSE +0 -0
  7. {biosigpy-0.3.2 → biosigpy-0.3.3}/MANIFEST.in +0 -0
  8. {biosigpy-0.3.2 → biosigpy-0.3.3}/README.md +0 -0
  9. {biosigpy-0.3.2 → biosigpy-0.3.3}/biosiglib.lock +0 -0
  10. {biosigpy-0.3.2 → biosigpy-0.3.3}/docs/api/ecg/baselineremove.md +0 -0
  11. {biosigpy-0.3.2 → biosigpy-0.3.3}/docs/api/ecg/pantompkins.md +0 -0
  12. {biosigpy-0.3.2 → biosigpy-0.3.3}/docs/api/ecg/sloperange.md +0 -0
  13. {biosigpy-0.3.2 → biosigpy-0.3.3}/docs/api/hrv/fdmetrics.md +0 -0
  14. {biosigpy-0.3.2 → biosigpy-0.3.3}/docs/api/hrv/fillgaps.md +0 -0
  15. {biosigpy-0.3.2 → biosigpy-0.3.3}/docs/api/hrv/ipfm.md +0 -0
  16. {biosigpy-0.3.2 → biosigpy-0.3.3}/docs/api/hrv/osp.md +0 -0
  17. {biosigpy-0.3.2 → biosigpy-0.3.3}/docs/api/hrv/removefp.md +0 -0
  18. {biosigpy-0.3.2 → biosigpy-0.3.3}/docs/api/hrv/tdmetrics.md +0 -0
  19. {biosigpy-0.3.2 → biosigpy-0.3.3}/docs/api/index.md +0 -0
  20. {biosigpy-0.3.2 → biosigpy-0.3.3}/docs/api/tools/lpd-filter.md +0 -0
  21. {biosigpy-0.3.2 → biosigpy-0.3.3}/docs/api/tools/medfilt-threshold.md +0 -0
  22. {biosigpy-0.3.2 → biosigpy-0.3.3}/docs/api/tools/nan-filter.md +0 -0
  23. {biosigpy-0.3.2 → biosigpy-0.3.3}/docs/api/tools/nan-filtfilt.md +0 -0
  24. {biosigpy-0.3.2 → biosigpy-0.3.3}/docs/api/tools/snap-to-peak.md +0 -0
  25. {biosigpy-0.3.2 → biosigpy-0.3.3}/docs/index.md +0 -0
  26. {biosigpy-0.3.2 → biosigpy-0.3.3}/docs/installation.md +0 -0
  27. {biosigpy-0.3.2 → biosigpy-0.3.3}/examples/README.md +0 -0
  28. {biosigpy-0.3.2 → biosigpy-0.3.3}/examples/_support/__init__.py +0 -0
  29. {biosigpy-0.3.2 → biosigpy-0.3.3}/examples/_support/figures.py +0 -0
  30. {biosigpy-0.3.2 → biosigpy-0.3.3}/examples/ecg/baselineremove_example.py +0 -0
  31. {biosigpy-0.3.2 → biosigpy-0.3.3}/examples/ecg/pantompkins_example.py +0 -0
  32. {biosigpy-0.3.2 → biosigpy-0.3.3}/examples/ecg/sloperange_example.py +0 -0
  33. {biosigpy-0.3.2 → biosigpy-0.3.3}/examples/fixtures/ecg/medicom_mtd_ecg_respiration.csv +0 -0
  34. {biosigpy-0.3.2 → biosigpy-0.3.3}/examples/fixtures/ecg/medicom_mtd_r_wave_timing.csv +0 -0
  35. {biosigpy-0.3.2 → biosigpy-0.3.3}/examples/hrv/fdmetrics_example.py +0 -0
  36. {biosigpy-0.3.2 → biosigpy-0.3.3}/examples/hrv/fillgaps_example.py +0 -0
  37. {biosigpy-0.3.2 → biosigpy-0.3.3}/examples/hrv/ipfm_example.py +0 -0
  38. {biosigpy-0.3.2 → biosigpy-0.3.3}/examples/hrv/osp_example.py +0 -0
  39. {biosigpy-0.3.2 → biosigpy-0.3.3}/examples/hrv/removefp_example.py +0 -0
  40. {biosigpy-0.3.2 → biosigpy-0.3.3}/examples/hrv/tdmetrics_example.py +0 -0
  41. {biosigpy-0.3.2 → biosigpy-0.3.3}/mkdocs.yml +0 -0
  42. {biosigpy-0.3.2 → biosigpy-0.3.3}/pyproject.toml +0 -0
  43. {biosigpy-0.3.2 → biosigpy-0.3.3}/pytest.ini +0 -0
  44. {biosigpy-0.3.2 → biosigpy-0.3.3}/requirements-dev.txt +0 -0
  45. {biosigpy-0.3.2 → biosigpy-0.3.3}/setup.cfg +0 -0
  46. {biosigpy-0.3.2 → biosigpy-0.3.3}/src/biosigpy/__init__.py +0 -0
  47. {biosigpy-0.3.2 → biosigpy-0.3.3}/src/biosigpy/ecg/__init__.py +0 -0
  48. {biosigpy-0.3.2 → biosigpy-0.3.3}/src/biosigpy/ecg/baselineremove.py +0 -0
  49. {biosigpy-0.3.2 → biosigpy-0.3.3}/src/biosigpy/ecg/pantompkins.py +0 -0
  50. {biosigpy-0.3.2 → biosigpy-0.3.3}/src/biosigpy/ecg/sloperange.py +0 -0
  51. {biosigpy-0.3.2 → biosigpy-0.3.3}/src/biosigpy/hrv/__init__.py +0 -0
  52. {biosigpy-0.3.2 → biosigpy-0.3.3}/src/biosigpy/hrv/_fillgaps_debug.py +0 -0
  53. {biosigpy-0.3.2 → biosigpy-0.3.3}/src/biosigpy/hrv/fdmetrics.py +0 -0
  54. {biosigpy-0.3.2 → biosigpy-0.3.3}/src/biosigpy/hrv/fillgaps.py +0 -0
  55. {biosigpy-0.3.2 → biosigpy-0.3.3}/src/biosigpy/hrv/ipfm.py +0 -0
  56. {biosigpy-0.3.2 → biosigpy-0.3.3}/src/biosigpy/hrv/osp.py +0 -0
  57. {biosigpy-0.3.2 → biosigpy-0.3.3}/src/biosigpy/hrv/removefp.py +0 -0
  58. {biosigpy-0.3.2 → biosigpy-0.3.3}/src/biosigpy/hrv/tdmetrics.py +0 -0
  59. {biosigpy-0.3.2 → biosigpy-0.3.3}/src/biosigpy/tools/__init__.py +0 -0
  60. {biosigpy-0.3.2 → biosigpy-0.3.3}/src/biosigpy/tools/_nan_processing.py +0 -0
  61. {biosigpy-0.3.2 → biosigpy-0.3.3}/src/biosigpy/tools/_validation.py +0 -0
  62. {biosigpy-0.3.2 → biosigpy-0.3.3}/src/biosigpy/tools/lpd_filter.py +0 -0
  63. {biosigpy-0.3.2 → biosigpy-0.3.3}/src/biosigpy/tools/medfilt_threshold.py +0 -0
  64. {biosigpy-0.3.2 → biosigpy-0.3.3}/src/biosigpy/tools/nan_filter.py +0 -0
  65. {biosigpy-0.3.2 → biosigpy-0.3.3}/src/biosigpy/tools/nan_filtfilt.py +0 -0
  66. {biosigpy-0.3.2 → biosigpy-0.3.3}/src/biosigpy.egg-info/SOURCES.txt +0 -0
  67. {biosigpy-0.3.2 → biosigpy-0.3.3}/src/biosigpy.egg-info/dependency_links.txt +0 -0
  68. {biosigpy-0.3.2 → biosigpy-0.3.3}/src/biosigpy.egg-info/requires.txt +0 -0
  69. {biosigpy-0.3.2 → biosigpy-0.3.3}/src/biosigpy.egg-info/top_level.txt +0 -0
  70. {biosigpy-0.3.2 → biosigpy-0.3.3}/tests/conformance.py +0 -0
  71. {biosigpy-0.3.2 → biosigpy-0.3.3}/tests/conftest.py +0 -0
  72. {biosigpy-0.3.2 → biosigpy-0.3.3}/tests/test_baselineremove.py +0 -0
  73. {biosigpy-0.3.2 → biosigpy-0.3.3}/tests/test_conformance_coverage.py +0 -0
  74. {biosigpy-0.3.2 → biosigpy-0.3.3}/tests/test_example_figures.py +0 -0
  75. {biosigpy-0.3.2 → biosigpy-0.3.3}/tests/test_fdmetrics.py +0 -0
  76. {biosigpy-0.3.2 → biosigpy-0.3.3}/tests/test_fillgaps.py +0 -0
  77. {biosigpy-0.3.2 → biosigpy-0.3.3}/tests/test_ipfm.py +0 -0
  78. {biosigpy-0.3.2 → biosigpy-0.3.3}/tests/test_lpd_filter.py +0 -0
  79. {biosigpy-0.3.2 → biosigpy-0.3.3}/tests/test_medfilt_threshold.py +0 -0
  80. {biosigpy-0.3.2 → biosigpy-0.3.3}/tests/test_nan_filter.py +0 -0
  81. {biosigpy-0.3.2 → biosigpy-0.3.3}/tests/test_nan_filtfilt.py +0 -0
  82. {biosigpy-0.3.2 → biosigpy-0.3.3}/tests/test_osp.py +0 -0
  83. {biosigpy-0.3.2 → biosigpy-0.3.3}/tests/test_package_metadata.py +0 -0
  84. {biosigpy-0.3.2 → biosigpy-0.3.3}/tests/test_pantompkins.py +0 -0
  85. {biosigpy-0.3.2 → biosigpy-0.3.3}/tests/test_removefp.py +0 -0
  86. {biosigpy-0.3.2 → biosigpy-0.3.3}/tests/test_sloperange.py +0 -0
  87. {biosigpy-0.3.2 → biosigpy-0.3.3}/tests/test_snap_to_peak.py +0 -0
  88. {biosigpy-0.3.2 → biosigpy-0.3.3}/tests/test_tdmetrics.py +0 -0
@@ -2,6 +2,12 @@
2
2
 
3
3
  This file is the authoritative release history. GitHub Releases reuse the corresponding version section.
4
4
 
5
+ ## 0.3.3 - 2026-08-18
6
+
7
+ - Optimized `tools.snap_to_peak` by indexing NaN gaps once and reusing finite-segment boundaries, eliminating repeated full-signal scans while preserving refined detections.
8
+ - Added a fast path for finite ECG signals and logarithmic gap lookup for signals containing NaN segments.
9
+ - Updated GitHub workflows to `actions/checkout@v7` and `actions/setup-python@v7`, removing the deprecated Node.js 20 action runtime.
10
+
5
11
  ## 0.3.2 - 2026-08-18
6
12
 
7
13
  - Optimized `hrv.osp` by applying the orthogonal projection associatively, avoiding the square projection matrix while preserving the defined decomposition.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: biosigpy
3
- Version: 0.3.2
3
+ Version: 0.3.3
4
4
  Summary: Python implementation of the Biosiglib specifications for biomedical signal processing.
5
5
  License-Expression: GPL-3.0-only
6
6
  Project-URL: Documentation, https://bsicos.github.io/biosigpy/
@@ -1,3 +1,3 @@
1
1
  """Authoritative Biosigpy implementation version."""
2
2
 
3
- __version__ = "0.3.2"
3
+ __version__ = "0.3.3"
@@ -81,6 +81,11 @@ def snap_to_peak(
81
81
  window_size = as_positive_real_scalar(window_size, name="window_size")
82
82
  window_size = _round_positive_half_up(window_size)
83
83
 
84
+ # Reuse gap positions instead of rescanning the finite segment for every
85
+ # detection, which becomes quadratic in practice on gap-free ECG signals.
86
+ nan_indices = np.flatnonzero(np.isnan(ecg))
87
+ has_nan_gaps = nan_indices.size > 0
88
+ last_sample_index = ecg.size - 1
84
89
  refined_detections = np.empty(detections.size, dtype=np.float64)
85
90
  for detection_index, current_detection in enumerate(detections):
86
91
  if np.isnan(current_detection):
@@ -92,7 +97,22 @@ def snap_to_peak(
92
97
  refined_detections[detection_index] = np.nan
93
98
  continue
94
99
 
95
- segment_start, segment_end = _finite_segment_bounds(ecg, current_detection)
100
+ if has_nan_gaps:
101
+ gap_position = int(np.searchsorted(nan_indices, current_detection))
102
+ segment_start = (
103
+ int(nan_indices[gap_position - 1]) + 1
104
+ if gap_position > 0
105
+ else 0
106
+ )
107
+ segment_end = (
108
+ int(nan_indices[gap_position]) - 1
109
+ if gap_position < nan_indices.size
110
+ else last_sample_index
111
+ )
112
+ else:
113
+ segment_start = 0
114
+ segment_end = last_sample_index
115
+
96
116
  window_start = max(segment_start, current_detection - window_size)
97
117
  window_end = min(segment_end, current_detection + window_size)
98
118
  window_signal = ecg[window_start : window_end + 1]
@@ -104,15 +124,3 @@ def snap_to_peak(
104
124
 
105
125
  def _round_positive_half_up(value: float) -> int:
106
126
  return int(np.floor(float(value) + 0.5))
107
-
108
-
109
- def _finite_segment_bounds(ecg: np.ndarray, sample_index: int) -> tuple[int, int]:
110
- segment_start = sample_index
111
- while segment_start > 0 and np.isfinite(ecg[segment_start - 1]):
112
- segment_start -= 1
113
-
114
- segment_end = sample_index
115
- while segment_end + 1 < ecg.size and np.isfinite(ecg[segment_end + 1]):
116
- segment_end += 1
117
-
118
- return segment_start, segment_end
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: biosigpy
3
- Version: 0.3.2
3
+ Version: 0.3.3
4
4
  Summary: Python implementation of the Biosiglib specifications for biomedical signal processing.
5
5
  License-Expression: GPL-3.0-only
6
6
  Project-URL: Documentation, https://bsicos.github.io/biosigpy/
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes