Skip to content
Snippets Groups Projects

Resolve "Image creation bugs with 0 size windows"

1 file
+ 50
0
Compare changes
  • Side-by-side
  • Inline
@@ -453,4 +453,54 @@ class TestAISTrajectory(unittest.TestCase):
[0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 1],
[1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1]])
np.testing.assert_array_equal(result, expected)
def test_generate_array_from_positions_single_point(self):
trajectory = AISTrajectory(
pd.DataFrame(
{
"latitude": [5],
"longitude": [20],
"ts_sec": [0]
}
)
)
result = trajectory.generate_array_from_positions(height=9, width=9, link=False, bounding_box='fit',
features=None).reshape((9, 9))
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, 0],
[0, 0, 0, 0, 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],
[0, 0, 0, 0, 0, 0, 0, 0, 0]])
np.testing.assert_array_equal(result, expected)
def test_generate_array_from_positions_overlapping_points(self):
trajectory = AISTrajectory(
pd.DataFrame(
{
"latitude": [5, 5, 5, 5],
"longitude": [20, 20, 20, 20],
"ts_sec": [0, 1, 2, 3]
}
)
)
result = trajectory.generate_array_from_positions(height=9, width=9, link=False, bounding_box='fit',
features=None).reshape((9, 9))
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, 0],
[0, 0, 0, 0, 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],
[0, 0, 0, 0, 0, 0, 0, 0, 0]])
np.testing.assert_array_equal(result, expected)
\ No newline at end of file
Loading