Skip to content
GitLab
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
5d115632
Commit
5d115632
authored
Feb 02, 2017
by
Gregory Ashton
Browse files
Adds test to see if samples are railing
Also adds thetas_at_ref data to the Writer object
parent
57f1968e
Changes
2
Hide whitespace changes
Inline
Side-by-side
pyfstat/core.py
View file @
5d115632
...
...
@@ -116,6 +116,7 @@ class BaseSearchClass(object):
post_theta_at_ith_glitch
=
pre_theta_at_ith_glitch
+
dt
thetas
.
append
(
self
.
shift_coefficients
(
post_theta_at_ith_glitch
,
self
.
tref
-
tbounds
[
i
+
1
]))
self
.
thetas_at_tref
=
thetas
return
thetas
def
generate_loudest
(
self
):
...
...
pyfstat/mcmc_based_searches.py
View file @
5d115632
...
...
@@ -851,6 +851,26 @@ class MCMCSearch(BaseSearchClass):
d
[
k
+
'_std'
]
=
np
.
std
(
s
)
return
d
def
check_if_samples_are_railing
(
self
,
threshold
=
0.01
):
return_flag
=
False
for
s
,
k
in
zip
(
self
.
samples
.
T
,
self
.
theta_keys
):
prior
=
self
.
theta_prior
[
k
]
if
prior
[
'type'
]
==
'unif'
:
prior_range
=
prior
[
'upper'
]
-
prior
[
'lower'
]
edges
=
[]
fracs
=
[]
for
l
in
[
'lower'
,
'upper'
]:
bools
=
np
.
abs
(
s
-
prior
[
l
])
/
prior_range
<
threshold
if
np
.
any
(
bools
):
edges
.
append
(
l
)
fracs
.
append
(
str
(
100
*
float
(
np
.
sum
(
bools
))
/
len
(
bools
)))
if
len
(
edges
)
>
0
:
logging
.
warning
(
'{}% of the {} posterior is railing on the {} edges'
.
format
(
'% & '
.
join
(
fracs
),
k
,
' & '
.
join
(
edges
)))
return_flag
=
True
return
return_flag
def
write_par
(
self
,
method
=
'med'
):
""" Writes a .par of the best-fit params with an estimated std """
logging
.
info
(
'Writing {}/{}.par using the {} method'
.
format
(
...
...
Write
Preview
Supports
Markdown
0%
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!
Cancel
Please
register
or
sign in
to comment