scripts.analyze_tracking_log module¶
analyze_tracking_log.py
is a script that performs a quick and dirty analysis
of a MUSCIMarker event log. It is not necessary for using the dataset,
but you might want it running if you are annotating something with MUSCIMarker.
For an overview of command-line options, call:
analyze_tracking_log.py -h
What does the script track?
- Number of minutes/hours worked
- Speed: how much was done in total?
- Densities: frequency of events (calls) per minute/hour
Visualizations:
- Timing visualization
Also, convert to CSV, to make it grep-able? First: fixed-name cols, then: args dict, formatted as key=value,key=value
-
scripts.analyze_tracking_log.
annotations_from_package
(package)[source]¶ Collect all annotation XML files (with complete paths) from the given package.
-
scripts.analyze_tracking_log.
events_by_time_units
(events, seconds_per_unit=60)[source]¶ Puts the events into bins that correspond to equally spaced intervals of time. The length of time covered by one bin is given by seconds_per_unit.
-
scripts.analyze_tracking_log.
format_as_timeflow_csv
(events, delimiter='\t')[source]¶ There is a cool offline visualization tool caled TimeFlow, which has a timeline app. It needs a pretty specific CSV format to work, though.
-
scripts.analyze_tracking_log.
is_annotation_package
(path)[source]¶ Checks that the given path is an annotation package.
-
scripts.analyze_tracking_log.
logs_from_package
(package)[source]¶ Collects all log file names (with complete paths) from the given package.
Parameters: package – Path to the annotations package. Returns: List of filenames (full paths).
-
scripts.analyze_tracking_log.
plot_events_by_time
(events, type_key='-fn-')[source]¶ Simple scatterplot visualization.
All events are expected to have a -fn- component.
-
scripts.analyze_tracking_log.
try_correct_crashed_json
(fname)[source]¶ Attempts to correct an incomplete JSON list file: if MUSCIMarker crashed, the items list would not get correctly closed. We attempt to remove the last comma and add a closing bracket (]) on a new line instead, and return the object as a (unicode) string.
>>> json = ''' ... [ ... {'something': 'this', 'something': 'that'},'''
-
scripts.analyze_tracking_log.
unique_logs
(event_logs)[source]¶ Checks that the event logs are unique using the start event timestamp. Returns a list of unique event logs. If two have the same timestamp, the first one is used.
For logging purposes, expects a dict of event logs. Keys are log file names, values are the event lists.