Improves some test stuff.
This commit is contained in:
parent
c279f1b470
commit
d31fbb55eb
@ -14,6 +14,27 @@ def test_dotdipolemodel_m():
|
||||
assert mod.m == 2
|
||||
|
||||
|
||||
def test_dotdipolemodel_cost():
|
||||
mod = model.DotDipoleModel([model.DotMeasurement(1, (0, 0, 1)), model.DotMeasurement(2, (1, 0, 0))], 1)
|
||||
costs = mod.costs()
|
||||
jac = mod.jac()
|
||||
|
||||
pt_to_test = numpy.array((1, 2, 3, 4, 5, 6))
|
||||
expected_cost = [-1.05408565512728256, -2.05293155269909457]
|
||||
expected_jacobian = [
|
||||
[
|
||||
-0.007460090362383803, -0.009325112952979752, -0.009325112952979752,
|
||||
0.007968732887091788, 0.00856214916591777, 0.006697126575321822
|
||||
], [
|
||||
-0.00512240832571883, -0.008537347209531383, -0.01024481665143766,
|
||||
0.005098015905120168, 0.007927536694564856, 0.008488562368334061
|
||||
]
|
||||
]
|
||||
|
||||
numpy.testing.assert_allclose(costs(pt_to_test), expected_cost, err_msg="Costs aren't as expected.")
|
||||
numpy.testing.assert_allclose(jac(pt_to_test), expected_jacobian, err_msg="Jacobian aren't as expected.")
|
||||
|
||||
|
||||
def print_result(msg, result):
|
||||
print(msg)
|
||||
print(f"\tResult: {result.x}")
|
||||
|
@ -1,5 +1,6 @@
|
||||
from pathfinder import __version__
|
||||
|
||||
import pathfinder
|
||||
|
||||
def test_version():
|
||||
assert __version__ == '0.0.1'
|
||||
assert pathfinder.get_version() == __version__
|
Reference in New Issue
Block a user