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
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Gregory Ashton
PyFstat
Commits
724d6950
Commit
724d6950
authored
7 years ago
by
Gregory Ashton
Committed by
Gregory Ashton
7 years ago
Browse files
Options
Downloads
Patches
Plain Diff
Fixes plotting det stat histogram and update timing coefficients
parent
bb17752e
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
pyfstat/mcmc_based_searches.py
+26
-12
26 additions, 12 deletions
pyfstat/mcmc_based_searches.py
with
26 additions
and
12 deletions
pyfstat/mcmc_based_searches.py
+
26
−
12
View file @
724d6950
...
@@ -372,13 +372,25 @@ class MCMCSearch(core.BaseSearchClass):
...
@@ -372,13 +372,25 @@ class MCMCSearch(core.BaseSearchClass):
return
sampler
return
sampler
def
_estimate_run_time
(
self
):
def
_estimate_run_time
(
self
):
tau0S
=
2.7e-8
"""
Print the estimated run time
tau0LD
=
1.6e-7
Uses timing coefficients based on a Lenovo T460p Intel(R)
Core(TM) i5-6300HQ CPU @ 2.30GHz.
"""
# Todo: add option to time on a machine, and move coefficients to
# ~/.pyfstat.conf
if
(
type
(
self
.
theta_prior
[
'
Alpha
'
])
==
dict
or
type
(
self
.
theta_prior
[
'
Delta
'
])
==
dict
):
tau0S
=
7.3e-5
tau0LD
=
4.2e-7
else
:
tau0S
=
5.0e-5
tau0LD
=
6.2e-8
Nsfts
=
(
self
.
maxStartTime
-
self
.
minStartTime
)
/
1800.
Nsfts
=
(
self
.
maxStartTime
-
self
.
minStartTime
)
/
1800.
average_numb_evals
=
np
.
sum
(
self
.
nsteps
)
*
self
.
nwalkers
*
self
.
ntemps
numb_evals
=
np
.
sum
(
self
.
nsteps
)
*
self
.
nwalkers
*
self
.
ntemps
a
=
tau0S
*
Nsfts
*
average_numb_evals
a
=
tau0S
*
numb_evals
b
=
tau0LD
*
Nsfts
*
average_numb_evals
b
=
tau0LD
*
Nsfts
*
numb_evals
print
(
a
,
b
,
Nsfts
)
logging
.
info
(
'
Estimated run-time = {} s = {:1.0f}:{:1.0f} m
'
.
format
(
logging
.
info
(
'
Estimated run-time = {} s = {:1.0f}:{:1.0f} m
'
.
format
(
a
+
b
,
*
divmod
(
a
+
b
,
60
)))
a
+
b
,
*
divmod
(
a
+
b
,
60
)))
...
@@ -993,18 +1005,20 @@ class MCMCSearch(core.BaseSearchClass):
...
@@ -993,18 +1005,20 @@ class MCMCSearch(core.BaseSearchClass):
if
burnin_idx
and
add_det_stat_burnin
:
if
burnin_idx
and
add_det_stat_burnin
:
burn_in_vals
=
lnl
[:,
:
burnin_idx
].
flatten
()
burn_in_vals
=
lnl
[:,
:
burnin_idx
].
flatten
()
try
:
try
:
axes
[
-
1
].
hist
(
burn_in_vals
[
~
np
.
isnan
(
burn_in_vals
)],
twoF_burnin
=
(
burn_in_vals
[
~
np
.
isnan
(
burn_in_vals
)]
bins
=
50
,
histtype
=
'
step
'
,
color
=
'
C3
'
)
-
self
.
likelihoodcoef
)
axes
[
-
1
].
hist
(
twoF_burnin
,
bins
=
50
,
histtype
=
'
step
'
,
color
=
'
C3
'
)
except
ValueError
:
except
ValueError
:
logging
.
info
(
'
Det. Stat. hist failed, most likely all
'
logging
.
info
(
'
Det. Stat. hist failed, most likely all
'
'
values where the same
'
)
'
values where the same
'
)
pass
pass
else
:
else
:
burn
_
in
_vals
=
[]
twoF_
burnin
=
[]
prod_vals
=
lnl
[:,
burnin_idx
:].
flatten
()
prod_vals
=
lnl
[:,
burnin_idx
:].
flatten
()
try
:
try
:
axes
[
-
1
].
hist
(
prod_vals
[
~
np
.
isnan
(
prod_vals
)]
,
bins
=
50
,
twoF
=
prod_vals
[
~
np
.
isnan
(
prod_vals
)]
-
self
.
likelihoodcoef
histtype
=
'
step
'
,
color
=
'
k
'
)
axes
[
-
1
].
hist
(
twoF
,
bins
=
50
,
histtype
=
'
step
'
,
color
=
'
k
'
)
except
ValueError
:
except
ValueError
:
logging
.
info
(
'
Det. Stat. hist failed, most likely all
'
logging
.
info
(
'
Det. Stat. hist failed, most likely all
'
'
values where the same
'
)
'
values where the same
'
)
...
@@ -1014,7 +1028,7 @@ class MCMCSearch(core.BaseSearchClass):
...
@@ -1014,7 +1028,7 @@ class MCMCSearch(core.BaseSearchClass):
else
:
else
:
axes
[
-
1
].
set_xlabel
(
r
'
$\widetilde{2\mathcal{F}}$
'
)
axes
[
-
1
].
set_xlabel
(
r
'
$\widetilde{2\mathcal{F}}$
'
)
axes
[
-
1
].
set_ylabel
(
r
'
$\textrm{Counts}$
'
)
axes
[
-
1
].
set_ylabel
(
r
'
$\textrm{Counts}$
'
)
combined_vals
=
np
.
append
(
burn
_
in
_vals
,
prod_vals
)
combined_vals
=
np
.
append
(
twoF_
burnin
,
twoF
)
if
len
(
combined_vals
)
>
0
:
if
len
(
combined_vals
)
>
0
:
minv
=
np
.
min
(
combined_vals
)
minv
=
np
.
min
(
combined_vals
)
maxv
=
np
.
max
(
combined_vals
)
maxv
=
np
.
max
(
combined_vals
)
...
...
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