Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
bilby
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
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
Sylvia Biscoveanu
bilby
Commits
3ef7e49a
Commit
3ef7e49a
authored
6 years ago
by
Gregory Ashton
Browse files
Options
Downloads
Patches
Plain Diff
Add evidences to corner plots and fix a few minor bugs
parent
30087a54
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
cli_tupak/plot_multiple_posteriors.py
+4
-1
4 additions, 1 deletion
cli_tupak/plot_multiple_posteriors.py
tupak/core/result.py
+12
-1
12 additions, 1 deletion
tupak/core/result.py
tupak/core/sampler.py
+2
-2
2 additions, 2 deletions
tupak/core/sampler.py
with
18 additions
and
4 deletions
cli_tupak/plot_multiple_posteriors.py
+
4
−
1
View file @
3ef7e49a
...
...
@@ -12,6 +12,8 @@ def setup_command_line_args():
help
=
"
List of labels to use for each result.
"
)
parser
.
add_argument
(
"
-p
"
,
"
--parameters
"
,
nargs
=
'
+
'
,
default
=
None
,
help
=
"
List of parameters.
"
)
parser
.
add_argument
(
"
-e
"
,
"
--evidences
"
,
action
=
'
store_true
'
,
default
=
False
,
help
=
"
Add the evidences to the legend.
"
)
args
,
_
=
parser
.
parse_known_args
()
return
args
...
...
@@ -24,4 +26,5 @@ def main():
for
r
in
args
.
results
]
tupak
.
core
.
result
.
plot_multiple
(
results
,
filename
=
args
.
filename
,
labels
=
args
.
labels
,
parameters
=
args
.
parameters
)
parameters
=
args
.
parameters
,
evidences
=
args
.
evidences
)
This diff is collapsed.
Click to expand it.
tupak/core/result.py
+
12
−
1
View file @
3ef7e49a
...
...
@@ -409,7 +409,7 @@ class Result(dict):
def
plot_multiple
(
results
,
filename
=
None
,
labels
=
None
,
colours
=
None
,
save
=
True
,
**
kwargs
):
save
=
True
,
evidences
=
False
,
**
kwargs
):
"""
Generate a corner plot overlaying two sets of results
Parameters
...
...
@@ -432,6 +432,9 @@ def plot_multiple(results, filename=None, labels=None, colours=None,
All other keyword arguments are passed to `result.plot_corner`.
However, `show_titles` and `truths` are ignored since they would be
ambiguous on such a plot.
evidences: bool, optional
Add the log-evidence calculations to the legend. If available, the
Bayes factor will be used instead.
Returns
-------
...
...
@@ -460,6 +463,14 @@ def plot_multiple(results, filename=None, labels=None, colours=None,
if
labels
is
None
:
labels
=
default_labels
if
evidences
:
if
np
.
isnan
(
results
[
0
].
log_bayes_factor
):
template
=
'
$\mathrm{{ln}}(Z)={:1.3g}$
'
else
:
template
=
'
$\mathrm{{ln}}(B)={:1.3g}$
'
for
i
,
label
in
enumerate
(
labels
):
labels
[
i
]
=
label
+
template
.
format
(
results
[
i
].
log_bayes_factor
)
axes
=
fig
.
get_axes
()
ndim
=
int
(
np
.
sqrt
(
len
(
axes
)))
axes
[
ndim
-
1
].
legend
(
lines
,
labels
)
...
...
This diff is collapsed.
Click to expand it.
tupak/core/sampler.py
+
2
−
2
View file @
3ef7e49a
...
...
@@ -353,7 +353,7 @@ class Sampler(object):
for
k
in
kwargs_print
:
if
type
(
kwargs_print
[
k
])
in
(
list
,
np
.
ndarray
):
array_repr
=
np
.
array
(
kwargs_print
[
k
])
if
array_repr
.
s
hap
e
>
10
:
if
array_repr
.
s
iz
e
>
10
:
kwargs_print
[
k
]
=
(
'
array_like, shape={}
'
.
format
(
array_repr
.
shape
))
logging
.
info
(
"
Using sampler {} with kwargs {}
"
.
format
(
...
...
@@ -776,7 +776,7 @@ class Emcee(Sampler):
if
'
pos0
'
in
self
.
kwargs
:
logging
.
debug
(
"
Using given initial positions for walkers
"
)
pos0
=
np
.
squeeze
(
self
.
kwargs
[
'
pos0
'
])
if
pos0
.
shape
!=
(
self
.
n
dim
,
self
.
n
walkers
):
if
pos0
.
shape
!=
(
self
.
n
walkers
,
self
.
n
dim
):
raise
ValueError
(
'
Input pos0 should be of shape ndim, nwalkers
'
)
else
:
...
...
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