Skip to content

Commit

Permalink
Merge 2a3fe9b into 4364aa7
Browse files Browse the repository at this point in the history
  • Loading branch information
zblz committed Nov 28, 2018
2 parents 4364aa7 + 2a3fe9b commit d10fe04
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 17 deletions.
14 changes: 11 additions & 3 deletions naima/tests/test_functionfit.py
Original file line number Diff line number Diff line change
Expand Up @@ -208,11 +208,19 @@ def test_interactive():
# Matplotlib warns a lot when unable to bring up the widget
warnings.simplefilter("ignore")
sampler, pos = get_sampler(
data_table=data_table, p0=p0, labels=labels, model=cutoffexp,
prior=lnprior, nwalkers=10, nburn=5, threads=1, interactive=True)
data_table=data_table,
p0=p0,
labels=labels,
model=cutoffexp,
prior=lnprior,
nwalkers=10,
nburn=5,
threads=1,
interactive=True,
)


@pytest.mark.skipif('not HAS_EMCEE')
@pytest.mark.skipif("not HAS_EMCEE")
def test_init_symmetric_dflux():
# symmetric data_table errors
sampler, pos = run_sampler(
Expand Down
36 changes: 22 additions & 14 deletions naima/tests/test_interactive.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,34 +54,42 @@ def test_modelwidget_inputs():
for dt in [data, None]:
for er in [e_range, None]:
for model in [modelfn, modelfn2]:
imf = InteractiveModelFitter(model, p0, labels=labels,
data=dt, e_range=er)
imf.update('test')
imf = InteractiveModelFitter(
model, p0, labels=labels, data=dt, e_range=er
)
imf.update("test")

for labs in [labels, labels[:2], None]:
imf = InteractiveModelFitter(model, p0, labels=labs)
for sed in [True, False]:
for dt in [data, None]:
imf = InteractiveModelFitter(model, p0, data=dt, labels=labels, sed=sed)
imf = InteractiveModelFitter(
model, p0, data=dt, labels=labels, sed=sed
)
p0[1] = -2.7
imf = InteractiveModelFitter(model, p0, labels=labels)
labels[0] = 'norm'
labels[0] = "norm"
imf = InteractiveModelFitter(model, p0, labels=labels)
plt.close('all')
plt.close("all")


@pytest.mark.skipif("not HAS_MATPLOTLIB")
def test_modelwidget_funcs():
with warnings.catch_warnings():
# Matplotlib warns a lot when unable to bring up the widget
warnings.simplefilter("ignore")
imf = InteractiveModelFitter(modelfn, p0, data=data, labels=labels, auto_update=False)
imf = InteractiveModelFitter(
modelfn, p0, data=data, labels=labels, auto_update=False
)
assert imf.autoupdate is False
imf.update_autoupdate('test')
imf.update_autoupdate("test")
assert imf.autoupdate is True
imf.parsliders[0].val *= 2
imf.update_if_auto('test')
imf.close_fig('test')

imf = InteractiveModelFitter(modelfn, p0, labels=labels, auto_update=False)
imf.update('test')
plt.close('all')
imf.update_if_auto("test")
imf.close_fig("test")

imf = InteractiveModelFitter(
modelfn, p0, labels=labels, auto_update=False
)
imf.update("test")
plt.close("all")

0 comments on commit d10fe04

Please sign in to comment.