From 048395b0f65c770e1b7c41f805e0a18b4ecb0f7d Mon Sep 17 00:00:00 2001 From: Vincent Fazio Date: Thu, 10 Oct 2024 07:49:29 +0800 Subject: [PATCH] Fix uint8 overflow error --- scripts/lib/imports/gocad/volumes.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/scripts/lib/imports/gocad/volumes.py b/scripts/lib/imports/gocad/volumes.py index 41eee0c..c0f10f3 100644 --- a/scripts/lib/imports/gocad/volumes.py +++ b/scripts/lib/imports/gocad/volumes.py @@ -100,8 +100,11 @@ def read_volume_binary_files(self): prop_obj.assign_to_ijk((x_val, y_val, z_val), data_val) # NB: Minimum is calculated assuming the spectrum is used for data, but # assumes that red > green > blue, so that red colours indicate greater intensity etc. - if data_val[3] > 0 and data_val[0]*256*256+data_val[1]*256+data_val[2] < min_val[0]*256*256+min_val[1]*256+min_val[2]: - min_val = data_val + try: + if data_val[3] > 0 and int(data_val[0])*256*256+int(data_val[1])*256+int(data_val[2]) < min_val[0]*256*256+min_val[1]*256+min_val[2]: + min_val = data_val + except ValueError: + pass fp_idx += 1 # If SGRID