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
5bd5eadc
Commit
5bd5eadc
authored
5 years ago
by
Gregory Ashton
Browse files
Options
Downloads
Patches
Plain Diff
Add in replacement and a warning
parent
f571f2f7
No related branches found
No related tags found
1 merge request
!642
Add function to convert to a LI prior
Pipeline
#88598
passed
5 years ago
Stage: test
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
bilby/gw/prior.py
+12
-3
12 additions, 3 deletions
bilby/gw/prior.py
with
12 additions
and
3 deletions
bilby/gw/prior.py
+
12
−
3
View file @
5bd5eadc
...
...
@@ -53,8 +53,6 @@ def convert_to_flat_in_component_mass_prior(result, fraction=0.25):
priors
=
result
.
priors
posterior
=
result
.
posterior
logger
.
info
(
"
Resampling posterior to flat-in-component mass
"
)
priors
[
"
chirp_mass
"
]
=
Constraint
(
priors
[
"
chirp_mass
"
].
minimum
,
priors
[
"
chirp_mass
"
].
maximum
,
"
chirp_mass
"
,
latex_label
=
priors
[
"
chirp_mass
"
].
latex_label
)
...
...
@@ -69,7 +67,18 @@ def convert_to_flat_in_component_mass_prior(result, fraction=0.25):
latex_label
=
priors
[
"
mass_2
"
].
latex_label
)
weights
=
posterior
.
mass_1
**
2
/
posterior
.
chirp_mass
result
.
posterior
=
posterior
.
sample
(
frac
=
fraction
,
weights
=
weights
)
logger
.
info
(
"
Resampling posterior to flat-in-component mass
"
)
effective_sample_size
=
sum
(
weights
)
**
2
/
sum
(
weights
**
2
)
n_posterior
=
len
(
posterior
)
if
fraction
>
effective_sample_size
/
n_posterior
:
logger
.
warning
(
"
Sampling posterior of length {} with fraction {}, but
"
"
effective_sample_size / len(posterior) = {}. This may produce
"
"
biased results
"
.
format
(
n_posterior
,
fraction
,
effective_sample_size
/
n_posterior
)
)
result
.
posterior
=
posterior
.
sample
(
frac
=
fraction
,
weights
=
weights
,
replacement
=
True
)
result
.
meta_data
[
"
reweighted_to_flat_in_component_mass
"
]
=
True
return
result
...
...
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