Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
P
PyFstat
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Model registry
Monitor
Incidents
Analyze
Value stream analytics
Contributor 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
Gregory Ashton
PyFstat
Commits
38fbf98e
Commit
38fbf98e
authored
8 years ago
by
Gregory Ashton
Browse files
Options
Downloads
Patches
Plain Diff
Add context to plot_corner to allow the user to customise the plot
parent
b26d1c74
No related branches found
No related tags found
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
pyfstat.py
+65
-58
65 additions, 58 deletions
pyfstat.py
with
65 additions
and
58 deletions
pyfstat.py
+
65
−
58
View file @
38fbf98e
...
...
@@ -643,8 +643,10 @@ class MCMCSearch(BaseSearchClass):
self
.
save_data
(
sampler
,
samples
,
lnprobs
,
lnlikes
)
def
plot_corner
(
self
,
figsize
=
(
7
,
7
),
tglitch_ratio
=
False
,
add_prior
=
False
,
nstds
=
None
,
label_offset
=
0.4
,
**
kwargs
):
add_prior
=
False
,
nstds
=
None
,
label_offset
=
0.4
,
dpi
=
300
,
rc_context
=
{},
**
kwargs
):
with
plt
.
rc_context
(
rc_context
):
fig
,
axes
=
plt
.
subplots
(
self
.
ndim
,
self
.
ndim
,
figsize
=
figsize
)
...
...
@@ -700,7 +702,7 @@ class MCMCSearch(BaseSearchClass):
self
.
add_prior_to_corner
(
axes
,
samples_plt
)
fig_triangle
.
savefig
(
'
{}/{}_corner.png
'
.
format
(
self
.
outdir
,
self
.
label
))
self
.
outdir
,
self
.
label
)
,
dpi
=
dpi
)
def
add_prior_to_corner
(
self
,
axes
,
samples
):
for
i
,
key
in
enumerate
(
self
.
theta_keys
):
...
...
@@ -757,6 +759,8 @@ class MCMCSearch(BaseSearchClass):
return
lambda
x
:
logunif
(
x
,
kwargs
[
'
lower
'
],
kwargs
[
'
upper
'
])
elif
kwargs
[
'
type
'
]
==
'
halfnorm
'
:
return
lambda
x
:
halfnorm
(
x
,
kwargs
[
'
loc
'
],
kwargs
[
'
scale
'
])
elif
kwargs
[
'
type
'
]
==
'
neghalfnorm
'
:
return
lambda
x
:
halfnorm
(
-
x
,
kwargs
[
'
loc
'
],
kwargs
[
'
scale
'
])
elif
kwargs
[
'
type
'
]
==
'
norm
'
:
return
lambda
x
:
-
0.5
*
((
x
-
kwargs
[
'
loc
'
])
**
2
/
kwargs
[
'
scale
'
]
**
2
+
np
.
log
(
2
*
np
.
pi
*
kwargs
[
'
scale
'
]
**
2
))
...
...
@@ -773,6 +777,9 @@ class MCMCSearch(BaseSearchClass):
if
dist_type
==
"
halfnorm
"
:
return
np
.
abs
(
np
.
random
.
normal
(
loc
=
kwargs
[
'
loc
'
],
scale
=
kwargs
[
'
scale
'
]))
if
dist_type
==
"
neghalfnorm
"
:
return
-
1
*
np
.
abs
(
np
.
random
.
normal
(
loc
=
kwargs
[
'
loc
'
],
scale
=
kwargs
[
'
scale
'
]))
if
dist_type
==
"
lognorm
"
:
return
np
.
random
.
lognormal
(
mean
=
kwargs
[
'
loc
'
],
sigma
=
kwargs
[
'
scale
'
])
...
...
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