MCPcopy Create free account
hub / github.com/OpenPTrack/open_ptrack_v2 / extract_seconds

Function extract_seconds

rtpose_wrapper/tools/extra/extract_seconds.py:44–58  ·  view source on GitHub ↗
(input_file, output_file)

Source from the content-addressed store, hash-verified

42
43
44def extract_seconds(input_file, output_file):
45 with open(input_file, 'r') as f:
46 lines = f.readlines()
47 log_created_year = get_log_created_year(input_file)
48 start_datetime = get_start_time(lines, log_created_year)
49 assert start_datetime, 'Start time not found'
50
51 out = open(output_file, 'w')
52 for line in lines:
53 line = line.strip()
54 if line.find('Iteration') != -1:
55 dt = extract_datetime_from_line(line, log_created_year)
56 elapsed_seconds = (dt - start_datetime).total_seconds()
57 out.write('%f\n' % elapsed_seconds)
58 out.close()
59
60if __name__ == '__main__':
61 if len(sys.argv) < 3:

Callers 1

extract_seconds.pyFile · 0.85

Calls 4

get_log_created_yearFunction · 0.85
get_start_timeFunction · 0.85
closeMethod · 0.80

Tested by

no test coverage detected