Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Daniel Scheffler
py_tools_ds
Commits
7f695370
Commit
7f695370
authored
Dec 03, 2018
by
Daniel Scheffler
Browse files
Bugfix for find_nearest(). Updated version info.
parent
73a7caf5
Pipeline
#3313
passed with stages
in 19 minutes and 9 seconds
Changes
2
Pipelines
2
Hide whitespace changes
Inline
Side-by-side
py_tools_ds/numeric/vector.py
View file @
7f695370
...
...
@@ -31,9 +31,9 @@ def find_nearest(array, value, roundAlg='auto', extrapolate=False, exclude_val=F
if
extrapolate
:
increment
=
abs
(
array
[
1
]
-
array
[
0
])
if
value
>
max
(
array
):
# expand array until value
array
=
np
.
arange
(
min
(
array
),
value
+
increment
,
increment
)
array
=
np
.
arange
(
min
(
array
),
value
+
2
*
increment
,
increment
)
# 2 * inc to make array_sub work below
if
value
<
min
(
array
):
# negatively expand array until value
array
=
(
np
.
arange
(
max
(
array
),
value
-
increment
,
-
increment
))[::
-
1
]
array
=
(
np
.
arange
(
max
(
array
),
value
-
2
*
increment
,
-
increment
))[::
-
1
]
elif
value
<
min
(
array
)
or
value
>
max
(
array
):
raise
ValueError
(
'Value %s is outside of the given array.'
%
value
)
...
...
py_tools_ds/version.py
View file @
7f695370
__version__
=
'0.13.
3
'
__versionalias__
=
'20181203_0
2
'
__version__
=
'0.13.
4
'
__versionalias__
=
'20181203_0
3
'
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment