Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Open sidebar
PORTER Edward
GWHMC
Commits
2cd96f30
Commit
2cd96f30
authored
Mar 30, 2021
by
Marc Arene
Browse files
Saving `accepted` boolean in chain_metrics
parent
e5a13967
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
7 additions
and
4 deletions
+7
-4
Codes/main.py
Codes/main.py
+6
-3
core/sampler.py
core/sampler.py
+1
-1
No files found.
Codes/main.py
View file @
2cd96f30
...
...
@@ -643,7 +643,7 @@ if __name__ == '__main__':
else
:
mf_snr
=
sampler
.
likelihood
.
snr_dict
[
'network'
][
'matched_filter_snr'
]
logL2
=
sampler
.
likelihood
.
snr_dict
[
'network'
][
'log_l_ratio'
]
# equal to logL?
sampler
.
chain_metrics
.
append
([
mf_snr
,
logL2
,
Acc
])
sampler
.
chain_metrics
.
append
([
mf_snr
,
logL2
,
Acc
,
Accept
])
idx_Mc
=
sampler
.
search_parameter_keys
.
index
(
'chirp_mass'
)
idx_mu
=
sampler
.
search_parameter_keys
.
index
(
'reduced_mass'
)
eta
=
paru
.
Mc_mu_to_eta
(
q_pos
[
idx_Mc
],
q_pos
[
idx_mu
])
...
...
@@ -1393,9 +1393,12 @@ if __name__ == '__main__':
# Record the position of the chain
sampler
.
samples
.
append
(
q_pos
.
tolist
())
# import IPython; IPython.embed();sys.exit()
mf_snr
=
sampler
.
likelihood
.
snr_dict
[
'network'
][
'matched_filter_snr_phasemarg'
]
if
config_dict
[
'analysis'
][
'phase_marginalization'
]:
mf_snr
=
sampler
.
likelihood
.
snr_dict
[
'network'
][
'matched_filter_snr_phasemarg'
]
else
:
mf_snr
=
sampler
.
likelihood
.
snr_dict
[
'network'
][
'matched_filter_snr'
]
logL2
=
sampler
.
likelihood
.
snr_dict
[
'network'
][
'log_l_ratio'
]
# equal to logL
sampler
.
chain_metrics
.
append
([
mf_snr
,
logL2
,
Acc_phase3
])
sampler
.
chain_metrics
.
append
([
mf_snr
,
logL2
,
Acc_phase3
,
Accept
])
# Print position of the chain
# if traj_index%int(sampler.n_traj_for_this_run/20000)==0:
...
...
core/sampler.py
View file @
2cd96f30
...
...
@@ -640,7 +640,7 @@ class GWHMCSampler(object):
np
.
savetxt
(
state_dir
+
"qpos_traj_phase1.dat"
,
qpos_traj_phase1
,
fmt
=
'%.25e'
)
np
.
savetxt
(
state_dir
+
"dlogL_traj_phase1.dat"
,
dlogL_traj_phase1
,
fmt
=
'%.25e'
)
np
.
savetxt
(
state_dir
+
"samples.dat"
,
np
.
asarray
(
self
.
samples
),
header
=
' | '
.
join
(
self
.
search_parameter_keys
))
np
.
savetxt
(
state_dir
+
"chain_metrics.dat"
,
np
.
asarray
(
self
.
chain_metrics
),
header
=
' | '
.
join
([
'mf_snr'
,
'log
L
'
,
'
A
cc'
]))
np
.
savetxt
(
state_dir
+
"chain_metrics.dat"
,
np
.
asarray
(
self
.
chain_metrics
),
header
=
' | '
.
join
([
'mf_snr'
,
'log
_l'
,
'acc
'
,
'
a
cc
epted
'
]))
if
stuck_seq_and_traj_list
is
None
:
stuck_seq_and_traj_list
=
[]
np
.
savetxt
(
state_dir
+
"rejection_sequences.dat"
,
np
.
asarray
(
stuck_seq_and_traj_list
),
fmt
=
'%d'
,
header
=
'traj_nb | rejection_count'
)
...
...
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