Analysis

class movement_detector.analysis.AbstractMetaAnalyzer(detector)

Metadata analyzer.

A group of classes that can analyze metadata produced by a detector object.

Parameters

detector (AbstractMovementDetector) – The detector who’s metadata to analyze.

static get_analysis_path(vid_path)

Returns the path in which to save the analysis file.

The analysis is saved in a sub-path relative to the analysis folder that mimics the sub-path of the detector’s video file relative to the videos folder.

Parameters

vid_path (Path) – The path to the video file.

Returns

path – The path to the analysis file.

Return type

Path

run()

Run the analysis.

Applies the analysis to the metadata and saves the results as a CSV file.

If the detector hasn’t been ran, self.detector.run() is called.

class movement_detector.analysis.IntervalAggregatorMA(detector, intervals, aggregation=<function mean>, include_start=True, include_end=True)

Interval metadata aggregator.

The interval aggregator applies an aggregation function to the count of the frames containing movement flagged by the detector over the specified intervals of time.

Passing an np.mean aggregation will result in the percentage of movement frames detected in each interval.

Parameters
  • detector (AbstractMovementDetector) – The detector who’s metadata to analyze.

  • intervals (list of floats) – A list of the interval cut-off points.

  • aggregation (Callable, default np.mean) – The aggregation operation that will be applied on the movement-positive frames in the specified intervals.

  • include_start (bool, default True) – If set to True and the first cut-off point is not zero, the first interval will span from the start of the video to the first cut-off.

  • include_end (bool, default True) – If set to True and the last cut-off point is lower than the duration of the video, the last interval will span from the cut-off point to the end of the video.

property aggregation

The aggregation operation.

property intervals

The list of cut-off points for the intervals.