pymaid.get_history¶
- pymaid.get_history(start_date='2024-04-05', end_date='2024-04-12', split=True, remote_instance=None)[source]¶
Retrieves CATMAID project history.
If the time window is too large, the connection might time out which will result in an error! Make sure
split=True
to avoid that.- Parameters:
start_date (datetime | str | tuple, optional, default=last week) –
- dates can be either:
datetime.date
datetime.datetime
str
'YYYY-MM-DD'
, e.g.'2016-03-09'
tuple
(YYYY, MM, DD)
, e.g.(2016, 3, 9)
end_date (datetime | str | tuple, optional, default=today) – See start_date.
split (bool, optional) – If True, history will be requested in bouts of 6 months. Useful if you want to look at a very big time window as this can lead to gateway timeout.
remote_instance (CatmaidInstance, optional) – If not passed directly, will try using global.
- Returns:
A pandas.Series with the following entries:
{ cable : DataFrame containing cable created in nm. Rows = users, columns = dates connector_links : DataFrame containing connector links created. Rows = users, columns = dates reviewed : DataFrame containing nodes reviewed. Rows = users, columns = dates user_details : user-list (see pymaid.get_user_list()) nodes : DataFrame containing nodes created by user. }
- Return type:
pandas.Series
Examples
>>> import matplotlib.pyplot as plt >>> # Plot cable created by all users over time >>> hist.cable.T.plot() >>> plt.show() >>> # Collapse users and plot sum of cable over time >>> hist.cable.sum(0).plot() >>> plt.show() >>> # Plot single users cable (index by user login name) >>> hist.cable.loc['schlegelp'].T.plot() >>> plt.show() >>> # Sum up cable created this week by all users >>> hist.cable.values.sum() >>> # Get number of active (non-zero) users >>> active_users = hist.cable.astype(bool).sum(axis=0)
See also
get_user_stats()
Returns a summary of user stats as table.
plot_history()
Quick way to plot history over time.