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
3c13736c
Commit
3c13736c
authored
6 years ago
by
Colm Talbot
Browse files
Options
Downloads
Patches
Plain Diff
add samplers to tests
parent
2ab9c1fe
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
.gitlab-ci.yml
+4
-0
4 additions, 0 deletions
.gitlab-ci.yml
bilby/core/sampler/emcee.py
+1
-1
1 addition, 1 deletion
bilby/core/sampler/emcee.py
bilby/core/sampler/pymc3.py
+1
-1
1 addition, 1 deletion
bilby/core/sampler/pymc3.py
test/sampler_test.py
+58
-1
58 additions, 1 deletion
test/sampler_test.py
with
64 additions
and
3 deletions
.gitlab-ci.yml
+
4
−
0
View file @
3c13736c
...
...
@@ -18,6 +18,8 @@ python-2:
stage
:
test
image
:
bilbydev/test-suite-py2
before_script
:
# Source the .bashrc for MultiNest
-
source /root/.bashrc
# Install the dependencies specified in the Pipfile
-
pipenv install --two --python=/opt/conda/bin/python2 --system --deploy
script
:
...
...
@@ -30,6 +32,8 @@ python-3:
stage
:
test
image
:
bilbydev/test-suite-py3
before_script
:
# Source the .bashrc for MultiNest
-
source /root/.bashrc
# Install the dependencies specified in the Pipfile
-
pipenv install --three --python=/opt/conda/bin/python --system --deploy
script
:
...
...
This diff is collapsed.
Click to expand it.
bilby/core/sampler/emcee.py
+
1
−
1
View file @
3c13736c
from
__future__
import
absolute_import
from
__future__
import
absolute_import
,
print_function
import
numpy
as
np
from
pandas
import
DataFrame
from
..utils
import
logger
,
get_progress_bar
...
...
This diff is collapsed.
Click to expand it.
bilby/core/sampler/pymc3.py
+
1
−
1
View file @
3c13736c
from
__future__
import
absolute_import
from
__future__
import
absolute_import
,
print_function
from
collections
import
OrderedDict
import
inspect
...
...
This diff is collapsed.
Click to expand it.
test/sampler_test.py
+
58
−
1
View file @
3c13736c
...
...
@@ -5,7 +5,6 @@ from bilby.core.result import Result
import
unittest
from
mock
import
MagicMock
import
numpy
as
np
import
inspect
import
os
import
copy
...
...
@@ -393,5 +392,63 @@ class TestPymultinest(unittest.TestCase):
self
.
assertDictEqual
(
expected
,
self
.
sampler
.
kwargs
)
class
TestRunningSamplers
(
unittest
.
TestCase
):
def
setUp
(
self
):
np
.
random
.
seed
(
42
)
bilby
.
core
.
utils
.
command_line_args
.
test
=
False
self
.
x
=
np
.
linspace
(
0
,
1
,
11
)
self
.
model
=
lambda
x
,
m
,
c
:
m
*
x
+
c
self
.
injection_parameters
=
dict
(
m
=
0.5
,
c
=
0.2
)
self
.
sigma
=
0.1
self
.
y
=
self
.
model
(
self
.
x
,
**
self
.
injection_parameters
)
+
\
np
.
random
.
normal
(
0
,
self
.
sigma
,
len
(
self
.
x
))
self
.
likelihood
=
bilby
.
likelihood
.
GaussianLikelihood
(
self
.
x
,
self
.
y
,
self
.
model
,
self
.
sigma
)
self
.
priors
=
dict
(
m
=
bilby
.
core
.
prior
.
Uniform
(
0
,
5
),
c
=
bilby
.
core
.
prior
.
Uniform
(
-
2
,
2
))
def
tearDown
(
self
):
del
self
.
likelihood
del
self
.
priors
bilby
.
core
.
utils
.
command_line_args
.
test
=
False
def
test_run_cpnest
(
self
):
_
=
bilby
.
run_sampler
(
likelihood
=
self
.
likelihood
,
priors
=
self
.
priors
,
sampler
=
'
cpnest
'
,
nlive
=
100
,
save
=
False
)
def
test_run_dynesty
(
self
):
_
=
bilby
.
run_sampler
(
likelihood
=
self
.
likelihood
,
priors
=
self
.
priors
,
sampler
=
'
dynesty
'
,
nlive
=
100
,
save
=
False
)
def
test_run_emcee
(
self
):
_
=
bilby
.
run_sampler
(
likelihood
=
self
.
likelihood
,
priors
=
self
.
priors
,
sampler
=
'
emcee
'
,
nsteps
=
1000
,
nwalkers
=
10
,
save
=
False
)
def
test_run_nestle
(
self
):
_
=
bilby
.
run_sampler
(
likelihood
=
self
.
likelihood
,
priors
=
self
.
priors
,
sampler
=
'
nestle
'
,
nlive
=
100
,
save
=
False
)
def
test_run_ptemcee
(
self
):
_
=
bilby
.
run_sampler
(
likelihood
=
self
.
likelihood
,
priors
=
self
.
priors
,
sampler
=
'
ptemcee
'
,
nsteps
=
1000
,
nwalkers
=
10
,
ntemps
=
10
,
save
=
False
)
def
test_run_pymc3
(
self
):
_
=
bilby
.
run_sampler
(
likelihood
=
self
.
likelihood
,
priors
=
self
.
priors
,
sampler
=
'
pymc3
'
,
draws
=
50
,
tune
=
50
,
n_init
=
1000
,
save
=
False
)
def
test_run_pymultinest
(
self
):
_
=
bilby
.
run_sampler
(
likelihood
=
self
.
likelihood
,
priors
=
self
.
priors
,
sampler
=
'
pymultinest
'
,
nlive
=
100
,
save
=
False
)
if
__name__
==
'
__main__
'
:
unittest
.
main
()
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