-
Notifications
You must be signed in to change notification settings - Fork 18
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Better Handling of zero median values in Kernel Width (#160)
* Filter zeros out of median computation * removing IDE files from commit --------- Signed-off-by: Nicholas Parente <[email protected]> Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
- Loading branch information
1 parent
9d732dd
commit f0affa5
Showing
4 changed files
with
23 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
import numpy as np | ||
|
||
from dodiscover.toporder.utils import kernel_width | ||
|
||
|
||
def test_kernel_width_when_zero_median_pairwise_distances(): | ||
arr = np.zeros((100, 1), dtype=np.int64) | ||
arr[1] = 1 | ||
assert kernel_width(arr) == 1 | ||
|
||
|
||
def test_kernel_width_when_all_zero_pairwise_distances(): | ||
arr = np.ones((100, 1), dtype=np.int64) | ||
assert kernel_width(arr) == 1 |