Skip to content

Conversation

@dshemetov
Copy link
Contributor

@dshemetov dshemetov commented Nov 10, 2020

It seemed that there were many cases in JHU tests that required the smoother to be able to act on an array full of nans, so instead of throwing an error, I improved things to be more graceful.

Basically handles the following cases:

  • the entire array is nans, in which case the array is returned
  • the array begins left-padded with nans, in which case the nans are truncated, the remaining signal is smoothed, and the nans are appended back before being returned
  • fixes a couple edge cases where the polynomial degree size or the window length is larger than the number of data points

Its base is #476, so should be merged after.

if self.impute_method not in valid_impute_methods:
raise ValueError("Invalid impute method given.")
if self.window_length <= 1:
raise ValueError("Window length is too short.")
Copy link
Contributor

Choose a reason for hiding this comment

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

add test for this error

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done.

@dshemetov dshemetov force-pushed the fix_smoother_nan_handling branch 4 times, most recently from 4421f28 to 6d2ef32 Compare November 10, 2020 23:48
* entire array of nans is handled
* left-padded nans are now ignored
* a few other edge cases
* add tests to match
@dshemetov dshemetov force-pushed the fix_smoother_nan_handling branch from 6d2ef32 to 4ad4c39 Compare November 10, 2020 23:55
Copy link
Contributor

@chinandrew chinandrew left a comment

Choose a reason for hiding this comment

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

theres a whitespace hanging around, otherwise :shipit: :shipit: :shipit:

@dshemetov
Copy link
Contributor Author

fixed! do you know if there's a way to merge commits without having to reset and force push every time?

@chinandrew
Copy link
Contributor

fixed! do you know if there's a way to merge commits without having to reset and force push every time?

If the commits were previously pushed to the remote branch, I think you'll have to force push after squashing.

@dshemetov
Copy link
Contributor Author

I hope github doesn't send emails every time I do that?

@chinandrew
Copy link
Contributor

I hope github doesn't send emails every time I do that?

I get github emails for all new commits on every PR, so my signal to noise ratio is pretty bad already. I just use a filter for the ones that I'm reviewing or am mentioned in and it works alright.

@dshemetov
Copy link
Contributor Author

Oh no. I'm sorry for everyone's inboxes. Chains of dependent PRs: not even once.

@krivard krivard merged commit 4ef13f5 into main Nov 11, 2020
@krivard krivard deleted the fix_smoother_nan_handling branch November 11, 2020 14:33
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.

4 participants