Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
P
PyFstat
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Analytics
Analytics
CI / CD
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
David Keitel
PyFstat
Commits
f7aab64d
Commit
f7aab64d
authored
Apr 15, 2018
by
Gregory Ashton
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Minor polishing to MCMC searches
- Adds chains to saved data - Add catch for when corner plots error
parent
37041071
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
18 additions
and
7 deletions
+18
-7
pyfstat/mcmc_based_searches.py
pyfstat/mcmc_based_searches.py
+18
-7
No files found.
pyfstat/mcmc_based_searches.py
View file @
f7aab64d
...
...
@@ -492,6 +492,7 @@ class MCMCSearch(core.BaseSearchClass):
self
.
lnprobs
=
d
[
'lnprobs'
]
self
.
lnlikes
=
d
[
'lnlikes'
]
self
.
all_lnlikelihood
=
d
[
'all_lnlikelihood'
]
self
.
chain
=
d
[
'chain'
]
return
self
.
_initiate_search_object
()
...
...
@@ -533,21 +534,27 @@ class MCMCSearch(core.BaseSearchClass):
logging
.
info
(
'Running final burn and prod with {} steps'
.
format
(
nburn
+
nprod
))
sampler
=
self
.
_run_sampler
(
sampler
,
p0
,
nburn
=
nburn
,
nprod
=
nprod
)
if
create_plots
:
fig
,
axes
=
self
.
_plot_walkers
(
sampler
,
nprod
=
nprod
,
**
kwargs
)
fig
.
tight_layout
()
fig
.
savefig
(
'{}/{}_walkers.png'
.
format
(
self
.
outdir
,
self
.
label
),
)
try
:
fig
,
axes
=
self
.
_plot_walkers
(
sampler
,
nprod
=
nprod
,
**
kwargs
)
fig
.
tight_layout
()
fig
.
savefig
(
'{}/{}_walkers.png'
.
format
(
self
.
outdir
,
self
.
label
))
except
RuntimeError
as
e
:
logging
.
warning
(
"Failed to save walker plots due to Erro {}"
.
format
(
e
))
samples
=
sampler
.
chain
[
0
,
:,
nburn
:,
:].
reshape
((
-
1
,
self
.
ndim
))
lnprobs
=
sampler
.
logprobability
[
0
,
:,
nburn
:].
reshape
((
-
1
))
lnlikes
=
sampler
.
loglikelihood
[
0
,
:,
nburn
:].
reshape
((
-
1
))
all_lnlikelihood
=
sampler
.
loglikelihood
[:,
:,
nburn
:]
self
.
samples
=
samples
self
.
chain
=
sampler
.
chain
self
.
lnprobs
=
lnprobs
self
.
lnlikes
=
lnlikes
self
.
all_lnlikelihood
=
all_lnlikelihood
self
.
_save_data
(
sampler
,
samples
,
lnprobs
,
lnlikes
,
all_lnlikelihood
)
self
.
_save_data
(
sampler
,
samples
,
lnprobs
,
lnlikes
,
all_lnlikelihood
,
sampler
.
chain
)
return
sampler
def
_get_rescale_multiplier_for_key
(
self
,
key
):
...
...
@@ -1215,11 +1222,13 @@ class MCMCSearch(core.BaseSearchClass):
maxStartTime
=
self
.
maxStartTime
)
return
d
def
_save_data
(
self
,
sampler
,
samples
,
lnprobs
,
lnlikes
,
all_lnlikelihood
):
def
_save_data
(
self
,
sampler
,
samples
,
lnprobs
,
lnlikes
,
all_lnlikelihood
,
chain
):
d
=
self
.
_get_data_dictionary_to_save
()
d
[
'samples'
]
=
samples
d
[
'lnprobs'
]
=
lnprobs
d
[
'lnlikes'
]
=
lnlikes
d
[
'chain'
]
=
chain
d
[
'all_lnlikelihood'
]
=
all_lnlikelihood
if
os
.
path
.
isfile
(
self
.
pickle_path
):
...
...
@@ -1254,6 +1263,7 @@ class MCMCSearch(core.BaseSearchClass):
old_d
.
pop
(
'lnprobs'
)
old_d
.
pop
(
'lnlikes'
)
old_d
.
pop
(
'all_lnlikelihood'
)
old_d
.
pop
(
'chain'
)
for
key
in
'minStartTime'
,
'maxStartTime'
:
if
new_d
[
key
]
is
None
:
...
...
@@ -1616,7 +1626,7 @@ class MCMCGlitchSearch(MCMCSearch):
'multiplier'
:
1
/
86400.
,
'subtractor'
:
'minStartTime'
,
'unit'
:
'day'
,
'label'
:
'$t^{g}_0$
\n
[d
ays
]'
}
'label'
:
'$t^{g}_0$
\n
[d]'
}
)
@
helper_functions
.
initializer
...
...
@@ -2108,6 +2118,7 @@ class MCMCFollowUpSearch(MCMCSemiCoherentSearch):
self
.
lnprobs
=
d
[
'lnprobs'
]
self
.
lnlikes
=
d
[
'lnlikes'
]
self
.
all_lnlikelihood
=
d
[
'all_lnlikelihood'
]
self
.
chain
=
d
[
'chain'
]
self
.
nsegs
=
run_setup
[
-
1
][
1
]
return
...
...
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