Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Gregory Ashton
PyFstat
Commits
5861175f
Commit
5861175f
authored
Oct 22, 2016
by
Gregory Ashton
Browse files
Fix plot routines when ndim=1
parent
27e12115
Changes
1
Hide whitespace changes
Inline
Side-by-side
pyfstat.py
View file @
5861175f
...
@@ -785,6 +785,16 @@ class MCMCSearch(BaseSearchClass):
...
@@ -785,6 +785,16 @@ class MCMCSearch(BaseSearchClass):
add_prior
=
False
,
nstds
=
None
,
label_offset
=
0.4
,
add_prior
=
False
,
nstds
=
None
,
label_offset
=
0.4
,
dpi
=
300
,
rc_context
=
{},
**
kwargs
):
dpi
=
300
,
rc_context
=
{},
**
kwargs
):
if
self
.
ndim
<
2
:
with
plt
.
rc_context
(
rc_context
):
fig
,
ax
=
plt
.
subplots
(
figsize
=
figsize
)
ax
.
hist
(
self
.
samples
,
bins
=
50
,
histtype
=
'stepfilled'
)
ax
.
set_xlabel
(
self
.
theta_symbols
[
0
])
fig
.
savefig
(
'{}/{}_corner.png'
.
format
(
self
.
outdir
,
self
.
label
),
dpi
=
dpi
)
return
with
plt
.
rc_context
(
rc_context
):
with
plt
.
rc_context
(
rc_context
):
fig
,
axes
=
plt
.
subplots
(
self
.
ndim
,
self
.
ndim
,
fig
,
axes
=
plt
.
subplots
(
self
.
ndim
,
self
.
ndim
,
figsize
=
figsize
)
figsize
=
figsize
)
...
@@ -1008,9 +1018,15 @@ class MCMCSearch(BaseSearchClass):
...
@@ -1008,9 +1018,15 @@ class MCMCSearch(BaseSearchClass):
if
symbols
:
if
symbols
:
axes
[
i
].
set_ylabel
(
symbols
[
i
])
axes
[
i
].
set_ylabel
(
symbols
[
i
])
else
:
else
:
axes
[
0
].
ticklabel_format
(
useOffset
=
False
,
axis
=
'y'
)
cs
=
chain
[:,
:,
temp
].
T
cs
=
chain
[:,
:,
temp
].
T
axes
.
plot
(
cs
,
color
=
'k'
,
alpha
=
alpha
)
if
burnin_idx
:
axes
.
ticklabel_format
(
useOffset
=
False
,
axis
=
'y'
)
axes
[
0
].
plot
(
idxs
[:
burnin_idx
],
cs
[:
burnin_idx
],
color
=
"r"
,
alpha
=
alpha
,
lw
=
lw
)
axes
[
0
].
plot
(
idxs
[
burnin_idx
:],
cs
[
burnin_idx
:],
color
=
"k"
,
alpha
=
alpha
,
lw
=
lw
)
if
symbols
:
axes
[
0
].
set_ylabel
(
symbols
[
0
])
axes
.
append
(
fig
.
add_subplot
(
ndim
+
1
,
1
,
ndim
+
1
))
axes
.
append
(
fig
.
add_subplot
(
ndim
+
1
,
1
,
ndim
+
1
))
lnl
=
sampler
.
lnlikelihood
[
temp
,
:,
:]
lnl
=
sampler
.
lnlikelihood
[
temp
,
:,
:]
...
...
Write
Preview
Supports
Markdown
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