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
0bc46421
Commit
0bc46421
authored
6 years ago
by
Gregory Ashton
Browse files
Options
Downloads
Patches
Plain Diff
Resolve "Consistency of constants between bilby and lalsuite"
parent
39168c7c
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
CHANGELOG.md
+1
-1
1 addition, 1 deletion
CHANGELOG.md
bilby/core/utils.py
+5
-5
5 additions, 5 deletions
bilby/core/utils.py
test/gw_likelihood_test.py
+2
-2
2 additions, 2 deletions
test/gw_likelihood_test.py
test/utils_test.py
+16
-0
16 additions, 0 deletions
test/utils_test.py
with
24 additions
and
8 deletions
CHANGELOG.md
+
1
−
1
View file @
0bc46421
...
...
@@ -6,7 +6,7 @@
-
### Changed
-
-
Updates the bilby.core.utils constants to match those of Astropy v3.0.4
### Removed
-
...
...
This diff is collapsed.
Click to expand it.
bilby/core/utils.py
+
5
−
5
View file @
0bc46421
...
...
@@ -13,12 +13,12 @@ from scipy.interpolate import interp2d
logger
=
logging
.
getLogger
(
'
bilby
'
)
# Constants
speed_of_light
=
299792458.0
# speed of light in m/s
parsec
=
3.085677581
*
1e16
solar_mass
=
1.98855
*
1e30
radius_of_earth
=
6371
*
1e3
# metres
# Constants: values taken from astropy v3.0.4
speed_of_light
=
299792458.0
# m/s
parsec
=
3.0856775814671916e+16
# m
solar_mass
=
1.9884754153381438e+30
# Kg
radius_of_earth
=
6378100.0
# m
def
infer_parameters_from_function
(
func
):
...
...
This diff is collapsed.
Click to expand it.
test/gw_likelihood_test.py
+
2
−
2
View file @
0bc46421
...
...
@@ -42,7 +42,7 @@ class TestBasicGWTransient(unittest.TestCase):
"""
Test log likelihood matches precomputed value
"""
self
.
likelihood
.
log_likelihood
()
self
.
assertAlmostEqual
(
self
.
likelihood
.
log_likelihood
(),
-
4055.2
526551677647
,
3
)
-
4055.2
36283345252
,
3
)
def
test_log_likelihood_ratio
(
self
):
"""
Test log likelihood ratio returns the correct value
"""
...
...
@@ -111,7 +111,7 @@ class TestGWTransient(unittest.TestCase):
"""
Test log likelihood matches precomputed value
"""
self
.
likelihood
.
log_likelihood
()
self
.
assertAlmostEqual
(
self
.
likelihood
.
log_likelihood
(),
-
4055.2
526551677647
,
3
)
-
4055.2
36283345252
,
3
)
def
test_log_likelihood_ratio
(
self
):
"""
Test log likelihood ratio returns the correct value
"""
...
...
This diff is collapsed.
Click to expand it.
test/utils_test.py
+
16
−
0
View file @
0bc46421
...
...
@@ -2,11 +2,27 @@ from __future__ import absolute_import, division
import
unittest
import
numpy
as
np
from
astropy
import
constants
import
bilby
from
bilby.core
import
utils
class
TestConstants
(
unittest
.
TestCase
):
def
test_speed_of_light
(
self
):
self
.
assertTrue
(
bilby
.
core
.
utils
.
speed_of_light
,
constants
.
c
.
value
)
def
test_parsec
(
self
):
self
.
assertTrue
(
bilby
.
core
.
utils
.
parsec
,
constants
.
pc
.
value
)
def
test_solar_mass
(
self
):
self
.
assertTrue
(
bilby
.
core
.
utils
.
solar_mass
,
constants
.
M_sun
.
value
)
def
test_radius_of_earth
(
self
):
self
.
assertTrue
(
bilby
.
core
.
utils
.
radius_of_earth
,
constants
.
R_earth
.
value
)
class
TestFFT
(
unittest
.
TestCase
):
def
setUp
(
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