-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Update _array.py * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * Update _array.py * Create signed.py * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * Update _array.py * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * Update _array.py * signed -> guess_signed make function more robust as well * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * tests pass correct the guess function * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * Update CHANGELOG.md * Update WrightTools/kit/_array.py * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --------- Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> Co-authored-by: Daniel Kohler <[email protected]>
- Loading branch information
1 parent
f772f2c
commit 1a2fbb9
Showing
3 changed files
with
67 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
"""Test guess_signed""" | ||
|
||
# --- import ------------------------------------------------------------------------------------- | ||
|
||
|
||
import numpy as np | ||
import WrightTools as wt | ||
|
||
|
||
# --- test --------------------------------------------------------------------------------------- | ||
|
||
|
||
def test_many_ranges(): | ||
for minmax, signed in [ | ||
([-0.05, 1], False), | ||
([-1, 0.05], False), | ||
([-1, 1], True), | ||
([0, 0], True), | ||
([0, -1], False), | ||
([-1, 0.5], True), | ||
]: | ||
assert wt.kit.guess_signed(np.array(minmax)) == signed | ||
|
||
|
||
def test_channel(): | ||
d = wt.Data() | ||
chan = d.create_channel("chan", values=np.linspace(3, 4, 16).reshape(4, 4)) | ||
assert wt.kit.guess_signed(chan) == False | ||
chan.null = 3.5 | ||
assert wt.kit.guess_signed(chan) |