Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/ci-tsdownsample.yml
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ jobs:
# Perhaps smth more in line with this https://github.com/messense/crfs-rs/blob/main/.github/workflows/Python.yml
name: build on ${{ matrix.os }} (${{ matrix.target }} - ${{ matrix.manylinux || 'auto' }})
# only run on push to main and on release
if: "success() && (startsWith(github.ref, 'refs/tags/') || github.ref == 'refs/heads/main' || contains(github.event.pull_request.labels.*.name, 'Full Build'))"
# if: "success() && (startsWith(github.ref, 'refs/tags/') || github.ref == 'refs/heads/main' || contains(github.event.pull_request.labels.*.name, 'Full Build'))"
strategy:
fail-fast: false
matrix:
Expand Down Expand Up @@ -166,7 +166,7 @@ jobs:

Release:
needs: [Lint_and_Check, Test, Build]
if: "success() && startsWith(github.ref, 'refs/tags/')"
# if: "success() && startsWith(github.ref, 'refs/tags/')"
runs-on: ubuntu-latest

steps:
Expand Down
6 changes: 3 additions & 3 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,10 @@ license = "MIT"

[dependencies]
downsample_rs = { path = "downsample_rs", features = ["half"]}
pyo3 = { version = "0.26", features = ["extension-module"] }
pyo3 = { version = "0.26", features = ["extension-module", "generate-import-lib"] }
numpy = { version = "0.26", features = ["half"] }
half = { version = "2.3.1", default-features = false }
paste = { version = "1.0.14", default-features = false }
half = { version = "2.6", default-features = false }
paste = { version = "1.0", default-features = false }

[lib]
name = "tsdownsample"
Expand Down
14 changes: 7 additions & 7 deletions downsample_rs/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,16 +8,16 @@ license = "MIT"

[dependencies]
# TODO: perhaps use polars?
argminmax = { version = "0.6.1", features = ["half"] }
half = { version = "2.3.1", default-features = false , features=["num-traits"], optional = true}
num-traits = { version = "0.2.17", default-features = false }
argminmax = { version = "0.6", features = ["half"] }
half = { version = "2.7", default-features = false , features=["num-traits"], optional = true}
num-traits = { version = "0.2", default-features = false }
once_cell = "1"
rayon = { version = "1.8.0", default-features = false }
rayon = { version = "1", default-features = false }

[dev-dependencies]
rstest = { version = "0.18.2", default-features = false }
rstest_reuse = { version = "0.6", default-features = false }
criterion = "0.5.1"
rstest = { version = "0.26", default-features = false }
rstest_reuse = { version = "0.7", default-features = false }
criterion = "0.7"
dev_utils = { path = "dev_utils" }

[[bench]]
Expand Down
5 changes: 3 additions & 2 deletions downsample_rs/dev_utils/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,6 @@ edition = "2021"
description = "Shared utilities for development (tests & benchmarks)"

[dependencies]
rand = { version = "0.7.2", default-features = false }
rand_distr = { version = "0.2.2", default-features = false }
num-traits = { version = "0.2", default-features = false }
half = { version = "2.7", default-features = false, features = ["num-traits", "rand_distr"] }
rand = { version = "0.9", default-features = false }
30 changes: 23 additions & 7 deletions downsample_rs/dev_utils/src/utils.rs
Original file line number Diff line number Diff line change
@@ -1,17 +1,33 @@
use std::ops::{Add, Sub};

use rand::{thread_rng, Rng};
use rand_distr::Uniform;
use num_traits::{NumCast, ToPrimitive};
use rand::distr::uniform::Error as UniformError;
use rand::distr::Uniform;
use rand::{rng, Rng};

// random array that samples between min and max of T
pub fn get_random_array<T>(n: usize, min_value: T, max_value: T) -> Vec<T>
where
T: Copy + rand::distributions::uniform::SampleUniform,
T: Copy + rand::distr::uniform::SampleUniform + ToPrimitive + NumCast,
{
let rng = thread_rng();
let uni = Uniform::new_inclusive(min_value, max_value);
let arr: Vec<T> = rng.sample_iter(uni).take(n).collect();
arr
let rng = rng();
match Uniform::new_inclusive(min_value, max_value) {
Ok(uni) => rng.sample_iter(uni).take(n).collect(),
Err(UniformError::NonFinite) => {
let min = min_value
.to_f64()
.expect("failed to convert lower bound to f64");
let max = max_value
.to_f64()
.expect("failed to convert upper bound to f64");
let uni = Uniform::new_inclusive(min, max).unwrap();
rng.sample_iter(uni)
.take(n)
.map(|v| NumCast::from(v).expect("failed to convert sample"))
.collect()
}
Err(err) => panic!("invalid range for random array: {err:?}"),
}
}

// worst case array that alternates between increasing max and decreasing min values
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ build-backend = "maturin"
[project]
name = "tsdownsample"
description = "Time series downsampling in rust"
version = "0.1.4.1"
version = "0.1.5"
requires-python = ">=3.8"
dependencies = ["numpy"]
authors = [{name = "Jeroen Van Der Donckt"}]
Expand Down
2 changes: 1 addition & 1 deletion tsdownsample/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
NaNMinMaxLTTBDownsampler,
)

__version__ = "0.1.4.1"
__version__ = "0.1.5"
__author__ = "Jeroen Van Der Donckt"

__all__ = [
Expand Down
Loading