Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
bilby
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
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
lscsoft
bilby
Commits
4820ecc0
Commit
4820ecc0
authored
3 years ago
by
Colm Talbot
Browse files
Options
Downloads
Patches
Plain Diff
Make building distance marginalization lookup table faster
parent
0437e0b1
No related branches found
Branches containing commit
No related tags found
Tags containing commit
1 merge request
!957
Make building distance marginalization lookup table faster
Pipeline
#222278
passed
3 years ago
Stage: initial
Stage: test
Stage: docs
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
bilby/gw/likelihood.py
+20
-15
20 additions, 15 deletions
bilby/gw/likelihood.py
with
20 additions
and
15 deletions
bilby/gw/likelihood.py
+
20
−
15
View file @
4820ecc0
...
...
@@ -912,24 +912,29 @@ class GravitationalWaveTransient(Likelihood):
def
_create_lookup_table
(
self
):
"""
Make the lookup table
"""
from
tqdm.auto
import
tqdm
logger
.
info
(
'
Building lookup table for distance marginalisation.
'
)
self
.
_dist_margd_loglikelihood_array
=
np
.
zeros
((
400
,
800
))
for
ii
,
optimal_snr_squared_ref
in
enumerate
(
self
.
_optimal_snr_squared_ref_array
):
optimal_snr_squared_array
=
(
optimal_snr_squared_ref
*
self
.
_ref_dist
**
2.
/
self
.
_distance_array
**
2
)
for
jj
,
d_inner_h_ref
in
enumerate
(
self
.
_d_inner_h_ref_array
):
d_inner_h_array
=
(
d_inner_h_ref
*
self
.
_ref_dist
/
self
.
_distance_array
)
if
self
.
phase_marginalization
:
d_inner_h_array
=
\
self
.
_bessel_function_interped
(
abs
(
d_inner_h_array
))
self
.
_dist_margd_loglikelihood_array
[
ii
][
jj
]
=
\
logsumexp
(
d_inner_h_array
-
optimal_snr_squared_array
/
2
,
b
=
self
.
distance_prior_array
*
self
.
_delta_distance
)
log_norm
=
logsumexp
(
0.
/
self
.
_distance_array
,
b
=
self
.
distance_prior_array
*
self
.
_delta_distance
)
scaling
=
self
.
_ref_dist
/
self
.
_distance_array
d_inner_h_array_full
=
np
.
outer
(
self
.
_d_inner_h_ref_array
,
scaling
)
h_inner_h_array_full
=
np
.
outer
(
self
.
_optimal_snr_squared_ref_array
,
scaling
**
2
)
if
self
.
phase_marginalization
:
d_inner_h_array_full
=
self
.
_bessel_function_interped
(
abs
(
d_inner_h_array_full
))
prior_term
=
self
.
distance_prior_array
*
self
.
_delta_distance
for
ii
,
optimal_snr_squared_array
in
tqdm
(
enumerate
(
h_inner_h_array_full
),
total
=
len
(
self
.
_optimal_snr_squared_ref_array
)
):
for
jj
,
d_inner_h_array
in
enumerate
(
d_inner_h_array_full
):
self
.
_dist_margd_loglikelihood_array
[
ii
][
jj
]
=
logsumexp
(
d_inner_h_array
-
optimal_snr_squared_array
/
2
,
b
=
prior_term
)
log_norm
=
logsumexp
(
0
/
self
.
_distance_array
,
b
=
self
.
distance_prior_array
*
self
.
_delta_distance
)
self
.
_dist_margd_loglikelihood_array
-=
log_norm
self
.
cache_lookup_table
()
...
...
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