Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
bilby
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Locked Files
Issues
25
Issues
25
List
Boards
Labels
Service Desk
Milestones
Iterations
Merge Requests
12
Merge Requests
12
Requirements
Requirements
List
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Test Cases
Security & Compliance
Security & Compliance
Dependency List
License Compliance
Operations
Operations
Incidents
Environments
Packages & Registries
Packages & Registries
Container Registry
Analytics
Analytics
CI / CD
Code Review
Insights
Issue
Repository
Value Stream
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
lscsoft
bilby
Commits
04902daf
Commit
04902daf
authored
May 18, 2018
by
Colm Talbot
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add uniform in log prior, reformat uniform prior
parent
a2b43c6f
Pipeline
#19568
passed with stages
in 5 minutes and 48 seconds
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
18 additions
and
17 deletions
+18
-17
tupak/prior.py
tupak/prior.py
+18
-17
No files found.
tupak/prior.py
View file @
04902daf
...
...
@@ -123,23 +123,6 @@ class Prior(object):
return
label
class
Uniform
(
Prior
):
"""Uniform prior"""
def
__init__
(
self
,
minimum
,
maximum
,
name
=
None
,
latex_label
=
None
):
Prior
.
__init__
(
self
,
name
,
latex_label
,
minimum
,
maximum
)
self
.
support
=
maximum
-
minimum
def
rescale
(
self
,
val
):
Prior
.
test_valid_for_rescaling
(
val
)
return
self
.
minimum
+
val
*
self
.
support
def
prob
(
self
,
val
):
"""Return the prior probability of val"""
in_prior
=
(
val
>=
self
.
minimum
)
&
(
val
<=
self
.
maximum
)
return
1
/
self
.
support
*
in_prior
class
DeltaFunction
(
Prior
):
"""Dirac delta function prior, this always returns peak."""
...
...
@@ -191,6 +174,24 @@ class PowerLaw(Prior):
-
self
.
minimum
**
(
1
+
self
.
alpha
)))
*
in_prior
class
Uniform
(
PowerLaw
):
"""Uniform prior"""
def
__init__
(
self
,
minimum
,
maximum
,
name
=
None
,
latex_label
=
None
):
Prior
.
__init__
(
self
,
name
,
latex_label
,
minimum
,
maximum
)
self
.
alpha
=
0
class
LogUniform
(
PowerLaw
):
"""Uniform prior"""
def
__init__
(
self
,
minimum
,
maximum
,
name
=
None
,
latex_label
=
None
):
Prior
.
__init__
(
self
,
name
,
latex_label
,
minimum
,
maximum
)
self
.
alpha
=
-
1
if
self
.
minimum
<=
0
:
logging
.
warning
(
'You specified a uniform-in-log prior with minimum={}'
.
format
(
self
.
minimum
))
class
Cosine
(
Prior
):
def
__init__
(
self
,
name
=
None
,
latex_label
=
None
,
minimum
=-
np
.
pi
/
2
,
maximum
=
np
.
pi
/
2
):
...
...
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