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
f6728a1c
Commit
f6728a1c
authored
5 years ago
by
Gregory Ashton
Browse files
Options
Downloads
Patches
Plain Diff
Fix and add a test
parent
3adb466e
No related branches found
No related tags found
1 merge request
!652
Remove OrderedDict from PriorDicts
Pipeline
#89617
passed
5 years ago
Stage: test
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
test/gw_prior_test.py
+11
-0
11 additions, 0 deletions
test/gw_prior_test.py
test/prior_test.py
+2
-2
2 additions, 2 deletions
test/prior_test.py
with
13 additions
and
2 deletions
test/gw_prior_test.py
+
11
−
0
View file @
f6728a1c
...
...
@@ -3,6 +3,7 @@ from collections import OrderedDict
import
unittest
import
os
import
sys
import
pickle
import
numpy
as
np
from
astropy
import
cosmology
...
...
@@ -110,6 +111,16 @@ class TestBBHPriorDict(unittest.TestCase):
minimum
=
20
,
maximum
=
40
,
name
=
'
chirp_mass
'
)
self
.
assertFalse
(
self
.
bbh_prior_dict
.
test_has_redundant_keys
())
def
test_pickle_prior
(
self
):
priors
=
dict
(
chirp_mass
=
bilby
.
core
.
prior
.
Uniform
(
10
,
20
),
mass_ratio
=
bilby
.
core
.
prior
.
Uniform
(
0.125
,
1
))
priors
=
bilby
.
gw
.
prior
.
BBHPriorDict
(
priors
)
with
open
(
"
test.pickle
"
,
"
wb
"
)
as
file
:
pickle
.
dump
(
priors
,
file
)
with
open
(
"
test.pickle
"
,
"
rb
"
)
as
file
:
priors_loaded
=
pickle
.
load
(
file
)
self
.
assertEqual
(
priors
,
priors_loaded
)
class
TestPackagedPriors
(
unittest
.
TestCase
):
"""
Test that the prepackaged priors load
"""
...
...
This diff is collapsed.
Click to expand it.
test/prior_test.py
+
2
−
2
View file @
f6728a1c
...
...
@@ -658,8 +658,8 @@ class TestPriorDict(unittest.TestCase):
priors_set
=
bilby
.
core
.
prior
.
PriorSet
(
self
.
priors
)
self
.
assertEqual
(
priors_dict
,
priors_set
)
def
test_prior_set_is_
ordered_
dict
(
self
):
self
.
assertIsInstance
(
self
.
prior_set_from_dict
,
OrderedD
ict
)
def
test_prior_set_is_dict
(
self
):
self
.
assertIsInstance
(
self
.
prior_set_from_dict
,
d
ict
)
def
test_prior_set_has_correct_length
(
self
):
self
.
assertEqual
(
3
,
len
(
self
.
prior_set_from_dict
))
...
...
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