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
6436d66d
Commit
6436d66d
authored
5 years ago
by
Isobel Marguarethe Romero-Shaw
Committed by
Gregory Ashton
5 years ago
Browse files
Options
Downloads
Patches
Plain Diff
Raise ValueError if prior maximum <= prior minimum and prior is not a DeltaFunction
parent
b9103f19
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
bilby/core/prior/analytical.py
+1
-1
1 addition, 1 deletion
bilby/core/prior/analytical.py
bilby/core/prior/base.py
+10
-1
10 additions, 1 deletion
bilby/core/prior/base.py
test/prior_test.py
+2
-2
2 additions, 2 deletions
test/prior_test.py
with
13 additions
and
4 deletions
bilby/core/prior/analytical.py
+
1
−
1
View file @
6436d66d
...
...
@@ -25,7 +25,7 @@ class DeltaFunction(Prior):
"""
super
(
DeltaFunction
,
self
).
__init__
(
name
=
name
,
latex_label
=
latex_label
,
unit
=
unit
,
minimum
=
peak
,
maximum
=
peak
)
minimum
=
peak
,
maximum
=
peak
,
check_range_nonzero
=
False
)
self
.
peak
=
peak
self
.
_is_fixed
=
True
...
...
This diff is collapsed.
Click to expand it.
bilby/core/prior/base.py
+
10
−
1
View file @
6436d66d
...
...
@@ -15,7 +15,7 @@ class Prior(object):
_default_latex_labels
=
{}
def
__init__
(
self
,
name
=
None
,
latex_label
=
None
,
unit
=
None
,
minimum
=-
np
.
inf
,
maximum
=
np
.
inf
,
boundary
=
None
):
maximum
=
np
.
inf
,
check_range_nonzero
=
True
,
boundary
=
None
):
"""
Implements a Prior object
Parameters
...
...
@@ -30,15 +30,24 @@ class Prior(object):
Minimum of the domain, default=-np.inf
maximum: float, optional
Maximum of the domain, default=np.inf
check_range_nonzero: boolean, optional
If True, checks that the prior range is non-zero
boundary: str, optional
The boundary condition of the prior, can be
'
periodic
'
,
'
reflective
'
Currently implemented in cpnest, dynesty and pymultinest.
"""
if
check_range_nonzero
and
maximum
<=
minimum
:
raise
ValueError
(
"
maximum {} <= minimum {} for {} prior on {}
"
.
format
(
maximum
,
minimum
,
type
(
self
).
__name__
,
name
)
)
self
.
name
=
name
self
.
latex_label
=
latex_label
self
.
unit
=
unit
self
.
minimum
=
minimum
self
.
maximum
=
maximum
self
.
check_range_nonzero
=
check_range_nonzero
self
.
least_recently_sampled
=
None
self
.
boundary
=
boundary
self
.
_is_fixed
=
False
...
...
This diff is collapsed.
Click to expand it.
test/prior_test.py
+
2
−
2
View file @
6436d66d
...
...
@@ -42,9 +42,9 @@ class TestPriorInstantiationWithoutOptionalPriors(unittest.TestCase):
arguments.
"""
self
.
prior
=
bilby
.
core
.
prior
.
Prior
(
name
=
'
test_name
'
,
latex_label
=
'
test_label
'
,
minimum
=
0
,
maximum
=
1
,
boundary
=
None
)
check_range_nonzero
=
True
,
boundary
=
None
)
expected_string
=
"
Prior(name=
'
test_name
'
, latex_label=
'
test_label
'
, unit=None, minimum=0, maximum=1,
"
\
"
boundary=None)
"
"
check_range_nonzero=True,
boundary=None)
"
self
.
assertTrue
(
sorted
(
expected_string
)
==
sorted
(
self
.
prior
.
__repr__
()))
def
test_base_prob
(
self
):
...
...
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