gaussian lowpass
3 changed files+109−0
benchcompress/src/benchcompress/datasets/__init__.pymodified+2−0View file
@@ -1,6 +1,7 @@
11 from .bernoulli import datasets as bernoulli_datasets
22 from .gaussian import datasets as gaussian_datasets
33 from .gaussian_ar1 import datasets as gaussian_ar1_datasets
4+from .gaussian_lowpass import datasets as gaussian_lowpass_datasets
45 from .ecephys import datasets as ecephys_datasets
56 from .seismic import datasets as seismic_datasets
67 from .ieeg import datasets as ieeg_datasets
@@ -10,6 +11,7 @@ datasets_list = [
1011 bernoulli_datasets,
1112 gaussian_datasets,
1213 gaussian_ar1_datasets,
14+ gaussian_lowpass_datasets,
1315 ecephys_datasets,
1416 seismic_datasets,
1517 ieeg_datasets,
benchcompress/src/benchcompress/datasets/gaussian_lowpass/__init__.pyadded+89−0View file
@@ -0,0 +1,89 @@
1+import numpy as np
2+import os
3+
4+SOURCE_FILE = "gaussian_lowpass/__init__.py"
5+
6+
7+def _load_long_description():
8+ current_dir = os.path.dirname(os.path.abspath(__file__))
9+ md_path = os.path.join(current_dir, "gaussian_lowpass.md")
10+ with open(md_path, "r", encoding="utf-8") as f:
11+ return f.read()
12+
13+
14+LONG_DESCRIPTION = _load_long_description()
15+
16+
17+def create_gaussian_lowpass_quantized(
18+ *, n_samples: int, window_size: int, stddev: float, seed: int
19+) -> np.ndarray:
20+ """Generate quantized Gaussian lowpass filtered sequence.
21+
22+ Args:
23+ n_samples: Number of samples to generate
24+ window_size: Size of moving average window
25+ stddev: Standard deviation of initial Gaussian noise
26+ seed: Random seed
27+ """
28+ rng = np.random.default_rng(seed)
29+
30+ # Generate Gaussian noise
31+ x = rng.normal(0, stddev, n_samples)
32+
33+ # Apply moving average filter
34+ # Use 'same' mode to maintain input length, and valid edges
35+ window = np.ones(window_size) / window_size
36+ x_filtered = np.convolve(x, window, mode="same")
37+
38+ # Quantize to integers
39+ x_quantized = np.round(x_filtered).astype(np.int16)
40+ return x_quantized
41+
42+
43+tags = [
44+ "gaussian",
45+ "integer",
46+ "discrete",
47+ "timeseries",
48+ "1d",
49+ "synthetic",
50+ "correlated",
51+ "lowpass",
52+ "filtered",
53+]
54+
55+datasets = [
56+ {
57+ "name": "gaussian-lp-03",
58+ "version": "1",
59+ "create": lambda: create_gaussian_lowpass_quantized(
60+ n_samples=1_000_000, window_size=3, stddev=5, seed=0
61+ ),
62+ "description": "Quantized Gaussian lowpass filtered with window size 3, σ=5.",
63+ "tags": tags,
64+ "source_file": SOURCE_FILE,
65+ "long_description": LONG_DESCRIPTION,
66+ },
67+ {
68+ "name": "gaussian-lp-07",
69+ "version": "1",
70+ "create": lambda: create_gaussian_lowpass_quantized(
71+ n_samples=1_000_000, window_size=7, stddev=5, seed=0
72+ ),
73+ "description": "Quantized Gaussian lowpass filtered with window size 7, σ=5.",
74+ "tags": tags,
75+ "source_file": SOURCE_FILE,
76+ "long_description": LONG_DESCRIPTION,
77+ },
78+ {
79+ "name": "gaussian-lp-15",
80+ "version": "1",
81+ "create": lambda: create_gaussian_lowpass_quantized(
82+ n_samples=1_000_000, window_size=15, stddev=5, seed=0
83+ ),
84+ "description": "Quantized Gaussian lowpass filtered with window size 15, σ=5.",
85+ "tags": tags,
86+ "source_file": SOURCE_FILE,
87+ "long_description": LONG_DESCRIPTION,
88+ },
89+]
benchcompress/src/benchcompress/datasets/gaussian_lowpass/gaussian_lowpass.mdadded+18−0View file
@@ -0,0 +1,18 @@
1+# Gaussian Lowpass Dataset
2+
3+These datasets contain sequences of quantized Gaussian noise that has been smoothed using a moving average (lowpass) filter. The data is generated by:
4+1. Drawing samples from a Gaussian distribution (σ=5)
5+2. Applying a moving average filter of varying window sizes
6+3. Quantizing the filtered result to integers
7+
8+The moving average filter acts as a lowpass filter, attenuating high-frequency components while preserving low-frequency trends. Larger window sizes result in smoother sequences with stronger low-frequency characteristics.
9+
10+## Variants
11+
12+We provide three variants with different window sizes:
13+
14+- gaussian-lp-03 (window=3): Light smoothing
15+- gaussian-lp-07 (window=7): Moderate smoothing
16+- gaussian-lp-15 (window=15): Strong smoothing
17+
18+Each variant uses σ=5 for the initial Gaussian noise and applies integer quantization after filtering to maintain compatibility with integer-based compression algorithms.