Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
NumerikGang
curvepy
Commits
dc8a275a
Commit
dc8a275a
authored
Oct 29, 2021
by
lars.quentin
💬
Browse files
🚧
WIP check_flat tests
parent
2b771ef3
Pipeline
#247466
failed with stages
in 2 minutes and 44 seconds
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
curvepy/debug/debug_utilities.py
View file @
dc8a275a
...
...
@@ -3,9 +3,21 @@ import numpy as np
from
curvepy.utilities
import
distance_to_line
INTERVAL
=
(
-
20
,
20
)
NUMBER_OF_TESTCASES
=
30
def
generate_noisy_lines
(
n
,
interval
,
noise
):
f
=
lambda
:
random
.
randint
(
*
interval
)
res
=
[]
for
_
in
range
(
n
):
a
,
b
=
(
np
.
array
([
f
(),
f
()]),
np
.
array
([
f
(),
f
()]))
m
=
[
a
]
for
_
in
range
(
random
.
randint
(
10
,
21
)):
# 50% to be negative
if
random
.
random
()
<
0.5
:
noise
*=
-
1
lambda_
=
random
.
random
()
m
.
append
((
a
*
lambda_
+
b
*
(
1
-
lambda_
))
+
(
random
.
random
()
*
noise
))
m
.
append
(
b
)
res
.
append
(
m
)
return
res
def
main
():
for
_
in
range
(
NUMBER_OF_TESTCASES
):
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a 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