Skip to content

Instantly share code, notes, and snippets.

@papr
Last active February 14, 2017 20:00
Show Gist options
  • Save papr/92d9cf729ff130e500dfa53bb595f31b to your computer and use it in GitHub Desktop.
Save papr/92d9cf729ff130e500dfa53bb595f31b to your computer and use it in GitHub Desktop.
import numpy as np
deduplication_offset = 1e-9
deduplication_counter = 0
timestamp_file_path = 'world_timestamps.npy'
print('Loading timestamps...')
timestamps = np.sort(np.load(timestamp_file_path))
print('Starting timestamp deduplication...')
for idx in range(1, timestamps.shape[0]):
if timestamps[idx] - timestamps[idx-1] < deduplication_offset:
timestamps[idx] += deduplication_offset
deduplication_counter += 1
print('Deduplicated {} timestamps.'.format(deduplication_counter))
np.save(timestamp_file_path, timestamps)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment