python/gtsam/utils/__init__.py
Go to the documentation of this file.
1 import glob
2 import os.path as osp
3 
4 
6  """
7  Find the example data file specified by `name`.
8  """
9  # This is okay since gtsam will already be loaded
10  # before this function is accessed. Thus no effect.
11  import gtsam
12 
13  site_package_path = gtsam.__path__[0]
14  # add the * at the end to glob the entire directory
15  data_path = osp.join(site_package_path, "Data", "*")
16 
17  extensions = ("", ".graph", ".txt", ".out", ".xml", ".g2o")
18 
19  for data_file_path in glob.glob(data_path, recursive=True):
20  for ext in extensions:
21  if (name + ext) == osp.basename(data_file_path):
22  return data_file_path


gtsam
Author(s):
autogenerated on Tue Jul 4 2023 02:33:53