ts_shape.events.quality.sampling_resolution
Classes
| Name | Description |
|---|---|
SamplingResolutionEvents | Quality: Sampling & Resolution Analysis |
SamplingResolutionEvents
SamplingResolutionEvents(
dataframe: pd.DataFrame,
signal_uuid: str,
*,
value_column: str = "value_double",
event_uuid: str = "quality:sampling_resolution",
time_column: str = "systime"
) -> None
Bases: Base
Quality: Sampling & Resolution Analysis
Analyze digital measurement system limitations: quantization effects, effective resolution, aliasing detection, and sampling synchronization/jitter.
Methods:
- detect_quantization: Detect A/D quantization in measurements.
- effective_resolution: Estimate effective vs theoretical resolution.
- detect_aliasing: Check for Nyquist violations via FFT.
- sampling_jitter: Measure timing regularity of sampling.
Functions
| Name | Description |
|---|---|
detect_quantization | Detect A/D quantization effects in measurements. |
effective_resolution | Estimate effective measurement resolution from data. |
detect_aliasing | Check for Nyquist violations using FFT. |
sampling_jitter | Measure timing jitter (variation in sampling interval). |
Parameters
| Name | Type | Description | Default |
|---|---|---|---|
dataframe | DataFrame | Long-format timeseries frame (one row per sample, uuid identifies the signal). | required |
signal_uuid | str | UUID of the signal to analyze. | required |
value_column | str | Column holding the signal values. | 'value_double' |
event_uuid | str | UUID stamped on emitted events. | 'quality:sampling_resolution' |
time_column | str | Timestamp column. | 'systime' |
detect_quantization
detect_quantization(
window: str = "1h", threshold_ratio: float = 0.3
) -> pd.DataFrame
Detect A/D quantization effects in measurements.
Identifies if measurements are clustered at discrete levels rather than continuously distributed.
Parameters
| Name | Type | Description | Default |
|---|---|---|---|
window | str | Resample window size. | '1h' |
threshold_ratio | float | Ratio of unique values to expected unique below which signal is flagged as quantized. | 0.3 |
Returns
| Type | Description |
|---|---|
DataFrame | Summary DataFrame with columns: start, end, duration_seconds |
DataFrame | (the window bounds), window_start (the resample label; a |
DataFrame | deprecated twin of start), n_unique_values, |
DataFrame | unique_value_count, expected_unique, quantization_step, |
DataFrame | quantization_ratio, quantized. |
DataFrame | Canonical twin columns: unique_value_count (after |
DataFrame | n_unique_values); it holds the same values as the deprecated |
DataFrame | column right before it, which is removed in the next major |
DataFrame | release. |
effective_resolution
effective_resolution(window: str = '1h') -> pd.DataFrame
Estimate effective measurement resolution from data.
Parameters
| Name | Type | Description | Default |
|---|---|---|---|
window | str | Resample window size. | '1h' |
Returns
| Type | Description |
|---|---|
DataFrame | Summary DataFrame with columns: start, end, duration_seconds |
DataFrame | (the window bounds), window_start (the resample label; a |
DataFrame | deprecated twin of start), theoretical_resolution, |
DataFrame | effective_resolution, resolution_ratio, resolution_factor |
DataFrame | (effective / theoretical resolution; 1 or more, not a 0-1 |
DataFrame | fraction), assessment. |
DataFrame | Canonical twin columns: resolution_factor (after |
DataFrame | resolution_ratio); it holds the same values as the deprecated |
DataFrame | column right before it, which is removed in the next major |
DataFrame | release. |
detect_aliasing
detect_aliasing(
window: str = "1h", expected_frequency_hz: float | None = None
) -> pd.DataFrame
Check for Nyquist violations using FFT.
Parameters
| Name | Type | Description | Default |
|---|---|---|---|
window | str | Resample window size. | '1h' |
expected_frequency_hz | float | None | Known process frequency in Hz. If None, dominant frequency is estimated from FFT. | None |
NaN values are dropped before the FFT, and the sampling rate is estimated from the timestamps of the remaining values: a 1 s grid with every other value NaN samples at 0.5 Hz.
Returns
| Type | Description |
|---|---|
DataFrame | Summary DataFrame with columns: start, end, duration_seconds |
DataFrame | (the window bounds), window_start (the resample label; a |
DataFrame | deprecated twin of start), sampling_rate_hz, |
DataFrame | nyquist_hz, dominant_frequency, aliasing_risk. |
sampling_jitter
sampling_jitter(window: str = '1h') -> pd.DataFrame
Measure timing jitter (variation in sampling interval).
Parameters
| Name | Type | Description | Default |
|---|---|---|---|
window | str | Resample window size. | '1h' |
Returns
| Type | Description |
|---|---|
DataFrame | Summary DataFrame with columns: start, end, duration_seconds |
DataFrame | (the window bounds), window_start (the resample label; a |
DataFrame | deprecated twin of start), mean_interval_ms, |
DataFrame | mean_interval_seconds, std_interval_ms, std_interval_seconds, |
DataFrame | jitter_pct, max_gap_ms, max_gap_seconds, regularity_score. Each |
DataFrame | *_seconds column follows its legacy *_ms twin (the same |
DataFrame | value in seconds); the *_ms columns are deprecated. |