From e309631c84bf28d09e96d6a3d049ffbdf0b7414b Mon Sep 17 00:00:00 2001 From: Ruben Verweij Date: Tue, 21 Apr 2020 13:56:16 +0200 Subject: [PATCH] Use timesteps as fallback to NDExperiment loops to determine total file duration, and thus framerate --- nd2reader/reader.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/nd2reader/reader.py b/nd2reader/reader.py index 7d9e4b9..8246125 100644 --- a/nd2reader/reader.py +++ b/nd2reader/reader.py @@ -129,7 +129,10 @@ class ND2Reader(FramesSequenceND): total_duration += loop['duration'] if total_duration == 0: - raise ValueError('Total measurement duration could not be determined from loops') + total_duration = self.timesteps[-1] + + if total_duration == 0: + raise ValueError('Total measurement duration could not be determined from loops') return self.metadata['num_frames'] / (total_duration/1000.0)