Adds model generators

This commit is contained in:
2022-01-22 19:22:13 -06:00
parent 7cfd98629c
commit 1e3a0f9935
7 changed files with 33 additions and 12 deletions

View File

@@ -13,7 +13,7 @@ def test_unrestricted_model_solve_basic():
))
dots = dipoles.get_dot_measurements(dot_inputs)
model = UnrestrictedModel(1, -1, 1, -1, 1, -1, 1)
model = UnrestrictedModel(1, -1, 1, -1, 1, -1, 5, 1)
# from the dipole, these are the unspecified variables in ((0, 0, 2), (1, 2, 4), 1)
expected_solution = [0.2, 0, 2, 1, 2, 4, 1]

View File

@@ -3,8 +3,8 @@ import numpy
def test_unrestricted_model_discretization():
model = UnrestrictedModel(-10, 10, -10, 10, -10, 10, 1)
discretisation = UnrestrictedDiscretisation(model, 1, 1, 2, 2, 5, 1, 15)
model = UnrestrictedModel(-10, 10, -10, 10, -10, 10, 15, 1)
discretisation = UnrestrictedDiscretisation(model, 1, 1, 2, 2, 5, 1)
# x: (-10, 0) and (0, 10)
# y: (-10, -6, -2, 2, 6, 10)
assert discretisation.cell_count == 10

View File

@@ -5,12 +5,12 @@ import numpy
def test_unrestricted_plane_model_repr():
model = UnrestrictedModel(1, 2, 3, 4, 5, 6, 6)
assert repr(model) == "UnrestrictedModel(1, 2, 3, 4, 5, 6, 6)"
model = UnrestrictedModel(1, 2, 3, 4, 5, 6, 7, 6)
assert repr(model) == "UnrestrictedModel(1, 2, 3, 4, 5, 6, 7, 6)"
def test_unrestricted_model_cost_and_jac_single():
model = UnrestrictedModel(1, -1, 1, -1, 1, -1, 1)
model = UnrestrictedModel(1, -1, 1, -1, 1, -1, 1, 1)
measured_v = 0.000191292 # from dipole with p=(0, 0, 2) at (1, 2, 4) with w = 1
dot = DotMeasurement(measured_v, (1, 2, 0), 5)
pt = numpy.array([0, 0, 2, 2, 2, 4, 2])