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
54321ec8
Commit
54321ec8
authored
5 years ago
by
Gregory Ashton
Browse files
Options
Downloads
Patches
Plain Diff
Fix constants test
parent
630e3eaf
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
test/utils_test.py
+17
-4
17 additions, 4 deletions
test/utils_test.py
with
17 additions
and
4 deletions
test/utils_test.py
+
17
−
4
View file @
54321ec8
...
...
@@ -3,6 +3,7 @@ from __future__ import absolute_import, division
import
unittest
import
numpy
as
np
from
astropy
import
constants
import
lal
import
bilby
from
bilby.core
import
utils
...
...
@@ -11,16 +12,28 @@ 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
)
self
.
assertEqual
(
utils
.
speed_of_light
,
lal
.
C_SI
)
self
.
assertLess
(
abs
(
utils
.
speed_of_light
-
constants
.
c
.
value
)
/
utils
.
speed_of_light
,
1e-16
)
def
test_parsec
(
self
):
self
.
assertTrue
(
bilby
.
core
.
utils
.
parsec
,
constants
.
pc
.
value
)
self
.
assertEqual
(
utils
.
parsec
,
lal
.
PC_SI
)
self
.
assertLess
(
abs
(
utils
.
parsec
-
constants
.
pc
.
value
)
/
utils
.
parsec
,
1e-11
)
def
test_solar_mass
(
self
):
self
.
assertTrue
(
bilby
.
core
.
utils
.
solar_mass
,
constants
.
M_sun
.
value
)
self
.
assertEqual
(
utils
.
solar_mass
,
lal
.
MSUN_SI
)
self
.
assertLess
(
abs
(
utils
.
solar_mass
-
constants
.
M_sun
.
value
)
/
utils
.
solar_mass
,
1e-4
)
def
test_radius_of_earth
(
self
):
self
.
assertTrue
(
bilby
.
core
.
utils
.
radius_of_earth
,
constants
.
R_earth
.
value
)
self
.
assertEqual
(
bilby
.
core
.
utils
.
radius_of_earth
,
lal
.
REARTH_SI
)
self
.
assertLess
(
abs
(
utils
.
radius_of_earth
-
constants
.
R_earth
.
value
)
/
utils
.
radius_of_earth
,
1e-5
)
class
TestFFT
(
unittest
.
TestCase
):
...
...
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