def test_compute_hourly_count_active_0_minutes(): t1 = Timestamp(2017, 4, 12, 10, 0, 0) t2 = Timestamp(2017, 4, 12, 10, 30, 0) model = Model( StubDataStore(session_events=[(t1, INACTIVE)], desk_events=[])) result = model.compute_hourly_count(t1, t2) assert result.counts.sum() == 0
def test_compute_hourly_count_active_30_minutes(): t1 = Timestamp(2017, 4, 12, 10, 0, 0) t2 = Timestamp(2017, 4, 12, 10, 30, 0) model = Model( StubDataStore(session_events=[(t1, ACTIVE), (t2, INACTIVE)], desk_events=[])) result = model.compute_hourly_count(t1, t2) specific_hour = result[(result.weekday == 'Wednesday') & (result.hour == 10)] assert specific_hour.counts.iloc[0] == 1
from autodesk.model import Model from autodesk.plots import plot_weekday_hourly_count from autodesk.sqlitedatastore import SqliteDataStore from pandas import Timestamp import sys model = Model(SqliteDataStore(sys.argv[1])) figure = plot_weekday_hourly_count( model.compute_hourly_count(Timestamp.min, Timestamp.now())) figure.savefig(sys.argv[2], format='png')