scripts.analyze_tracking_log module 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: -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


  • Timing visualization

Also, convert to CSV, to make it grep-able? First: fixed-name cols, then: args dict, formatted as key=value,key=value


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.freqdict(l, sort=True)[source]

Checks that the given path is an annotation package.


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.


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'},'''

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.