Skip to content

Commit

Permalink
Add test for different control steps
Browse files Browse the repository at this point in the history
  • Loading branch information
finsberg committed Nov 1, 2023
1 parent e1edf8d commit 075c8c9
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 30 deletions.
30 changes: 0 additions & 30 deletions src/pulse2/itertarget.py
Original file line number Diff line number Diff line change
Expand Up @@ -162,26 +162,6 @@ def itertarget(
where g is implicitly defined as the target value for a given
control value.
*Arguments*
problem (:py:class:`pulse.LVProblem`)
data_collector (:py:class:`pulse.DataCollector`)
target_end (float)
target_parameters (str)
control_step (float)
control_parameter (str)
control_mode (str)
tol (float)
adapt_step (bool)
Parameters
----------
problem : LVProblem
Expand All @@ -208,16 +188,6 @@ def itertarget(
max_adapt_iter : int, optional
_description_, by default 7
Raises
------
InvalidControl
_description_
InvalidControl
_description_
InvalidControl
_description_
RuntimeError
_description_
"""

target_is_control = target_parameter == control_parameter
Expand Down
16 changes: 16 additions & 0 deletions tests/test_itertarget.py
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,22 @@ def test_itertarget_modes(
assert np.isclose(Vendo_old, Vendo_new)


@pytest.mark.parametrize("control_step", (None, 0.1, 0.01, 0.2))
def test_itertarget_control_step(control_step, problem):
target_old = problem.get_control_parameter("pressure")
target_end = 0.1
pulse2.itertarget.itertarget(
problem=problem,
target_end=target_end,
target_parameter="pressure",
control_step=control_step,
)
target_new = problem.get_control_parameter("pressure")

assert np.isclose(target_old, 0.0)
assert np.isclose(target_new, target_end)


@pytest.mark.parametrize(
"target_value, target_end, tol, expected",
(
Expand Down

0 comments on commit 075c8c9

Please sign in to comment.