Skip to main content

Overview

Lossy compression tools for smooth data series. WIP

  • Free software: MIT license

Installation

pip install limesqueezer

You can also install the in-development version with:

pip install https://github.com/limespy/limesqueezer/archive/master.zip

Documentation

Examples

limesqueezer uses numpy ndarrays types for input and output. The package itself with author-recommended abbreviation. Rest of documentation uses this abbreviation.

import numpy as np
import limesqueezer as  ls

You have some data from system of equations For example, let’s take 100 000 datapoints along some function

input_x = np.linspace(0, 1, int(1e5))
input_y = np.sin(6 * input_x * input_x)

Now you want to compress it with maximum absolute error being 1e-3.

Or maybe you have some generator-like thing that gives out numbers. E.g. some simulation step Here you use the context manager “Stream” Initialise with first values, here I am just going to use the first

Block

To simplify the interface, the package has beem made callable.

output_x, output_y = ls(input_x, input_y, tol = 1e-3)

You can also use

output_x, output_y = ls.compress(input_x, input_y, tol = 1e-3)

if that is more comfortable for you.

Stream

example_x0, example_y0 = input_x[0], input_y[0]
generator = zip(input_x[1:], input_y[1:])

The context manager for stream data is called ‘Stream’.

with ls.Stream(example_x0, example_y0, tol = 1e-3) as record:
    for example_x_value, example_y_value in generator:
        record(example_x_value, example_y_value)

Using record.x or record.y in the with statement block results in attribute error, as those attributes are generated only when the record is closed.

If you want to access the data fed to the record, you can use

x_compressed, y_compressed = record.xc, record.yc

to access the already compressed data and

x_buffered, y_buffered = record.xb, record.yb

to access the buffered data that is waiting more values or closing of the record to be compressed.

A side mote: In English language the word ‘record’ can be either verb or noun and since it performs this double role of both taking in data and being storage of the data, it is a fitting name for the object

output_x, output_y = record.x, record.y
print(record.state)
print(record.__str__)

Changelog

1.0.10 (2021-11-30)

  • Cleaned documentation

1.0.9 (2022-04-03)

  • Block and stream compression are much more uniform

  • Restructuring

  • Tests

  • Profiling

1.0.8 (2022-03-20)

  • Step-by-step style ploting of the compression.

1.0.3 (2021-11-30)

  • First release on PyPI.

Metadata

Release files for limesqueezer 1.0.10

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for limesqueezer 1.0.10
File Size Uploaded
limesqueezer-1.0.10.tar.gz 293.7 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for limesqueezer 1.0.10
File Interpreter ABI Platform
limesqueezer-1.0.10-py2.py3-none-any.whl Python 2, Python 3 none any Details

Total release size: 316.9 kB

Release files / limesqueezer-1.0.10.tar.gz

Download URL limesqueezer-1.0.10.tar.gz
Size 293.7 kB
Tags Source
SHA-256 checksum
How to use checksums
7add9de7fbcf44df7895e9e8e0d6cc84bb5abc4430fd7f8d68a7426da85efb50
BLAKE2b-256 checksum
How to use checksums
a9406c778cdbc8efc1686b12d3fb0d41486f0a713f86237efe7dd3ea37d5f987
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.0 CPython/3.10.2

Release files / limesqueezer-1.0.10-py2.py3-none-any.whl

Download URL limesqueezer-1.0.10-py2.py3-none-any.whl
Size 23.2 kB
Tags Python 2 Python 3
SHA-256 checksum
How to use checksums
a7bc7a15efbd65e17d5ef0b5ec30569cccffb30fb0e087648f4237a821cd0171
BLAKE2b-256 checksum
How to use checksums
f872f6861e624d0799fede87ced46196b9c7db9c2a5373148f6b89dde3a42a79
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.0 CPython/3.10.2

Release history Release notifications | RSS feed

1.0.13

2 release files

1.0.12

2 release files

1.0.11

2 release files

This release

1.0.10 This release

2 release files

1.0.9

2 release files

1.0.8

2 release files

1.0.7

1 release file

1.0.6

2 release files

1.0.5

2 release files

1.0.4

2 release files

1.0.3

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page