Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Grégoire Grzeczkowicz
sho
Commits
18bd67ed
Commit
18bd67ed
authored
Nov 02, 2020
by
Grégoire Grzeczkowicz
Browse files
Add label
parent
633ddf25
Changes
2
Hide whitespace changes
Inline
Side-by-side
draw_ert.py
View file @
18bd67ed
...
...
@@ -33,7 +33,7 @@ if __name__=="__main__":
for
i
in
range
(
the
.
nb_run
):
print
(
"
\r
Run {}"
.
format
(
i
),
end
=
''
)
system
(
"python3 snp.py -o run -no "
+
" "
.
join
(
arg
[
1
]))
system
(
"python3 snp.py -o run -no
-s "
+
str
(
np
.
random
.
randint
(
0
,
10
*
the
.
nb_run
))
+
"
"
+
" "
.
join
(
arg
[
1
]))
print
(
"
\r
"
)
# Data extraction
...
...
@@ -70,7 +70,7 @@ if __name__=="__main__":
for
attempt
in
data
:
good
=
False
for
t
,
v
in
attempt
.
items
():
if
t
<
time
and
v
>
value
:
if
t
<
=
time
and
v
>
=
value
:
good
=
True
break
if
good
:
...
...
@@ -84,19 +84,33 @@ if __name__=="__main__":
with
open
(
'proba.json'
,
'w'
)
as
outfile
:
json
.
dump
(
data
,
outfile
)
elif
the
.
for_value
is
not
None
:
temps
=
np
.
linspace
(
0
,
temps_max
,
100
)
P
=
probability
(
data
,
temps
,
the
.
for_value
)
plt
.
plot
(
temps
,
P
)
P
=
probability
(
data
,
range
(
1
,
temps_max
+
1
),
the
.
for_value
)
plt
.
bar
(
range
(
1
,
temps_max
+
1
),
P
)
plt
.
title
(
"ERT for target {}"
.
format
(
the
.
for_value
))
plt
.
xlabel
(
'run'
)
plt
.
ylabel
(
'probability'
)
plt
.
ylim
(
0
,
1
)
plt
.
show
()
else
:
temps
=
np
.
linspac
e
(
0
,
temps_max
,
100
)
values
=
np
.
linspace
(
0
,
value_max
,
100
)
temps
=
rang
e
(
0
,
temps_max
+
2
)
values
=
range
(
0
,
int
(
value_max
+
2
)
)
X
,
Y
=
np
.
meshgrid
(
temps
,
values
)
Z
=
probability
(
data
,
X
,
Y
)
print
(
Z
)
"""
fig, ax = plt.subplots()
cs = ax.contourf(X, Y, Z, 20)
cbar = fig.colorbar(cs)
"""
proba
=
np
.
linspace
(
0.0
,
1.0
,
11
)
cs
=
plt
.
contourf
(
X
,
Y
,
Z
,
levels
=
proba
)
cbar
=
plt
.
colorbar
(
cs
)
cbar
.
set_label
(
'probability'
)
plt
.
xlabel
(
'run'
)
plt
.
ylabel
(
'target'
)
plt
.
show
()
#remove('run.csv')
try_solver.py
View file @
18bd67ed
...
...
@@ -41,7 +41,7 @@ def probability(data,time,value):
for
attempt
in
data
:
good
=
False
for
t
,
v
in
attempt
.
items
():
if
int
(
t
)
<
time
and
v
>
value
:
if
int
(
t
)
<
=
time
and
v
>
=
value
:
good
=
True
break
if
good
:
...
...
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