Skip to content

Commit c1be0f3

Browse files
maubrevilleCopilot
andauthored
Update exact/util/cellvizio.py
Maybe not essential, but also doesn't hurt. Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
1 parent bc332f7 commit c1be0f3

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

exact/util/cellvizio.py

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -113,8 +113,17 @@ def getMostRelevantMetaInfo(self):
113113
continue
114114
key, value = line.split('=')
115115
if key == 'framerate':
116-
relevantInfo['framerate'] = value
117-
relevantInfo['duration_seconds'] = self.fi.nImages / float(relevantInfo['framerate'])
116+
value_str = value.strip()
117+
try:
118+
framerate = float(value_str)
119+
except ValueError:
120+
print(f"Warning: invalid framerate value in metadata: {value_str!r}")
121+
continue
122+
if framerate <= 0:
123+
print(f"Warning: non-positive framerate value in metadata: {framerate}")
124+
continue
125+
relevantInfo['framerate'] = value_str
126+
relevantInfo['duration_seconds'] = self.fi.nImages / framerate
118127
elif key == 'width':
119128
relevantInfo['width'] = value
120129
elif key == 'height':

0 commit comments

Comments
 (0)