Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
10
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Open sidebar
lscsoft
bilby
Commits
4113a0ba
Commit
4113a0ba
authored
May 17, 2018
by
Moritz Huebner
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Moritz Huebner: Some formatting
parent
d8a4f7ec
Pipeline
#19451
passed with stages
in 7 minutes and 35 seconds
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
3 additions
and
3 deletions
+3
-3
tupak/sampler.py
tupak/sampler.py
+3
-3
No files found.
tupak/sampler.py
View file @
4113a0ba
...
@@ -106,7 +106,7 @@ class Sampler(object):
...
@@ -106,7 +106,7 @@ class Sampler(object):
if
user_input
not
in
args
:
if
user_input
not
in
args
:
logging
.
warning
(
logging
.
warning
(
"Supplied argument '{}' not an argument of '{}', removing."
"Supplied argument '{}' not an argument of '{}', removing."
.
format
(
user_input
,
self
.
external_sampler_function
))
.
format
(
user_input
,
self
.
external_sampler_function
))
bad_keys
.
append
(
user_input
)
bad_keys
.
append
(
user_input
)
for
key
in
bad_keys
:
for
key
in
bad_keys
:
self
.
kwargs
.
pop
(
key
)
self
.
kwargs
.
pop
(
key
)
...
@@ -155,7 +155,7 @@ class Sampler(object):
...
@@ -155,7 +155,7 @@ class Sampler(object):
def
log_prior
(
self
,
theta
):
def
log_prior
(
self
,
theta
):
return
np
.
sum
(
return
np
.
sum
(
[
np
.
log
(
self
.
priors
[
key
].
prob
(
t
))
for
key
,
t
in
[
np
.
log
(
self
.
priors
[
key
].
prob
(
t
))
for
key
,
t
in
zip
(
self
.
__search_parameter_keys
,
theta
)])
zip
(
self
.
__search_parameter_keys
,
theta
)])
def
log_likelihood
(
self
,
theta
):
def
log_likelihood
(
self
,
theta
):
for
i
,
k
in
enumerate
(
self
.
__search_parameter_keys
):
for
i
,
k
in
enumerate
(
self
.
__search_parameter_keys
):
...
@@ -176,7 +176,7 @@ class Sampler(object):
...
@@ -176,7 +176,7 @@ class Sampler(object):
"""
"""
draw
=
np
.
array
([
self
.
priors
[
key
].
sample
()
draw
=
np
.
array
([
self
.
priors
[
key
].
sample
()
for
key
in
self
.
__search_parameter_keys
])
for
key
in
self
.
__search_parameter_keys
])
if
np
.
isinf
(
self
.
log_likelihood
(
draw
)):
if
np
.
isinf
(
self
.
log_likelihood
(
draw
)):
logging
.
info
(
'Prior draw {} has inf likelihood'
.
format
(
draw
))
logging
.
info
(
'Prior draw {} has inf likelihood'
.
format
(
draw
))
if
np
.
isinf
(
self
.
log_prior
(
draw
)):
if
np
.
isinf
(
self
.
log_prior
(
draw
)):
...
...
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