pyvisor.analysis package

Submodules

pyvisor.analysis.analysis_offline module

Offline analysis utilities for previously saved ethogram data.

Ported to Python 3.

class pyvisor.analysis.analysis_offline.analysisOffLine(filePos, fileType='pkl', behavTags=None, fps=25, behavNum=10)[source]

Bases: object

calculateSequenceIDX(data, behavIDX)[source]
calculateTransProbs(data, behavIDX)[source]
computeExclusiveModulator(behIDX, modIDX)[source]
computeInclusiveModulator(behIDX, modIDX)[source]
computeNegativeModulator(behIDX, modIDX)[source]
createAnaOnObj(data)[source]
readData()[source]
readDataSingle(filePos)[source]
reduceSequenceIDX(seqIDX)[source]
retrieveAnaOnResults()[source]
runAnaOnAnalysis()[source]
runAnalysis(transitionBehIDX)[source]
saveDataMultiple(dPos)[source]
saveDataSingle(data, fPos, sType)[source]
saveDataSingleMat(data, fPos)[source]
saveDataSinglePkl(data, fPos)[source]
saveDataSingleTxt(data, fPos)[source]
saveDataSingleXlsx(data, fPos)[source]
setAnalysisWindow(start=750, end=8248)[source]
subtractBehav(behav, modIDX)[source]

pyvisor.analysis.analysis_online module

Created on Wed Jun 22 09:11:10 2016

@author: bgeurten

class pyvisor.analysis.analysis_online.analysis(parent, fps=25)[source]

Bases: object

anaBoutDur()[source]

This function calculates the bout durations

anaFrequency()[source]

This function calculates the percentage of a behaviour in relation to the length of the sequence

anaPercentage()[source]

This analysis how much % of the time a certain behaviour was exhibited and saves as self.percAll for each animal and the mean +/- confidence interval as self.perc

calcAllSequenceChanges()[source]

This function calculates the sequence changes for all behaviours and animals and saves them in self.sequenceIDX

getDataFromScorer()[source]

This function reads in the animals structure from the Manual Ethology Scorer. @params animals structure a list of AnimalEthogram objects

getFPS()[source]
getSequenceChanges(index)[source]

This function finds the starts and ends of a behaviour which is needed for a couple of analysis, such as bout duration and frequency

mean_confidence_interval(data, confidence=0.95)[source]

This calculates the mean confidence interval

plotBoutDur(axH, fs=12)[source]
plotFrequency(axH, fs=12)[source]
plotPercentage(axH, fs=12)[source]
runAnalysis()[source]

This is the main standard analysis routine

pyvisor.analysis.ethogram_analysis module

High-level ethogram analysis utilities.

Provides percentage, bout-duration, and transition-matrix computations that can be driven from either the live GUI (TabResults) or offline scripts.

class pyvisor.analysis.ethogram_analysis.AnalysisResult(labels: ~typing.List[str], fps: float, n_frames: int, behaviour_stats: ~typing.List[~pyvisor.analysis.ethogram_analysis.BehaviourStats], transition_matrix: ~numpy.ndarray, transition_labels: ~typing.List[str], per_animal_transitions: ~typing.List[~pyvisor.analysis.ethogram_analysis.TransitionResult] = <factory>, raw_data: ~numpy.ndarray | None = None)[source]

Bases: object

Container for all analysis outputs.

behaviour_stats: List[BehaviourStats]
fps: float
labels: List[str]
n_frames: int
per_animal_transitions: List[TransitionResult]
raw_data: ndarray | None = None
transition_labels: List[str]
transition_matrix: ndarray
class pyvisor.analysis.ethogram_analysis.BehaviourStats(label: str, percentage: float, bout_durations_s: ndarray, bout_mean_s: float, bout_std_s: float, frequency_hz: float, bout_intervals_s: Tuple[float, float]]=<factory>)[source]

Bases: object

Analysis results for a single behaviour column.

bout_durations_s: ndarray
bout_intervals_s: List[Tuple[float, float]]
bout_mean_s: float
bout_std_s: float
frequency_hz: float
label: str
percentage: float
class pyvisor.analysis.ethogram_analysis.TransitionResult(matrix: ndarray, labels: List[str], title: str = '')[source]

Bases: object

Transition matrix with labels.

labels: List[str]
matrix: ndarray
title: str = ''
pyvisor.analysis.ethogram_analysis.analyse_ethogram(data: ndarray, labels: List[str], fps: float) AnalysisResult[source]

Run full analysis on an ethogram matrix.

Parameters:
  • data (ndarray, shape (n_frames, n_behaviours)) – Binary matrix where 1 indicates behaviour active at that frame.

  • labels (list of str) – Human-readable label for each column.

  • fps (float) – Frames per second of the source video.

Return type:

AnalysisResult

pyvisor.analysis.ethogram_analysis.stats_to_dataframe(result: AnalysisResult) DataFrame[source]

Return a summary DataFrame suitable for CSV export.

pyvisor.analysis.ethogram_analysis.transition_matrix_to_dataframe(result: AnalysisResult) DataFrame[source]

Return the transition matrix as a labelled DataFrame.

Module contents

Analysis modules for ethogram data.

Provides online (live) and offline analysis utilities including behaviour percentages, bout durations, and transition matrices.