Some checks failed
gitea-physics/pathfinder/pipeline/head There was a failure building this commit
21 lines
800 B
Python
21 lines
800 B
Python
import pathfinder.model.oscillating.util as util
|
|
import numpy
|
|
|
|
|
|
def test_util_flip():
|
|
pt = numpy.array((1, 2, 3, 4, 5, 6, 7))
|
|
expected = (1, 2, 3, 4, 5, 6, 7)
|
|
numpy.testing.assert_allclose(util.flip_chunk_to_positive_px(pt), expected, err_msg="Point should remain unchanged.")
|
|
|
|
|
|
def test_util_flip_negative():
|
|
pt = numpy.array((-1, -2, 3, 4, 5, 6, 7))
|
|
expected = (1, 2, -3, 4, 5, 6, 7)
|
|
numpy.testing.assert_allclose(util.flip_chunk_to_positive_px(pt), expected, err_msg="Point should remain unchanged.")
|
|
|
|
|
|
def test_util_normalise_two():
|
|
pt = numpy.array((1, 2, 3, 4, 5, 6, 7, -.5, 1, 1.5, 2, 2.5, 3, 3.5))
|
|
expected = (.5, -1, -1.5, 2, 2.5, 3, 3.5, 1, 2, 3, 4, 5, 6, 7)
|
|
numpy.testing.assert_allclose(util.normalize_oscillating_dipole_list(pt), expected, err_msg="Sort should have happened.")
|