python
gtsam
tests
test_dataset.py
Go to the documentation of this file.
1
"""
2
GTSAM Copyright 2010-2019, Georgia Tech Research Corporation,
3
Atlanta, Georgia 30332-0415
4
All Rights Reserved
5
6
See LICENSE for the license information
7
8
Unit tests for testing dataset access.
9
Author: Frank Dellaert & Duy Nguyen Ta (Python)
10
"""
11
# pylint: disable=invalid-name, no-name-in-module, no-member
12
13
from
__future__
import
print_function
14
15
import
unittest
16
17
import
gtsam
18
from
gtsam
import
BetweenFactorPose3
19
from
gtsam.utils.test_case
import
GtsamTestCase
20
21
22
class
TestDataset
(
GtsamTestCase
):
23
"""Tests for datasets.h wrapper."""
24
25
def
setUp
(self):
26
"""Get some common paths."""
27
self.
pose3_example_g2o_file
=
gtsam.findExampleDataFile
(
28
"pose3example.txt"
)
29
30
def
test_readG2o3D
(self):
31
"""Test reading directly into factor graph."""
32
is3D =
True
33
graph, initial =
gtsam.readG2o
(self.
pose3_example_g2o_file
, is3D)
34
self.assertEqual(graph.size(), 6)
35
self.assertEqual(initial.size(), 5)
36
37
def
test_parse3Dfactors
(self):
38
"""Test parsing into data structure."""
39
factors =
gtsam.parse3DFactors
(self.
pose3_example_g2o_file
)
40
self.assertEqual(
len
(factors), 6)
41
self.assertIsInstance(factors[0], BetweenFactorPose3)
42
43
44
if
__name__ ==
'__main__'
:
45
unittest.main()
test_dataset.TestDataset.test_readG2o3D
def test_readG2o3D(self)
Definition:
test_dataset.py:30
gtsam::parse3DFactors
BetweenFactorPose3s parse3DFactors(const std::string &filename, const noiseModel::Diagonal::shared_ptr &model, size_t maxIndex)
Definition:
dataset.cpp:954
test_dataset.TestDataset.setUp
def setUp(self)
Definition:
test_dataset.py:25
gtsam::readG2o
GraphAndValues readG2o(const std::string &g2oFile, const bool is3D, KernelFunctionType kernelFunctionType)
This function parses a g2o file and stores the measurements into a NonlinearFactorGraph and the initi...
Definition:
dataset.cpp:621
test_dataset.TestDataset
Definition:
test_dataset.py:22
gtsam::utils.test_case
Definition:
test_case.py:1
test_dataset.TestDataset.test_parse3Dfactors
def test_parse3Dfactors(self)
Definition:
test_dataset.py:37
gtsam::utils.test_case.GtsamTestCase
Definition:
test_case.py:15
test_dataset.TestDataset.pose3_example_g2o_file
pose3_example_g2o_file
Definition:
test_dataset.py:27
gtsam::findExampleDataFile
GTSAM_EXPORT std::string findExampleDataFile(const std::string &name)
Definition:
dataset.cpp:70
len
size_t len(handle h)
Get the length of a Python object.
Definition:
pytypes.h:2446
gtsam
Author(s):
autogenerated on Fri Nov 1 2024 03:39:27