From f77ecf10b0a4e9a1cecf7770fa211944927667b7 Mon Sep 17 00:00:00 2001 From: Raphael <raphael.sturgis@gmail.com> Date: Tue, 12 Apr 2022 11:19:06 +0200 Subject: [PATCH] recreated bug --- skais/__init__.py | 2 +- skais/tests/ais/test_ais_trajectory.py | 36 ++++++++++++++++++++++++++ 2 files changed, 37 insertions(+), 1 deletion(-) diff --git a/skais/__init__.py b/skais/__init__.py index 834dc3a..db0f985 100644 --- a/skais/__init__.py +++ b/skais/__init__.py @@ -1 +1 @@ -__version__ = "0.1a" +__version__ = "0.2a" diff --git a/skais/tests/ais/test_ais_trajectory.py b/skais/tests/ais/test_ais_trajectory.py index 56aa71c..d22e22f 100644 --- a/skais/tests/ais/test_ais_trajectory.py +++ b/skais/tests/ais/test_ais_trajectory.py @@ -616,3 +616,39 @@ class TestAISTrajectoryImageGeneration(unittest.TestCase): [0.25, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0.25, 0.5]]) / 2 np.testing.assert_array_equal(result, expected) + + def test_generate_array_from_positions_with_line_multi_channel_dict(self): + trajectory = AISTrajectory( + pd.DataFrame( + { + "latitude": [0, 10, 0, 20], + "longitude": [0, 10, 20, 20], + "ts_sec": [i for i in range(4)], + "sog": [10, 10, 20, 40], + "cog": [40, 20, 10, 10] + } + ) + ) + + result = trajectory.generate_array_from_positions(height=9, width=18, link=True, bounding_box='fit', + features={'sog': (0, 40), 'cog': (0, 40)}, node_size=2) + expected = np.array([[[0, 0], [0, 0], [0, 0], [0, 0], [0, 0], [0, 0], [0, 0], [0, 0], [0, 0], [0, 0], [0, 0], + [0, 0], [0, 0], [0, 0], [0, 0], [0, 0], [0, 0], [0.5, 0.25]], + [[0, 0], [0, 0], [0, 0], [0, 0], [0, 0], [0, 0], [0, 0], [0, 0], [0, 0], [0, 0], [0, 0], + [0, 0], [0, 0], [0, 0], [0, 0], [0, 0], [0, 0], [0.5, 0.25]], + [[0, 0], [0, 0], [0, 0], [0, 0], [0, 0], [0, 0], [0, 0], [0, 0], [0, 0], [0, 0], [0, 0], + [0, 0], [0, 0], [0, 0], [0, 0], [0, 0], [0, 0], [0.5, 0.25]], + [[0, 0], [0, 0], [0, 0], [0, 0], [0, 0], [0, 0], [0, 0], [0, 0], [0, 0], [0, 0], [0, 0], + [0, 0], [0, 0], [0, 0], [0, 0], [0, 0], [0, 0], [0.5, 0.25]], + [[0, 0], [0, 0], [0, 0], [0, 0], [0, 0], [0, 0], [0, 0], [0.25, 1], [0.25, 0.5], + [0.25, 0.5], [0, 0], [0, 0], [0, 0], [0, 0], [0, 0], [0, 0], [0, 0], [0.5, 0.25]], + [[0, 0], [0, 0], [0, 0], [0, 0], [0, 0], [0.25, 1], [0.25, 1], [0, 0], [0, 0], [0, 0], + [0.25, 0.5], [0.25, 0.5], [0, 0], [0, 0], [0, 0], [0, 0], [0, 0], [0.5, 0.25]], + [[0, 0], [0, 0], [0, 0], [0.25, 1], [0.25, 1], [0, 0], [0, 0], [0, 0], [0, 0], [0, 0], + [0, 0], [0, 0], [0.25, 0.5], [0.25, 0.5], [0, 0], [0, 0], [0, 0], [0.5, 0.25]], + [[0, 0], [0.25, 1], [0.25, 1], [0, 0], [0, 0], [0, 0], [0, 0], [0, 0], [0, 0], [0, 0], + [0, 0], [0, 0], [0, 0], [0, 0], [0.25, 0.5], [0.25, 0.5], [0, 0], [0.5, 0.25]], + [[0.25, 1], [0, 0], [0, 0], [0, 0], [0, 0], [0, 0], [0, 0], [0, 0], [0, 0], [0, 0], [0, 0], + [0, 0], [0, 0], [0, 0], [0, 0], [0, 0], [0.25, 0.5], [0.5, 0.25]]]) + + np.testing.assert_array_equal(result, expected) \ No newline at end of file -- GitLab