Analysis module

This module provides functions to analyze and plot the results from temporal network analyses, especially from the tacoma.api.measure_group_sizes_and_durations() routine. These functions are not imported by default as they require matplotlib which cannot be easily installed on some systems like compute clusters due to a missing X server. If you want to use the routines of this submodule, please make sure matplotlib is installed.

tacoma.analysis.detailed_temporal_network_group_analysis(result, P_k, max_group=5, time_normalization_factor=1.0, time_unit=None, plot_step=False, fit_power_law=False, ax=None, bins=100, bin_dt=None, use_logarithmic_histogram=True, marker=None, markersize=4, label=None)[source]

Analyze the result of measure_group_sizes_and_durations() and plot it.

Parameters:
  • result (tacoma.group_sizes_and_durations) – The result of the temporal network analysis provided by tacoma.measure_group_sizes_and_durations
  • P_k (list or numpy.ndarray of float) – average degree distribution entry the \(k\)-th entry of P_k contains the average probability that a node has degree \(k\)
  • max_group (int, optional) – The maximum group size for which to plot the duration distribution. default: 5
  • time_normalization_factor (float, optional) – Factor with which the time in the duration lists are rescaled default: 1.0
  • time_unit (str, optional) – Time unit to put on the axes. default : None
  • plot_step (bool, optional) – If True, plot step functions instead of markers. default : False
  • fit_power_law (bool, optional) – If True, fit and plot a power law to the distributions. default: False
  • ax (list of matplotlib axes objects) – The axes to plot to (have to be a list of length 3 at least). If set to None, a figure and axes will be created and returned. default : None
  • bins (int, default : 100) – number of bins for the histogram
  • bin_dt (float, default : None) – if given, do discrete binning to bins of this time-length
  • use_logarithmic_histogram (bool, default : True) – if True, use logarithmicly growing bin sizes, otherwise use constant bin size
  • marker (str, default : None,) – if set, all curves will be drawn using this marker
  • markersize (int, default : 4,) – markersize for the plots
  • label (str, default : None,) – if set, all curves will be associated with this label
Returns:

  • matplotlib figure – A matplotlib figure object.
  • array_like of matplotlib axes – As the name says.
  • dict – The results of the analysis (the distributions).

tacoma.analysis.plot_binned_social_trajectory(traj, ax, time_unit='d')[source]
tacoma.analysis.plot_contact_durations(result, ax, marker=None, xlabel='duration', bins=100, time_normalization_factor=1.0, time_unit=None, bin_dt=None, plot_step=False, fit_power_law=False, use_logarithmic_histogram=True, markersize=4, label=None)[source]
tacoma.analysis.plot_degree_distribution(P_k, ax, xlabel='node degree $k$', plot_step=False, markersize=4, marker=None, label=None)[source]
tacoma.analysis.plot_group_durations(result, ax, min_group=2, max_group=5, xlabel='duration', bins=100, time_normalization_factor=1.0, bin_dt=None, time_unit=None, plot_step=False, fit_power_law=False, use_logarithmic_histogram=True, markersize=4, marker=None, label=None)[source]
tacoma.analysis.plot_group_size_histogram(result, ax, xlabel='group size $g$', plot_step=False, fit_power_law=False, markersize=4, marker=None, label=None)[source]
tacoma.analysis.plot_social_trajectory(traj, ax, time_normalization_factor=1.0, time_unit=None)[source]
tacoma.analysis.temporal_network_group_analysis(result, max_group=5, time_normalization_factor=1.0, time_unit=None, plot_step=False, fit_power_law=False, ax=None, bins=100, bin_dt=None, use_logarithmic_histogram=True, markersize=4)[source]

Analyze the result of measure_group_sizes_and_durations() and plot it.

Parameters:
  • result (tacoma.group_sizes_and_durations) – The result of the temporal network analysis provided by tacoma.measure_group_sizes_and_durations
  • max_group (int, optional) – The maximum group size for which to plot the duration distribution. default: 5
  • time_normalization_factor (float, optional) – Factor with which the time in the duration lists are rescaled default: 1.0
  • time_unit (str, optional) – Time unit to put on the axes. default : None
  • plot_step (bool, optional) – If True, plot step functions instead of markers. default : False
  • fit_power_law (bool, optional) – If True, fit and plot a power law to the distributions. default: False
  • ax (list of matplotlib axes objects) – The axes to plot to (have to be a list of length 3 at least). If set to None, a figure and axes will be created and returned. default : None
  • bins (int, default : 100) – number of bins for the histogram
  • bin_dt (float, default : None) – if given, do discrete binning to bins of this time-length
  • use_logarithmic_histogram (bool, default : True) – if True, use logarithmicly growing bin sizes, otherwise use constant bin size
  • markersize (int, default : 4,) – markersize for the plots
Returns:

  • matplotlib figure – A matplotlib figure object.
  • array_like of matplotlib axes – As the name says.
  • dict – The results of the analysis (the distributions).