-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #81 from dmgav/abs-ts
Save 'arm_time', 'start_time' and 'hw_time_offset_ns' to file
- Loading branch information
Showing
8 changed files
with
157 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
import sys | ||
|
||
import h5py | ||
import pandas as pd | ||
|
||
if __name__ == "__main__": | ||
with h5py.File(sys.argv[1], "r") as f: | ||
arm_time = f.attrs.get("arm_time", None) | ||
start_time = f.attrs.get("start_time", None) | ||
hw_time_offset_ns = f.attrs.get("hw_time_offset_ns", None) | ||
|
||
print(f"Arm time: {arm_time!r}") | ||
print(f"Start time: {start_time!r}") | ||
print(f"Hardware time offset: {hw_time_offset_ns!r} ns") | ||
|
||
if start_time: | ||
# Compute and print the start time that includes the offset | ||
ts_start = pd.Timestamp(start_time) | ||
if hw_time_offset_ns: | ||
ts_start += pd.Timedelta(nanoseconds=hw_time_offset_ns) | ||
print(f"Start time (system clock instead of hardware clock): {ts_start}") | ||
|
||
|
||
# Expected output: | ||
# | ||
# Arm time: '2024-03-05T20:27:12.607841574Z' | ||
# Start time: '2024-03-05T20:27:12.605729480Z' | ||
# Hardware time offset: 2155797 ns | ||
# Start TS including the offset: 2024-03-05T20:27:08.605729480Z |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters