Scheduled service maintenance on November 22


On Friday, November 22, 2024, between 06:00 CET and 18:00 CET, GIN services will undergo planned maintenance. Extended service interruptions should be expected. We will try to keep downtimes to a minimum, but recommend that users avoid critical tasks, large data uploads, or DOI requests during this time.

We apologize for any inconvenience.

1
0

situtils.py 553 B

1234567891011121314151617181920212223
  1. import numpy as np
  2. import time
  3. class FPSTimes:
  4. def __init__(self, buffer=100):
  5. self.frame_times = []
  6. self.buffer = buffer
  7. def count(self):
  8. self.frame_times.append(time.time())
  9. if len(self.frame_times) > self.buffer:
  10. self.frame_times.pop(0)
  11. def get_time_diffs(self):
  12. return np.diff(np.array(self.frame_times))
  13. def get_avg_fps(self):
  14. diffs = self.get_time_diffs()
  15. if len(diffs) > 0:
  16. return (1.0/diffs).mean()
  17. return 0