Signal Analysis (EDF/BDF format selection)¶
The signal-analysis routines behind automatic EDF/BDF format selection: SVD- and FFT-based dynamic-range estimation and the resulting 16-bit (EDF) vs 24-bit (BDF) suitability decision. See EDF/BDF Format Selection.
Module Documentation¶
biosigio.analysis.signal
¶
Signal analysis functions for EMG data.
This module provides functions for analyzing EMG signals, including noise floor estimation, dynamic range calculation, and format suitability determination.
analyze_signal(signal, method='svd', fft_noise_range=None, svd_rank=None)
¶
Analyze signal characteristics including noise floor and dynamic range.
Args: signal: Input signal array method: Method for noise floor estimation: 'svd' (default), 'fft', or 'both' fft_noise_range: Optional tuple (min_freq, max_freq) for FFT method svd_rank: Optional rank cutoff for SVD method
Returns: dict: Analysis results including range, noise floor, and dynamic range in dB
Source code in biosigio/analysis/signal.py
167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 | |
analyze_signal_fft(detrended, fft_noise_range=None)
¶
Estimate noise floor using enhanced FFT-based method.
Args: detrended: Detrended signal array fft_noise_range: Optional tuple (min_freq, max_freq) specifying frequency range for noise
Returns: float: Estimated noise floor
Source code in biosigio/analysis/signal.py
analyze_signal_svd(detrended, svd_rank=None)
¶
Estimate noise floor using SVD-based method with automatic elbow detection.
Args: detrended: Detrended signal array svd_rank: Optional manual rank cutoff for signal/noise separation
Returns: float: Estimated noise floor
Source code in biosigio/analysis/signal.py
determine_format_suitability(signal, analysis)
¶
Determine whether EDF or BDF format is suitable for the signal.
Args: signal: Input signal array analysis: Signal analysis results from analyze_signal()
Returns: tuple: (use_bdf, reason, snr_db)
Source code in biosigio/analysis/signal.py
find_elbow_point(singular_values)
¶
Find the elbow point in singular values using the second derivative method.
Args: singular_values: Array of singular values from SVD
Returns: int: Index of the elbow point
Source code in biosigio/analysis/signal.py
quantization_analysis(signal, bits)
¶
Perform detailed quantization error analysis.
Args: signal: Input signal array bits: Number of bits (16 for EDF, 24 for BDF)
Returns: dict: Analysis results including step size, errors, and SNR