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
geopat
geopat
Commits
6e3cd67c
Commit
6e3cd67c
authored
May 06, 2019
by
Dumoulin Nicolas
Browse files
output data enhancement
parent
e73b9bf3
Changes
1
Hide whitespace changes
Inline
Side-by-side
scenariosAleatoires/MCMC.py
View file @
6e3cd67c
...
...
@@ -86,7 +86,7 @@ class MCMC:
self
.
rng
=
np
.
random
.
RandomState
(
42
)
print
(
'MCMC initialized with default seed'
)
# self.rng.get_state()
# Copying input data in output dir
self
.
outputdir
=
self
.
mcmc_config
[
'output_dir'
]
+
'/'
+
time
.
strftime
(
'%Y%m%d-%H%M%S'
)
+
'/'
self
.
outputdir
=
self
.
mcmc_config
[
'output_dir'
]
+
'/'
+
time
.
strftime
(
'%Y%m%d-%H%M%S'
)
if
not
os
.
path
.
exists
(
self
.
outputdir
):
os
.
makedirs
(
self
.
outputdir
)
print
(
'All data will be written in {}'
.
format
(
self
.
outputdir
))
...
...
@@ -103,8 +103,13 @@ class MCMC:
shutil
.
copy
(
f
,
self
.
outputdir
)
with
open
(
self
.
outputdir
+
'/seed.txt'
,
'w'
)
as
outfile
:
outfile
.
write
(
'{}
\n
'
.
format
(
self
.
rng
.
get_state
()))
config_data
=
{
'patches_md5sum'
:
self
.
patches_md5sum
,
'biodiversity_matrix_md5sum'
:
md5sum
(
self
.
mcmc_config
[
'indicators_config'
][
'biodiversity'
][
'matrixfilename'
]),
'social_patches_costs_md5sum'
:
md5sum
(
self
.
mcmc_config
[
'indicators_config'
][
'social'
][
'patches_costs_filename'
])
}
with
open
(
self
.
outputdir
+
'/config.yml'
,
'w'
)
as
outfile
:
yaml
.
dump
(
{
'patches_md5sum'
:
self
.
patches_md5sum
}
,
outfile
,
default_flow_style
=
False
)
yaml
.
dump
(
config_data
,
outfile
,
default_flow_style
=
False
)
# finishing init
self
.
patches
=
load_pat_patches
(
self
.
mcmc_config
[
'patches'
])
self
.
target
=
pd
.
read_csv
(
self
.
mcmc_config
[
'target'
],
sep
=
';'
,
index_col
=
0
)
...
...
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