Skip to content

Commit

Permalink
fdfit: update tests
Browse files Browse the repository at this point in the history
  • Loading branch information
JoepVanlier committed Aug 29, 2023
1 parent 9eb7511 commit 3eace10
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 11 deletions.
2 changes: 1 addition & 1 deletion lumicks/pylake/fitting/tests/test_fd_models.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ def test_models():
# Check the tWLC and inverted tWLC model
params = [5, 5, 5, 3, 2, 1, 6, 4.11]
assert twlc_distance("tWLC").verify_jacobian(independent, params)
assert twlc_force("itWLC").verify_jacobian(independent, params)
assert twlc_force("itWLC").verify_jacobian(independent, params, rtol=1e-4)

# Check whether the twistable wlc model manipulates the data order
np.testing.assert_allclose(
Expand Down
13 changes: 3 additions & 10 deletions lumicks/pylake/fitting/tests/test_model_composition.py
Original file line number Diff line number Diff line change
Expand Up @@ -134,21 +134,14 @@ def test_subtract_independent_offset_unit(model, param, unit):
assert model.defaults[param].unit == unit


def test_interpolation_inversion():
m = ewlc_odijk_distance("Nucleosome").invert(independent_max=120.0, interpolate=True)
@pytest.mark.parametrize("method", ["exact", "interp_lsq", "interp_root"])
def test_interpolation_inversion(method):
m = ewlc_odijk_distance("Nucleosome").invert(independent_max=120.0, method=method)
parvec = [5.77336105517341, 7.014180463612673, 1500.0000064812095, 4.11]
result = np.array([0.17843862, 0.18101283, 0.18364313, 0.18633117, 0.18907864])
np.testing.assert_allclose(m._raw_call(np.arange(10, 250, 50) / 1000, parvec), result)


@pytest.mark.parametrize("param", [{"independent_max": np.inf}, {"independent_min": -np.inf}])
def test_interpolation_invalid_range(param):
with pytest.raises(
ValueError, match="Inversion limits have to be finite when using interpolation method"
):
ewlc_odijk_distance("Nucleosome").invert(**param, interpolate=True)


def test_uuids():
m1, m2 = (Model(name, lambda x: x, dependent="x") for name in ("M1", "M2"))
m3 = CompositeModel(m1, m2)
Expand Down

0 comments on commit 3eace10

Please sign in to comment.