TerseTS documentation

Understand the compression workflows, quality controls, output metrics, native library, and HTTP API.

Where to start

Use the console

Load a time series and choose Compress, Benchmark, Build, or Optimize. No local installation is required.

Open the console

Integrate the library

Use the Zig library directly or its C, Python, Rust, and Julia bindings.

Browse the Zig reference

Call the HTTP API

Use the same compression operations as the browser from an application or script.

Open Swagger UI

Core console workflows

1

Compress one way

Run one lossless or lossy compression method. Inspect compressed size, compression ratio, error bound, execution time, reconstruction metrics, and the original-versus-reconstructed plot. Download the compressed payload or the reconstructed CSV.

2

Benchmark alternatives

Compare lossless compression methods by ratio and throughput, or sweep lossy compression methods over equivalent quality or size controls and compare RMSE against compression ratio. Lossless results report compression and decompression time separately.

3

Build a pipeline

Combine a logical compression method, a lossless indices compression method, and a coefficient compression method. Compare the complete pipeline with its logical and coefficient stages on the same input.

4

Optimize the trade-off

Search pipeline configurations asynchronously. Choose how strongly to weight reconstruction quality versus compression ratio, then inspect ranked results as they become available.

Choose a compression approach

ApproachWhat it changesUse it when
LosslessSerialized representation onlyEvery input bit must reconstruct exactly
Logical-level lossySeries shape using segments, transforms, or downsamplingControlled approximation can provide higher compression
Physical-level lossyNumeric value representation or precisionYou want compact raw values or model coefficients
IndicesInteger representation of segment positionsYou are building a multi-stage pipeline

Practical starting point: use Compress when you already know the compression method, Benchmark when you need to compare options, Build when you need direct pipeline control, and Optimize when you want TerseTS to search for the current series.

Parameters are compression-method specific

The library configuration supports absolute (abs_error_bound) and relative (rel_error_bound) error bounds. The console presents its error bound as a percentage of the series range and converts it to an absolute value:

absolute bound = percentage / 100 * (maximum value - minimum value)
Compression method categoryControl used by TerseTS
Most logical and physical lossy compression methodsMaximum per-point deviation
Bottom-up and Sliding-windowRMSE bound
Visvalingam-WhyattArea-under-curve error bound
DFTNumber of retained coefficients
LTTBTarget retained-point count
BitPackedBUFF and CamelDecimal precision in digits
Lossless and indices compression methodsNo quality parameter

DFT and LTTB default to a size budget around 25% of the series length. The Compress and Build logical controls default to a 3% range-based bound. The Build coefficient bound defaults to 0.01% because coefficient errors can be amplified during reconstruction.

Read the output

MetricMeaningDirection
Compression ratioOriginal bytes divided by compressed bytesHigher is better
Absolute error boundConfigured error threshold in the original series unitsLower favors accuracy
MAEMean absolute reconstruction error in the original unitsLower is better
RMSERoot mean squared reconstruction error in the original unitsLower is better
MAPEMean absolute percentage error; Compress internally uses normalized MAAPE when zero or near-zero inputs would make MAPE unstableLower is better
NRMSERMSE as a percentage of the original series range; unavailable when that range is zeroLower is better
RewardAlpha-weighted Optimize score combining reconstruction quality and a compression score derived from compression ratioHigher is better
Execution timeCompression wall-clock timeLower is faster

Optimize ranks available candidates with alpha * reconstruction_quality + (1 - alpha) * compression_score. An alpha of 0.5 weights both signals equally; larger values favor reconstruction quality. The console displays compression ratio; internally, error and ratio are converted to bounded scores so they can be combined reliably.

Workflow behavior

All workflows accept up to 100,000 finite numeric points. Compress, Benchmark, and Build return their results when the requested calculation finishes. Optimize can take longer, so its ranked options appear automatically while you continue using the other tabs.

For more usage detail, read the console guide or open the API reference from the console footer.

Library quick start

TerseTS is implemented in Zig and exposes Zig and C APIs plus language bindings. Compression methods are selected from the Method enum and configured with a small JSON object.

Python

from tersets import compress, decompress, Method

values = [1.0, 2.0, 3.0, 4.0, 5.0]
compressed = compress(values, Method.SwingFilter, {"abs_error_bound": 0.1})
restored   = decompress(compressed)

Zig

const tersets = @import("path/to/tersets.zig");

var values = [_]f64{ 1.0, 2.0, 3.0, 4.0, 5.0 };
var compressed = try tersets.compress(allocator, values, .SwingFilter, "{ \"abs_error_bound\": 0.1 }");
defer compressed.deinit();
var restored = try tersets.decompress(allocator, compressed);
defer restored.deinit();

Rust

use tersets::{Method, compress, decompress};

let values = vec![1.0, 2.0, 3.0, 4.0, 5.0];
let compressed = compress(&values, Method::SwingFilter, "{\"abs_error_bound\": 0.1}")?;
let restored   = decompress(&compressed)?;

C and Julia examples, compilation instructions, and linking details are available in the library README.