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
Merge requests
!403
Adds a symmetric log uniform prior
Code
Review changes
Check out branch
Download
Patches
Plain diff
Merged
Adds a symmetric log uniform prior
add-symmetric-log-uniform-prior
into
master
Overview
5
Commits
4
Pipelines
3
Changes
1
Merged
Gregory Ashton
requested to merge
add-symmetric-log-uniform-prior
into
master
6 years ago
Overview
5
Commits
4
Pipelines
3
Changes
1
Expand
0
0
Merge request reports
Compare
master
version 2
ca953060
6 years ago
version 1
0f359be3
6 years ago
master (base)
and
latest version
latest version
5038ac06
4 commits,
6 years ago
version 2
ca953060
2 commits,
6 years ago
version 1
0f359be3
1 commit,
6 years ago
1 file
+
80
−
0
Inline
Compare changes
Side-by-side
Inline
Show whitespace changes
Show one file at a time
bilby/core/prior.py
+
80
−
0
Options
@@ -770,6 +770,86 @@ class LogUniform(PowerLaw):
logger
.
warning
(
'
You specified a uniform-in-log prior with minimum={}
'
.
format
(
self
.
minimum
))
class
SymmetricLogUniform
(
Prior
):
def
__init__
(
self
,
minimum
,
maximum
,
name
=
None
,
latex_label
=
None
,
unit
=
None
):
"""
Symmetric Log-Uniform distribtions with bounds
This is identical to a Log-Uniform distribition, but mirrored about
the zero-axis and subsequently normalized. As such, the distribution
has support on the two regions [-maximum, -minimum] and [minimum,
maximum].
Parameters
----------
minimum: float
See superclass
maximum: float
See superclass
name: str
See superclass
latex_label: str
See superclass
unit: str
See superclass
"""
Prior
.
__init__
(
self
,
name
=
name
,
latex_label
=
latex_label
,
minimum
=
minimum
,
maximum
=
maximum
,
unit
=
unit
)
def
rescale
(
self
,
val
):
"""
'
Rescale
'
a sample from the unit line element to the power-law prior.
This maps to the inverse CDF. This has been analytically solved for this case.
Parameters
----------
val: float
Uniform probability
Returns
-------
float: Rescaled probability
"""
Prior
.
test_valid_for_rescaling
(
val
)
if
val
<
0.5
:
return
-
self
.
maximum
*
np
.
exp
(
-
2
*
val
*
np
.
log
(
self
.
maximum
/
self
.
minimum
))
elif
val
>
0.5
:
return
self
.
minimum
*
np
.
exp
(
np
.
log
(
self
.
maximum
/
self
.
minimum
)
*
(
2
*
val
-
1
))
else
:
raise
ValueError
(
"
Rescale not valid for val=0.5
"
)
def
prob
(
self
,
val
):
"""
Return the prior probability of val
Parameters
----------
val: float
Returns
-------
float: Prior probability of val
"""
return
(
np
.
nan_to_num
(
0.5
/
np
.
abs
(
val
)
/
np
.
log
(
self
.
maximum
/
self
.
minimum
))
*
self
.
is_in_prior_range
(
val
))
def
ln_prob
(
self
,
val
):
"""
Return the logarithmic prior probability of val
Parameters
----------
val: float
Returns
-------
float:
"""
return
np
.
nan_to_num
(
-
np
.
log
(
2
*
np
.
abs
(
val
))
-
np
.
log
(
np
.
log
(
self
.
maximum
/
self
.
minimum
)))
class
Cosine
(
Prior
):
def
__init__
(
self
,
name
=
None
,
latex_label
=
None
,
unit
=
None
,
Loading