Skip to content
Snippets Groups Projects
Commit 0e82e2ec authored by johannes's avatar johannes Committed by Beat Küng
Browse files

update the batch process script for the ekf analysis tool to support resumed analysis:

	- ulog files are skipped from the analysis, if a corresponding .pdf file already exists
	- an overwrite flag can be set to analyse all the files
parent 83133b1b
No related branches found
No related tags found
No related merge requests found
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import argparse
import os
import os, glob
"""
Runs process_logdata_ekf.py on all the files in the suplied directory with a .ulg extension
Runs process_logdata_ekf.py on the .ulg files in the supplied directory. ulg files are skipped from the analysis, if a
corresponding .pdf file already exists (unless the overwrite flag was set).
"""
parser = argparse.ArgumentParser(description='Analyse the estimator_status and ekf2_innovation message data for all .ulg files in the specified directory')
parser = argparse.ArgumentParser(description='Analyse the estimator_status and ekf2_innovation message data for the'
' .ulg files in the specified directory')
parser.add_argument("directory_path")
parser.add_argument('-ow', '--overwrite', action='store_true',
help='Whether to overwrite an already analysed file. If a file with .pdf extension exists for a .ulg'
'file, the log file will be skipped from analysis unless this flag has been set.')
def is_valid_directory(parser, arg):
if os.path.isdir(arg):
......@@ -19,9 +24,17 @@ def is_valid_directory(parser, arg):
args = parser.parse_args()
ulog_directory = args.directory_path
print("\n"+"analysing all .ulog files in "+ulog_directory)
# Run the analysis script on all the log files found in the specified directory
for file in os.listdir(ulog_directory):
if file.endswith(".ulg"):
print("\n"+"loading "+file+" for analysis")
os.system("python process_logdata_ekf.py '{}'".format(os.path.join(ulog_directory, file)))
print("\n"+"analysing the .ulg files in "+ulog_directory)
# get all the ulog files found in the specified directory
ulog_files = glob.glob(os.path.join(ulog_directory, '*.ulg'))
# remove the files already analysed unless the overwrite flag was specified. A ulog file is consired to be analysed if
# a corresponding .pdf file exists.'
if not args.overwrite:
ulog_files = [ulog_file for ulog_file in ulog_files if not os.path.exists('{}.pdf'.format(ulog_file))]
# analyse all ulog files
for ulog_file in ulog_files:
print("\n"+"loading "+ulog_file +" for analysis")
os.system("python process_logdata_ekf.py '{}'".format(ulog_file))
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment