mirror of
https://github.com/echemdata/galvani.git
synced 2025-12-14 09:15:34 +00:00
Default loop to none and trim the trailing zeros
This commit is contained in:
@@ -311,6 +311,7 @@ class MPRfile:
|
|||||||
"""
|
"""
|
||||||
|
|
||||||
def __init__(self, file_or_path):
|
def __init__(self, file_or_path):
|
||||||
|
self.loop_index = None
|
||||||
if isinstance(file_or_path, str):
|
if isinstance(file_or_path, str):
|
||||||
mpr_file = open(file_or_path, 'rb')
|
mpr_file = open(file_or_path, 'rb')
|
||||||
else:
|
else:
|
||||||
@@ -372,6 +373,7 @@ class MPRfile:
|
|||||||
if loop_module['version'] == 0:
|
if loop_module['version'] == 0:
|
||||||
self.loop_index = np.fromstring(loop_module['data'][4:],
|
self.loop_index = np.fromstring(loop_module['data'][4:],
|
||||||
dtype='<u4')
|
dtype='<u4')
|
||||||
|
self.loop_index = np.trim_zeros(self.loop_index, 'b')
|
||||||
else:
|
else:
|
||||||
raise ValueError("Unrecognised version for data module: %d" %
|
raise ValueError("Unrecognised version for data module: %d" %
|
||||||
data_module['version'])
|
data_module['version'])
|
||||||
|
|||||||
Reference in New Issue
Block a user