pymaid.get_user_stats

pymaid.get_user_stats(start_date=None, end_date=None, remote_instance=None)[source]

Get user stats similar to the pie chart statistics widget in CATMAID.

Returns cable [nm], nodes created/reviewed and connector links created.

Parameters
  • start_date (tuple | datetime.date, optional) –

  • end_date (tuple | datetime.date, optional) – Start and end date of time window to check. If None, will use entire project history.

  • remote_instance (CatmaidInstance, optional) – Either pass explicitly or define globally.

Returns

Dataframe in which each row represents a user:

         cable  nodes_created  nodes_reviewed  links_created
username
   user1  ...
   user2  ...

Return type

pandas.DataFrame

Examples

Create a pie chart similar to the stats widget in CATMAID:

>>> import matplotlib.pyplot as plt
>>> stats = pymaid.get_user_stats()
>>> stats_to_plot = ['cable', 'nodes_created', 'nodes_reviewed',
...                  'links_created']
>>> fig, axes = plt.subplots(1, len(stats_to_plot), figsize=(12, 4))
>>> for s, ax in zip(stats_to_plot, axes):
...     # Get the top 10 contributors for this stat
...     this_stats = stats[s].sort_values(ascending=False).iloc[:10]
...     # Calculate "others"
...     this_stats.loc['others'] = stats[s].sort_values(ascending=False).iloc[10:].sum()
...     # Plot
...     this_stats.plot.pie(ax=ax, textprops={'size': 6},
...                         explode=[.05] * this_stats.shape[0],
...                         rotatelabels=True)
...     # Make labels a bit smaller
...     ax.set_ylabel(s.replace('_', ' '), fontsize=8)
>>> plt.show()

See also

get_history()

Returns day-by-day stats.