Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
bayesian-parametric-population-models
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Locked Files
Issues
3
Issues
3
List
Boards
Labels
Service Desk
Milestones
Iterations
Merge Requests
4
Merge Requests
4
Requirements
Requirements
List
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Test Cases
Security & Compliance
Security & Compliance
Dependency List
License Compliance
Operations
Operations
Incidents
Environments
Packages & Registries
Packages & Registries
Container Registry
Analytics
Analytics
CI / CD
Code Review
Insights
Issue
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Daniel Wysocki
bayesian-parametric-population-models
Commits
2e7004ee
Commit
2e7004ee
authored
Sep 04, 2020
by
Daniel Wysocki
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Updating auto-correlation plots
parent
97a650ae
Pipeline
#153361
failed with stage
in 1 minute and 10 seconds
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
34 additions
and
12 deletions
+34
-12
src/pop_models/sample_extraction/cli.py
src/pop_models/sample_extraction/cli.py
+10
-8
src/pop_models/sample_extraction/integrated_acorr.py
src/pop_models/sample_extraction/integrated_acorr.py
+24
-4
No files found.
src/pop_models/sample_extraction/cli.py
View file @
2e7004ee
...
...
@@ -124,14 +124,14 @@ def main(raw_args=None):
)
)
# delta_n_acorr = numpy.tile(n_acorr, (f.n_walkers, f.n_dim))
print
(
"Auto-correlation time is {dn} for the worst parameter."
.
format
(
dn
=
n_acorr
)
)
print
(
"Auto-correlation time for all parameters are"
,
", "
.
join
([
str
(
x
)
for
x
in
acorr_times
[
n_acorr
]]),
)
#
print(
#
"Auto-correlation time is {dn} for the worst parameter."
#
.format(dn=n_acorr)
#
)
#
print(
#
"Auto-correlation time for all parameters are",
#
", ".join([str(x) for x in acorr_times[n_acorr]]),
#
)
# Take the most auto-correlated walker and parameter throughout.
n_thinning
=
numpy
.
max
(
n_acorr
)
print
(
"Thinning is"
,
n_thinning
)
...
...
@@ -140,6 +140,8 @@ def main(raw_args=None):
integrated_acorr
.
plot_integrated_auto_correlation
(
cli_args
.
acorr_plot
,
acorr_times
,
None
,
param_names
=
f
.
variable_names
,
safety_factor
=
cli_args
.
acorr_safety_factor
,
)
elif
cli_args
.
fixed_thinning
is
not
None
:
n_thinning
=
cli_args
.
fixed_thinning
...
...
src/pop_models/sample_extraction/integrated_acorr.py
View file @
2e7004ee
...
...
@@ -222,7 +222,11 @@ def plot_auto_correlation(
fig
.
savefig
(
filename
)
def
plot_integrated_auto_correlation
(
filename
,
acorr_times
,
acorr_time_errs
):
def
plot_integrated_auto_correlation
(
filename
,
acorr_times
,
acorr_time_errs
,
param_names
=
None
,
safety_factor
=
None
,
):
import
itertools
import
numpy
...
...
@@ -233,14 +237,31 @@ def plot_integrated_auto_correlation(filename, acorr_times, acorr_time_errs):
K_final
=
K_final_plus_one
-
1
Ks
=
numpy
.
arange
(
K_final_plus_one
)
fig
,
ax
=
plt
.
subplots
(
figsize
=
(
8
,
4
))
fig
,
ax
=
plt
.
subplots
(
figsize
=
(
8
,
4
)
,
constrained_layout
=
True
)
# Plot K = m*tau_K line
if
safety_factor
is
not
None
:
ax
.
plot
(
Ks
,
Ks
/
safety_factor
,
color
=
"black"
,
linestyle
=
"dashed"
,
label
=
"$K = m
\\
,
\\
tau_K$"
,
)
# Plot autocorrelation curves.
for
d
,
color
in
zip
(
range
(
n_dim
),
itertools
.
cycle
(
color_cycle
)):
# Determine label.
if
param_names
is
None
:
label
=
"Param #{i}"
.
format
(
i
=
d
+
1
)
else
:
label
=
param_names
[
d
]
# Plot autocorrelation curve.
ac
=
acorr_times
[...,
d
]
ax
.
plot
(
Ks
,
ac
,
color
=
color
,
label
=
"Param #{i}"
.
format
(
i
=
d
+
1
)
,
label
=
label
,
)
if
acorr_time_errs
is
not
None
:
...
...
@@ -265,5 +286,4 @@ def plot_integrated_auto_correlation(filename, acorr_times, acorr_time_errs):
ax
.
legend
(
loc
=
"best"
)
fig
.
tight_layout
()
fig
.
savefig
(
filename
)
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