Skip to content

Commit

Permalink
Changed result test to use example
Browse files Browse the repository at this point in the history
  • Loading branch information
joernweissenborn committed Oct 16, 2021
1 parent f8ec2ad commit 2159970
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 26 deletions.
2 changes: 1 addition & 1 deletion glotaran/examples/parallel_spectral_decay.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,4 +64,4 @@
noise_std_dev=1e-2,
)

SCHEME = Scheme(model=MODEL, parameters=PARAMETER, data={"dataset1": DATASET})
SCHEME = Scheme(model=MODEL, parameters=PARAMETER, data={"dataset_1": DATASET})
2 changes: 1 addition & 1 deletion glotaran/examples/sequential_spectral_decay.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,4 +64,4 @@
noise_std_dev=1e-2,
)

SCHEME = Scheme(model=MODEL, parameters=PARAMETER, data={"dataset1": DATASET})
SCHEME = Scheme(model=MODEL, parameters=PARAMETER, data={"dataset_1": DATASET})
27 changes: 3 additions & 24 deletions glotaran/project/test/test_result.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,37 +4,16 @@
from IPython.core.formatters import format_display_data

from glotaran.analysis.optimize import optimize
from glotaran.analysis.simulation import simulate
from glotaran.analysis.test.models import ThreeDatasetDecay as suite
from glotaran.project import Scheme
from glotaran.examples.sequential_spectral_decay import SCHEME
from glotaran.project.result import IncompleteResultError
from glotaran.project.result import Result


@pytest.fixture(scope="session")
def dummy_result():
"""Dummy result for testing."""

wanted_parameters = suite.wanted_parameters
data = {}
for i in range(3):
global_axis = getattr(suite, "global_axis" if i == 0 else f"global_axis{i+1}")
model_axis = getattr(suite, "model_axis" if i == 0 else f"model_axis{i+1}")

data[f"dataset{i+1}"] = simulate(
suite.sim_model,
f"dataset{i+1}",
wanted_parameters,
{"global": global_axis, "model": model_axis},
)
scheme = Scheme(
model=suite.model,
parameters=suite.initial_parameters,
data=data,
maximum_number_function_evaluations=1,
)

yield optimize(scheme)
print(SCHEME.data["dataset_1"])
yield optimize(SCHEME, raise_exception=True)


def test_result_ipython_rendering(dummy_result: Result):
Expand Down

0 comments on commit 2159970

Please sign in to comment.