Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow slicing with custom step size #59

Merged
merged 5 commits into from
Aug 28, 2023

Conversation

TheLartians
Copy link
Contributor

@TheLartians TheLartians commented Aug 22, 2023

Thanks for this great library!

This PR allows slicing datasets with a specified step size. This is extremely useful if we want to query a high resolution dataset using a lower sample rate than originally recorded, e.g. for performance / bandwidth reasons.

Example:

  const dset = write_file.create_dataset({
    name: "data", 
    data: [0,1,2,3,4,5,6,7,8,9], 
    shape: [10], 
    dtype: "<f4"
  });

 const slice = dset.slice([[null, null, 2]]); // -> [0,2,4,6,8]

@TheLartians TheLartians changed the title Allow slicing with step size Allow slicing with custom step size Aug 22, 2023
@bmaranville
Copy link
Member

Thanks for the very detailed PR - including tests! This will be a nice new feature.

@bmaranville bmaranville merged commit 001c1eb into usnistgov:main Aug 28, 2023
1 check passed
@TheLartians TheLartians deleted the lars/stride-support branch October 30, 2023 15:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants