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
5bd1af86
Commit
5bd1af86
authored
8 years ago
by
Gregory Ashton
Browse files
Options
Downloads
Patches
Plain Diff
Adds ability to input initial as list and improves logging
parent
e3b2d3eb
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
+15
-2
15 additions, 2 deletions
pyfstat.py
with
15 additions
and
2 deletions
pyfstat.py
+
15
−
2
View file @
5bd1af86
...
...
@@ -800,11 +800,21 @@ class MCMCSearch(BaseSearchClass):
"""
Generate a set of init vals for the walkers
"""
if
type
(
self
.
theta_initial
)
==
dict
:
logging
.
info
(
'
Generate initial values from initial dictionary
'
)
if
self
.
nglitch
>
1
:
raise
ValueError
(
'
Initial dict not implemented for nglitch>1
'
)
p0
=
[[[
self
.
generate_rv
(
**
self
.
theta_initial
[
key
])
for
key
in
self
.
theta_keys
]
for
i
in
range
(
self
.
nwalkers
)]
for
j
in
range
(
self
.
ntemps
)]
elif
type
(
self
.
theta_initial
)
==
list
:
logging
.
info
(
'
Generate initial values from list of theta_initial
'
)
p0
=
[[[
self
.
generate_rv
(
**
val
)
for
val
in
self
.
theta_initial
]
for
i
in
range
(
self
.
nwalkers
)]
for
j
in
range
(
self
.
ntemps
)]
elif
self
.
theta_initial
is
None
:
logging
.
info
(
'
Generate initial values from prior dictionary
'
)
p0
=
[[[
self
.
generate_rv
(
**
self
.
theta_prior
[
key
])
for
key
in
self
.
theta_keys
]
for
i
in
range
(
self
.
nwalkers
)]
...
...
@@ -958,12 +968,15 @@ class MCMCSearch(BaseSearchClass):
d
=
OrderedDict
()
lnl_finite
=
copy
.
copy
(
self
.
lnlikes
)
lnl_finite
[
idxs
]
=
np
.
nan
lnl_finite
[
idxs
]
=
0
close_idxs
=
abs
((
maxtwoF
-
lnl_finite
)
/
maxtwoF
)
<
threshold
for
i
,
k
in
enumerate
(
self
.
theta_keys
):
ng
=
1
while
k
in
d
:
k
=
k
.
rstrip
(
'
_{}
'
.
format
(
ng
-
1
))
+
'
_{}
'
.
format
(
ng
)
if
k
==
1
:
k
=
k
+
'
_1
'
else
:
k
.
replace
(
'
_{}
'
.
format
(
ng
-
1
),
'
_{}
'
.
format
(
ng
))
ng
+=
1
d
[
k
]
=
self
.
samples
[
jmax
][
i
]
...
...
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