Closed loftusa closed 3 years ago
Hi @loftusa,
this should work if you only want the framerate (as long as it was set correctly in the parameters json file):
from tierpsy.helper.params import read_unit_conversions
masked_file_location = "<masked file location>.hdf5"
fps, microns_per_pixel, is_light_background = read_unit_conversions(masked_filename)
Alternatively, if you only have the *_featuresN.hdf5
file, you can find the fps amongst the attributes to the /trajectories_data
in the hdf5 file:
import h5py
with h5py.File(masked_file_location, 'r') as fid:
fps = fid["/trajectories_data"].attrs["fps"]
In the /trajectories_data
table inside the hdf5 you also have a few time-related columns. timestamp_time
should be in seconds, provided that an fps value was given to Tierpsy in the parameters json file!
Hi @loftusa,
this should work if you only want the framerate (as long as it was set correctly in the parameters json file):
from tierpsy.helper.params import read_unit_conversions masked_file_location = "<masked file location>.hdf5" fps, microns_per_pixel, is_light_background = read_unit_conversions(masked_filename)
Alternatively, if you only have the
*_featuresN.hdf5
file, you can find the fps amongst the attributes to the/trajectories_data
in the hdf5 file:import h5py with h5py.File(masked_file_location, 'r') as fid: fps = fid["/trajectories_data"].attrs["fps"]
In the
/trajectories_data
table inside the hdf5 you also have a few time-related columns.timestamp_time
should be in seconds, provided that an fps value was given to Tierpsy in the parameters json file!
Excellent, this is so helpful, thanks so much!
happy that helped, closing the issue now :)
Hey all.
I have an hdf5 file generated by tierpsy loaded in Python:
I'm looking to work directly with the timeseries data. In particular, I care about the worm index, timestamp, and motion modes:
I'd like to figure out the frames-per-second for the particular video that generated this HDF5 file. In particular, I'd like to average the motion-mode to some kind of "movement-per-second" metric, with the motion mode averaged for all rows for a particular worm in a given second.
Is there an easy way to pull out the length of the video, or even better, the frames-per-second? the frames used in "timestamp" aren't very useful to me if I don't have a time-conversion.