Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def run(args):
import evo.common_ape_rpe as common
from evo.core import sync
from evo.tools import file_interface, log
log.configure_logging(args.verbose, args.silent, args.debug,
local_logfile=args.logfile)
if args.debug:
from pprint import pformat
parser_str = pformat({arg: getattr(args, arg) for arg in vars(args)})
logger.debug("main_parser config:\n{}".format(parser_str))
logger.debug(SEP)
traj_ref, traj_est, ref_name, est_name = common.load_trajectories(args)
pose_relation = common.get_pose_relation(args)
delta_unit = common.get_delta_unit(args)
traj_ref_full = None
if args.plot_full_ref:
import copy
traj_ref_full = copy.deepcopy(traj_ref)
gen_parser.add_argument("-o", "--out",
help="path for config file to generate")
reset_parser = sub_parsers.add_parser(
"reset", description="reset package settings - %s" % lic,
parents=[shared_parser])
reset_parser.add_argument("-y", help="acknowledge automatically",
action="store_true")
argcomplete.autocomplete(main_parser)
if len(sys.argv) > 1 and sys.argv[1] == "set":
args, other_args = main_parser.parse_known_args()
other_args = [arg for arg in sys.argv[2:]]
else:
args, other_args = main_parser.parse_known_args()
log.configure_logging()
colorama.init()
config = settings.DEFAULT_PATH
if hasattr(args, "config"):
if args.config:
config = args.config
if args.subcommand == "show":
if not args.brief and not args.config:
style = Style.BRIGHT if not args.no_color else Style.NORMAL
doc_str = "\n".join(
"{0}{1}{2}:\n{3}\n".format(style, k, Style.RESET_ALL, v[1])
for k, v in sorted(DEFAULT_SETTINGS_DICT_DOC.items()))
logger.info(doc_str)
logger.info("{0}\n{1}\n{0}".format(SEP, config))
show(config, colored=not args.no_color)
def run(args):
import sys
from evo.core import metrics
from evo.tools import file_interface, log
# manually check bins and tols arguments to allow them to be in config files
if not args.bins or not args.tols:
logger.error("the following arguments are required: -b/--bins, -t/--tols")
sys.exit(1)
log.configure_logging(args.verbose, args.silent, args.debug)
if args.debug:
import pprint
logger.debug("main_parser config:\n"
+ pprint.pformat({arg: getattr(args, arg) for arg in vars(args)}) + "\n")
logger.debug(SEP)
pose_relation = None
if args.pose_relation == "trans_part":
pose_relation = metrics.PoseRelation.translation_part
elif args.pose_relation == "angle_deg":
pose_relation = metrics.PoseRelation.rotation_angle_deg
elif args.pose_relation == "angle_rad":
pose_relation = metrics.PoseRelation.rotation_angle_rad
traj_ref, traj_est, stamps_est = None, None, None
ref_name, est_name = "", ""
You should have received a copy of the GNU General Public License
along with evo. If not, see .
"""
import logging
import sys
import evo.core.lie_algebra as lie
from evo.core import trajectory
from evo.tools import plot, file_interface, log
import numpy as np
import matplotlib.pyplot as plt
logger = logging.getLogger("evo")
log.configure_logging(verbose=True)
traj_ref = file_interface.read_kitti_poses_file("../test/data/KITTI_00_gt.txt")
traj_est = file_interface.read_kitti_poses_file(
"../test/data/KITTI_00_ORB.txt")
# add artificial Sim(3) transformation
traj_est.transform(lie.se3(np.eye(3), [0, 0, 0]))
traj_est.scale(0.5)
logger.info("\nUmeyama alignment without scaling")
traj_est_aligned = trajectory.align_trajectory(traj_est, traj_ref)
logger.info("\nUmeyama alignment with scaling")
traj_est_aligned_scaled = trajectory.align_trajectory(traj_est, traj_ref,
correct_scale=True)
main_parser.add_argument("--save_plot", help="path to save plot",
default=None)
main_parser.add_argument("--serialize_plot",
help="path to re-serialize PlotCollection",
default=None)
main_parser.add_argument("--to_html",
help="convert to html (requires mpld3 library)",
action="store_true")
main_parser.add_argument("--no_warnings",
help="no warnings requiring user confirmation",
action="store_true")
argcomplete.autocomplete(main_parser)
args = main_parser.parse_args()
from evo.tools import log, plot, user
log.configure_logging(verbose=True)
if not args.title:
title = os.path.basename(args.in_file)
else:
title = args.title
if not args.no_warnings:
logger.warning(
"This tool is experimental and not guranteed to work.\nOnly works "
"if the same plot settings are used as for serialization.\n"
"If not, try: evo_config show/set \n" + SEP)
plot_collection = plot.PlotCollection(title, deserialize=args.in_file)
logger.debug("Deserialized PlotCollection: " + str(plot_collection))
plot_collection.show()
if args.serialize_plot:
def run(args):
import sys
import pandas as pd
from evo.tools import log, user, settings, pandas_bridge
from evo.tools.settings import SETTINGS
pd.options.display.width = 80
pd.options.display.max_colwidth = 20
log.configure_logging(args.verbose, args.silent, args.debug,
local_logfile=args.logfile)
if args.debug:
import pprint
arg_dict = {arg: getattr(args, arg) for arg in vars(args)}
logger.debug("main_parser config:\n{}\n".format(
pprint.pformat(arg_dict)))
df = load_results_as_dataframe(args.result_files, args.use_filenames,
args.merge)
keys = df.columns.values.tolist()
if SETTINGS.plot_usetex:
keys = [key.replace("_", "\\_") for key in keys]
df.columns = keys
duplicates = [x for x in keys if keys.count(x) > 1]
if duplicates: