Smart Arrays Compress

What the package can do for you

The compression algorithms provided by this package don't have anything to do with audio or video compression. Instead, their purpose is to reduce large arrays to a size suitable for fast interactive viewing on a screen by retaining significant aspects of the array data. For this purpose an array is fragmented into intervals (1D) or submatrices (2D). The minimum and maximum values in these regions constitue the compressed array. You would apply the algorithms to arrays with thousands, ten thousands or even millions of elements. The reduced size should, for example, be chosen to match display resolution if compression is applied for data viewing.

The package also provides a class that expands an array to a larger size by inserting extra points whose values are computed from their neighbours by linear interpolation of the array data.

The major API functionalities

  • class CompressedArray1D

This example will compress the large specified 1D array to a size of 200 points:

CompressedArray1D c1d = CompressedArray1D.compress(array, 0, array.length - 1, false, 200);

The result is available in c1d.cArray.

  • class CompressedArray2D:

This example will compress the large specified 2D array to a size of 200 x 500 points:

CompressedArray2D c2d = CompressedArray2D();

c2d.compress(matrix, 0, matrix.length - 1, 0, matrix[0].length - 1, 200, 500, true);

The result is available in c2d.cvalsPos and c2d.cvalsNeg.

  • class ArrayInterpolator

Example:

List<double> list = [1.0,5.0,3.0,-10.0, -20.0,6.0,4.0,0.0];

Float64List list64 = new Float64List.fromList(list);

Float64List result = ArrayInterpolator.interpolateArray(list64, 4);

Expands an array to a larger size.

Detailed API

Please view the detailed API documentation in the API reference of this package (sidebar at the right of this page).

Using this package

You need Dart 2.0 or later.

Import the package using:

  • import 'package:smart_arrays_compress/smart_arrays.dart_compress';

smart_arrays_base: Basic functions for 1D and 2D arrays

smart_arrays_peaks: Pick peaks in 1D and 2D arrays

smart_lorentz_gauss: Compute Lorentz-Gauss (pseudo-Voigt) line shapes.

Libraries

smart_arrays_compress