This repository has been archived on 2022-02-23. You can view files and clone it, but cannot push or open issues or pull requests.
Deepak c6a5ee637f
Some checks failed
gitea-physics/pathfinder/pipeline/head There was a failure building this commit
Two dipoles, with normalisation
2021-09-13 15:29:02 -05:00

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.")