Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
S
SEIR_SMA
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
SMAC
Reproductibilité des recherches dans SMAC
SEIR_SMA
Commits
5130f6f9
Commit
5130f6f9
authored
3 years ago
by
AxelCarayon
Browse files
Options
Downloads
Patches
Plain Diff
fix code type
parent
bcc24404
Branches
Branches containing commit
Tags
1.3.0
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
SMA-SEIR.iml
+8
-0
8 additions, 0 deletions
SMA-SEIR.iml
outputToGraph.py
+33
-24
33 additions, 24 deletions
outputToGraph.py
with
41 additions
and
24 deletions
SMA-SEIR.iml
0 → 100644
+
8
−
0
View file @
5130f6f9
<?xml version="1.0" encoding="UTF-8"?>
<module
version=
"4"
>
<component
name=
"FacetManager"
>
<facet
type=
"Python"
name=
"Python"
>
<configuration
sdkName=
"Python 3.10 (venv)"
/>
</facet>
</component>
</module>
\ No newline at end of file
This diff is collapsed.
Click to expand it.
outputToGraph.py
+
33
−
24
View file @
5130f6f9
...
...
@@ -7,65 +7,74 @@ OUTPUT_FOLDER = 'src/main/resources/pythonOutput'
JAR_LOCATION
=
'
out/artifacts/SMA_SEIR_jar/SMA-SEIR.jar
'
YAML_FILE
=
'
src/main/resources/parameters.yaml
'
def
readCSV
(
fileName
):
with
open
(
fileName
,
'
r
'
)
as
csvfile
:
def
read_csv
(
filename
):
with
open
(
filename
,
'
r
'
)
as
csvfile
:
reader
=
csv
.
reader
(
csvfile
)
return
list
(
reader
)
def
getValues
()
:
def
get_values
():
with
open
(
YAML_FILE
,
'
r
'
)
as
file
:
data
=
yaml
.
safe_load
(
file
)
incubation
=
data
[
'
incubationRate
'
]
infection
=
data
[
'
infectionRate
'
]
recovery
=
data
[
'
recoveryRate
'
]
looseImmunity
=
data
[
'
looseImmunityRate
'
]
return
f
"
incubationRate :
{
incubation
}
InfectionRate :
{
infection
}
\n
RecoveryRate :
{
recovery
}
LooseImmunityRate :
{
looseImmunity
}
"
loose_immunity
=
data
[
'
looseImmunityRate
'
]
return
f
"
incubationRate :
{
incubation
}
InfectionRate :
{
infection
}
\n
"
\
f
"
RecoveryRate :
{
recovery
}
LooseImmunityRate :
{
loose_immunity
}
"
def
make
D
iagram
(
file
N
ame
):
data
=
read
CSV
(
file
N
ame
)
def
make
_d
iagram
(
file
n
ame
):
data
=
read
_csv
(
file
n
ame
)
suceptible
=
[]
exposed
=
[]
recovred
=
[]
recov
e
red
=
[]
infected
=
[]
for
row
in
data
[
1
:]:
suceptible
.
append
(
int
(
row
[
0
]))
exposed
.
append
(
int
(
row
[
1
]))
recovred
.
append
(
int
(
row
[
2
]))
recov
e
red
.
append
(
int
(
row
[
2
]))
infected
.
append
(
int
(
row
[
3
]))
plt
.
title
(
get
V
alues
())
plt
.
title
(
get
_v
alues
())
plt
.
plot
(
suceptible
,
label
=
'
Suceptible
'
,
color
=
'
gray
'
)
plt
.
plot
(
exposed
,
label
=
'
Exposed
'
,
color
=
'
yellow
'
)
plt
.
plot
(
infected
,
label
=
'
Infected
'
,
color
=
'
red
'
)
plt
.
plot
(
recovred
,
label
=
'
Recovered
'
,
color
=
'
green
'
)
plt
.
plot
(
recov
e
red
,
label
=
'
Recovered
'
,
color
=
'
green
'
)
plt
.
xlabel
(
'
Cycles
'
)
plt
.
ylabel
(
'
Peoples
'
)
plt
.
legend
()
plt
.
savefig
(
f
'
{
file
N
ame
.
split
(
"
.
"
)[
0
]
}
.png
'
)
#plt.show()
plt
.
savefig
(
f
'
{
file
n
ame
.
split
(
"
.
"
)[
0
]
}
.png
'
)
#
plt.show()
plt
.
close
()
def
runJavaJar
(
fileName
):
def
run_java_jar
(
filename
):
import
subprocess
subprocess
.
call
([
'
java
'
,
'
-jar
'
,
fileName
])
subprocess
.
call
([
'
java
'
,
'
-jar
'
,
filename
])
def
copy
ToO
utput
F
older
(
file
N
ame
):
def
copy
_to_o
utput
_f
older
(
file
n
ame
):
import
shutil
shutil
.
copy
(
OUTPUT_FILE_LOCATION
,
f
"
{
OUTPUT_FOLDER
}
/
{
fileName
}
"
)
def
createFile
():
shutil
.
copy
(
OUTPUT_FILE_LOCATION
,
f
"
{
OUTPUT_FOLDER
}
/
{
filename
}
"
)
def
create_file
():
with
open
(
OUTPUT_FILE_LOCATION
,
'
w
'
)
as
file
:
file
.
write
(
''
)
def
editYaml
(
key
,
value
):
def
edit_yaml
(
key
,
value
):
with
open
(
YAML_FILE
,
'
r
'
)
as
file
:
data
=
yaml
.
safe_load
(
file
)
data
[
key
]
=
value
with
open
(
YAML_FILE
,
'
w
'
)
as
file
:
yaml
.
dump
(
data
,
file
)
# if __name__ == "__main__":
# for i in range(10):
# editYaml("infectionRate", 0.05+(0.05*i))
...
...
@@ -73,5 +82,5 @@ def editYaml(key,value):
# copyToOutputFolder(f"output{i}.csv")
# makeDiagram(f"{OUTPUT_FOLDER}/output{i}.csv")
runJavaJar
(
JAR_LOCATION
)
makeDiagram
(
OUTPUT_FILE_LOCATION
)
\ No newline at end of file
run_java_jar
(
JAR_LOCATION
)
make_diagram
(
OUTPUT_FILE_LOCATION
)
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
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!
Save comment
Cancel
Please
register
or
sign in
to comment