-
Notifications
You must be signed in to change notification settings - Fork 11
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Save 'arm_time', 'start_time' and 'hw_time_offset_ns' to file #81
Conversation
This is initial working implementation of the code. Missing parameters are assigned default value
|
The result of testing with Clock Source set as
|
@coretl Do you think we need to convert |
It is an int64 with units of nanoseconds so probably best to store it in the HDF file as such. This is only used for debugging really... |
Yes, I agree with keeping |
At the moment the as yet unmerged docs from PandABlocks/PandABlocks-server#45 read:
This means that if I will suggest some different words for PandABlocks/PandABlocks-server#45 to try and make that clearer, please comment there if you can think of some improvements for the docs too.
Will you put it as an int64 attribute in the HDF file then? I'm not sure what datatypes HDF attributes support... |
I changed the type of |
8a0919e
to
f663798
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just one type annotation
CI won't work until #78 is merged. Tests pass locally. |
import h5py | ||
import pandas as pd | ||
|
||
with h5py.File('data/panda_rbdata_20240305_152712.h5', 'r') as f: | ||
arm_time = f.attrs['arm_time'] | ||
start_time = f.attrs['start_time'] | ||
hw_time_offset_ns = f.attrs['hw_time_offset_ns'] | ||
|
||
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 > 0: | ||
ts_start += pd.Timedelta(nanoseconds=hw_time_offset_ns) | ||
print(f'Start TS including the offset: {ts_start}') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please could you put snippets of Python into the examples/
directory and include their contents here so they can be easily tested?
E.g.:
https://github.com/PandABlocks/PandABlocks-client/blob/master/docs/user/how-to/library-hdf.rst
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Changes to the documentation were implemented. The example code code was moved to examples/load_abs_timestamps.py
.
I tested the package with Panda IOC and Panda again to make sure it works as expected. |
I had an impression that |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Only one clarification to the text, start_time
will be hardware if available, falling back to software if not. Suggested some changes to make this clear
Co-authored-by: Tom C (DLS) <[email protected]>
Co-authored-by: Tom C (DLS) <[email protected]>
…an be converted to 'int64' Co-authored-by: Tom C (DLS) <[email protected]>
Co-authored-by: Tom C (DLS) <[email protected]>
Co-authored-by: Tom C (DLS) <[email protected]>
Co-authored-by: Tom C (DLS) <[email protected]>
It looks like the PR is ready to be merged. |
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## master #81 +/- ##
==========================================
+ Coverage 96.86% 96.90% +0.03%
==========================================
Files 12 12
Lines 1181 1194 +13
==========================================
+ Hits 1144 1157 +13
Misses 37 37 ☔ View full report in Codecov by Sentry. |
Saving the timing parameters
arm_time
,start_time
andhw_time_offset_ns
passed as part of the header from PandA Box to IOC in as root attributes of the HDF5 file.Issue: #80