Gitlab will migrate to a new storage backend starting 0300 UTC on 2020-04-04. We do not anticipate a maintenance window for this migration. Performance may be impacted over the weekend. Thanks for your patience.

Commit 801be8cc authored by Gregory Ashton's avatar Gregory Ashton

Resolve "Interference of bilby command line args"

parent 39d37b0b
......@@ -800,7 +800,7 @@ class Result(object):
"""
# If in testing mode, not corner plots are generated
if utils.command_line_args.test:
if utils.command_line_args.bilby_test_mode:
return
# bilby default corner kwargs. Overwritten by anything passed to kwargs
......@@ -909,7 +909,7 @@ class Result(object):
logger.warning("Cannot plot_walkers as no walkers are saved")
return
if utils.command_line_args.test:
if utils.command_line_args.bilby_test_mode:
return
nwalkers, nsteps, ndim = self.walkers.shape
......
......@@ -164,7 +164,7 @@ def run_sampler(likelihood, priors=None, label='label', outdir='outdir',
start_time = datetime.datetime.now()
if command_line_args.test:
if command_line_args.bilby_test_mode:
result = sampler._run_test()
else:
result = sampler.run_sampler()
......
......@@ -535,7 +535,7 @@ def set_up_command_line_arguments():
help="Force cached data and do not check its validity")
parser.add_argument("--sampler-help", nargs='?', default=False,
const='None', help="Print help for given sampler")
parser.add_argument("-t", "--test", action="store_true",
parser.add_argument("--bilby-test-mode", action="store_true",
help=("Used for testing only: don't run full PE, but"
" just check nothing breaks"))
args, unknown_args = parser.parse_known_args()
......
......@@ -581,7 +581,7 @@ class Interferometer(object):
header='f h(f)')
def plot_data(self, signal=None, outdir='.', label=None):
if utils.command_line_args.test:
if utils.command_line_args.bilby_test_mode:
return
fig, ax = plt.subplots()
......
......@@ -148,7 +148,7 @@ class InterferometerList(list):
interferometer.save_data(outdir=outdir, label=label)
def plot_data(self, signal=None, outdir='.', label=None):
if utils.command_line_args.test:
if utils.command_line_args.bilby_test_mode:
return
for interferometer in self:
......
......@@ -15,7 +15,7 @@ import bilby.core.utils
import numpy as np
import inspect
bilby.core.utils.command_line_args.test = True
bilby.core.utils.command_line_args.bilby_test_mode = True
class Test(unittest.TestCase):
......
......@@ -15,7 +15,7 @@ import bilby.core.utils
import numpy as np
import inspect
bilby.core.utils.command_line_args.test = True
bilby.core.utils.command_line_args.bilby_test_mode = True
class Test(unittest.TestCase):
......
......@@ -8,7 +8,7 @@ import shutil
class TestCBCResult(unittest.TestCase):
def setUp(self):
bilby.utils.command_line_args.test = False
bilby.utils.command_line_args.bilby_test_mode = False
priors = bilby.prior.PriorDict(dict(
x=bilby.prior.Uniform(0, 1, 'x', latex_label='$x$', unit='s'),
y=bilby.prior.Uniform(0, 1, 'y', latex_label='$y$', unit='m'),
......@@ -34,7 +34,7 @@ class TestCBCResult(unittest.TestCase):
pass
def tearDown(self):
bilby.utils.command_line_args.test = True
bilby.utils.command_line_args.bilby_test_mode = True
try:
shutil.rmtree(self.result.outdir)
except OSError:
......
......@@ -54,7 +54,7 @@ class TestResult(unittest.TestCase):
def setUp(self):
np.random.seed(7)
bilby.utils.command_line_args.test = False
bilby.utils.command_line_args.bilby_test_mode = False
priors = bilby.prior.PriorDict(dict(
x=bilby.prior.Uniform(0, 1, 'x', latex_label='$x$', unit='s'),
y=bilby.prior.Uniform(0, 1, 'y', latex_label='$y$', unit='m'),
......@@ -79,7 +79,7 @@ class TestResult(unittest.TestCase):
pass
def tearDown(self):
bilby.utils.command_line_args.test = True
bilby.utils.command_line_args.bilby_test_mode = True
try:
shutil.rmtree(self.result.outdir)
except OSError:
......@@ -395,7 +395,7 @@ class TestResultList(unittest.TestCase):
def setUp(self):
np.random.seed(7)
bilby.utils.command_line_args.test = False
bilby.utils.command_line_args.bilby_test_mode = False
self.priors = bilby.prior.PriorDict(dict(
x=bilby.prior.Uniform(0, 1, 'x', latex_label='$x$', unit='s'),
y=bilby.prior.Uniform(0, 1, 'y', latex_label='$y$', unit='m'),
......@@ -450,7 +450,7 @@ class TestResultList(unittest.TestCase):
res.save_to_file()
def tearDown(self):
bilby.utils.command_line_args.test = True
bilby.utils.command_line_args.bilby_test_mode = True
try:
shutil.rmtree(self.nested_results[0].outdir)
except OSError:
......
......@@ -447,7 +447,7 @@ class TestRunningSamplers(unittest.TestCase):
def setUp(self):
np.random.seed(42)
bilby.core.utils.command_line_args.test = False
bilby.core.utils.command_line_args.bilby_test_mode = 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)
......@@ -465,7 +465,7 @@ class TestRunningSamplers(unittest.TestCase):
def tearDown(self):
del self.likelihood
del self.priors
bilby.core.utils.command_line_args.test = False
bilby.core.utils.command_line_args.bilby_test_mode = False
shutil.rmtree('outdir')
def test_run_cpnest(self):
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment