Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
bilby
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
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
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
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
Sylvia Biscoveanu
bilby
Commits
0394aa72
Commit
0394aa72
authored
6 years ago
by
Colm Talbot
Committed by
Moritz Huebner
6 years ago
Browse files
Options
Downloads
Patches
Plain Diff
add aligned spin prior
parent
ff8cb967
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
CHANGELOG.md
+1
-0
1 addition, 0 deletions
CHANGELOG.md
test/prior_test.py
+2
-2
2 additions, 2 deletions
test/prior_test.py
tupak/gw/prior.py
+39
-1
39 additions, 1 deletion
tupak/gw/prior.py
with
42 additions
and
3 deletions
CHANGELOG.md
+
1
−
0
View file @
0394aa72
...
...
@@ -21,6 +21,7 @@ Changes currently on master, but not under a tag.
-
Hyperparameter estimation now enables the user to provide the single event evidences
-
Add nested samples to nestle output
-
Prior and child classes now implement the
\_\_
eq
\_\_
magic method for comparisons
-
Add AlignedSpin gw prior
### Changes
-
Fix construct_cbc_derived_parameters
...
...
This diff is collapsed.
Click to expand it.
test/prior_test.py
+
2
−
2
View file @
0394aa72
...
...
@@ -7,7 +7,6 @@ import os
import
shutil
from
collections
import
OrderedDict
class
TestPriorInstantiationWithoutOptionalPriors
(
unittest
.
TestCase
):
def
setUp
(
self
):
...
...
@@ -152,7 +151,8 @@ class TestPriorClasses(unittest.TestCase):
tupak
.
core
.
prior
.
Cauchy
(
name
=
'
test
'
,
unit
=
'
unit
'
,
alpha
=
0
,
beta
=
1
),
tupak
.
core
.
prior
.
Lorentzian
(
name
=
'
test
'
,
unit
=
'
unit
'
,
alpha
=
0
,
beta
=
1
),
tupak
.
core
.
prior
.
Gamma
(
name
=
'
test
'
,
unit
=
'
unit
'
,
k
=
1
,
theta
=
1
),
tupak
.
core
.
prior
.
ChiSquared
(
name
=
'
test
'
,
unit
=
'
unit
'
,
nu
=
2
)
tupak
.
core
.
prior
.
ChiSquared
(
name
=
'
test
'
,
unit
=
'
unit
'
,
nu
=
2
),
tupak
.
gw
.
prior
.
AlignedSpin
(
name
=
'
test
'
,
unit
=
'
unit
'
)
]
def
test_minimum_rescaling
(
self
):
...
...
This diff is collapsed.
Click to expand it.
tupak/gw/prior.py
+
39
−
1
View file @
0394aa72
import
os
from
..core.prior
import
PriorSet
,
FromFile
,
Prior
,
DeltaFunction
,
Gaussian
from
..core.prior
import
(
PriorSet
,
Uniform
,
FromFile
,
Prior
,
DeltaFunction
,
Gaussian
,
Interped
)
from
..core.utils
import
logger
import
numpy
as
np
from
scipy.interpolate
import
UnivariateSpline
...
...
@@ -26,6 +27,43 @@ class UniformComovingVolume(FromFile):
latex_label
=
latex_label
,
unit
=
'
Mpc
'
)
class
AlignedSpin
(
Interped
):
def
__init__
(
self
,
a_prior
=
Uniform
(
0
,
1
),
z_prior
=
Uniform
(
-
1
,
1
),
name
=
None
,
latex_label
=
None
,
unit
=
None
):
"""
Prior distribution for the aligned (z) component of the spin.
This takes prior distributions for the magnitude and cosine of the tilt
and forms a compound prior.
This is useful when using aligned-spin only waveform approximants.
This is an extension of e.g., (A7) of https://arxiv.org/abs/1805.10457.
Parameters
----------
a_prior: Prior
Prior distribution for spin magnitude
z_prior: Prior
Prior distribution for cosine spin tilt
name: see superclass
latex_label: see superclass
unit: see superclass
"""
self
.
a_prior
=
a_prior
self
.
z_prior
=
z_prior
chi_min
=
min
(
a_prior
.
maximum
*
z_prior
.
minimum
,
a_prior
.
minimum
*
z_prior
.
maximum
)
chi_max
=
a_prior
.
maximum
*
z_prior
.
maximum
xx
=
np
.
linspace
(
chi_min
,
chi_max
,
800
)
aas
=
np
.
linspace
(
a_prior
.
minimum
,
a_prior
.
maximum
,
1000
)
yy
=
[
np
.
trapz
(
np
.
nan_to_num
(
a_prior
.
prob
(
aas
)
/
aas
*
z_prior
.
prob
(
x
/
aas
)),
aas
)
for
x
in
xx
]
Interped
.
__init__
(
self
,
xx
=
xx
,
yy
=
yy
,
name
=
name
,
latex_label
=
latex_label
,
unit
=
unit
)
class
BBHPriorSet
(
PriorSet
):
def
__init__
(
self
,
dictionary
=
None
,
filename
=
None
):
"""
Initialises a Prior set for Binary Black holes
...
...
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