webit/downsampling

Downsampling algorithms

2.0.0 2022-01-24 09:12 UTC

This package is auto-updated.

Last update: 2024-04-24 13:59:10 UTC


README

A simple interface for Downsampling algorithms

Installation

via Composer

Add the webit/downsampling into composer.json

{
    "require": {
        "php":              ">=7.1",
        "webit/downsampling": "^2.0.0"
    }
}

Usage

use Webit\DownSampling\DownSampler\LargestTriangleThreeBucketsDownSampler;

$data = array();
for ($i=0; $i < 500; $i++) {
    $data[] = [$i, mt_rand(0, 200)];
}

$sampler = new LargestTriangleThreeBucketsDownSampler();
$sampled = $sampler->sampleDown($data, 100);
echo count($sampled); // displays 100

Algorithms provided