Skip to content

non-strict window by default #993

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

Merged
merged 1 commit into from
Jul 14, 2022
Merged

non-strict window by default #993

merged 1 commit into from
Jul 14, 2022

Conversation

mbostock
Copy link
Member

I think I agree this should be the default? Also the calling the option strict feels slightly better than extend? (Though maybe fixed would also work? I couldn’t find much precedent though the R runner package uses na_pad and defaults to non-strict).

Also the window transform was assuming that the input index is a typed array, but at least in the case of the map transform and a z channel, it may be a regular array. We still want to use subarray if available because it’s faster, and it’s probably not worth changing the map transform to generate Uint32Array, so I added a workaround in the window transform; I can take a different approach if you prefer.

@mbostock mbostock requested a review from Fil July 14, 2022 20:02
Copy link
Contributor

@Fil Fil left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👌

@mbostock
Copy link
Member Author

Oh, another possibility is that the strict option could allow NaN input data to be ignored, too. For example if you have one NaN value within the window currently, the mean value is always NaN because reduceSum requires the data to be fully defined (nans === 0):

T[I[i + s]] = nans === 0 ? sum : NaN;

We’d probably want a separate option for that, though… so maybe strict isn’t a great name?

@mbostock mbostock merged commit 9049e81 into main Jul 14, 2022
@mbostock mbostock deleted the mbostock/strict-window branch July 14, 2022 23:01
@mbostock mbostock mentioned this pull request Jul 15, 2022
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.

2 participants