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
567b0986
Commit
567b0986
authored
4 years ago
by
Soichiro Morisaki
Browse files
Options
Downloads
Patches
Plain Diff
bilby/gw/prior.py: Fix the equality check of UniformInComponentsMassRatio
parent
bccc0bd7
No related branches found
Branches containing commit
No related tags found
Tags containing commit
1 merge request
!891
Add chirp-mass and mass-ratio prior which are uniform in component masses
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
bilby/gw/prior.py
+18
-2
18 additions, 2 deletions
bilby/gw/prior.py
with
18 additions
and
2 deletions
bilby/gw/prior.py
+
18
−
2
View file @
567b0986
...
...
@@ -313,6 +313,21 @@ class UniformInComponentsChirpMass(PowerLaw):
name
=
name
,
latex_label
=
latex_label
,
unit
=
unit
,
boundary
=
boundary
)
class
WrappedInterp1d
(
interp1d
):
"""
A wrapper around scipy interp1d which sets equality-by-instantiation
"""
def
__eq__
(
self
,
other
):
for
key
in
self
.
__dict__
:
if
type
(
self
.
__dict__
[
key
])
is
np
.
ndarray
:
if
not
np
.
array_equal
(
self
.
__dict__
[
key
],
other
.
__dict__
[
key
]):
return
False
elif
key
==
"
_spline
"
:
pass
elif
getattr
(
self
,
key
)
!=
getattr
(
other
,
key
):
return
False
return
True
class
UniformInComponentsMassRatio
(
Prior
):
def
__init__
(
self
,
minimum
,
maximum
,
name
=
'
mass_ratio
'
,
latex_label
=
'
$q$
'
,
...
...
@@ -339,8 +354,9 @@ class UniformInComponentsMassRatio(Prior):
latex_label
=
latex_label
,
unit
=
unit
,
boundary
=
boundary
)
self
.
norm
=
self
.
_integral
(
maximum
)
-
self
.
_integral
(
minimum
)
qs
=
np
.
linspace
(
minimum
,
maximum
,
1000
)
self
.
icdf
=
interp1d
(
self
.
cdf
(
qs
),
qs
,
kind
=
'
cubic
'
,
bounds_error
=
False
,
fill_value
=
(
minimum
,
maximum
))
self
.
icdf
=
WrappedInterp1d
(
self
.
cdf
(
qs
),
qs
,
kind
=
'
cubic
'
,
bounds_error
=
False
,
fill_value
=
(
minimum
,
maximum
))
@staticmethod
def
_integral
(
q
):
...
...
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