mirror of
https://github.com/echemdata/galvani.git
synced 2025-12-14 01:15:34 +00:00
Merge branch 'master' into dupli_cols
This commit is contained in:
@@ -278,6 +278,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:
|
||||||
@@ -292,6 +293,7 @@ class MPRfile:
|
|||||||
self.modules = modules
|
self.modules = modules
|
||||||
settings_mod, = (m for m in modules if m['shortname'] == b'VMP Set ')
|
settings_mod, = (m for m in modules if m['shortname'] == b'VMP Set ')
|
||||||
data_module, = (m for m in modules if m['shortname'] == b'VMP data ')
|
data_module, = (m for m in modules if m['shortname'] == b'VMP data ')
|
||||||
|
maybe_loop_module = [m for m in modules if m['shortname'] == b'VMP loop ']
|
||||||
maybe_log_module = [m for m in modules if m['shortname'] == b'VMP LOG ']
|
maybe_log_module = [m for m in modules if m['shortname'] == b'VMP LOG ']
|
||||||
|
|
||||||
n_data_points = np.frombuffer(data_module['data'][:4], dtype='<u4')
|
n_data_points = np.frombuffer(data_module['data'][:4], dtype='<u4')
|
||||||
@@ -333,6 +335,16 @@ class MPRfile:
|
|||||||
tm = time.strptime(str3(settings_mod['date']), '%m-%d-%y')
|
tm = time.strptime(str3(settings_mod['date']), '%m-%d-%y')
|
||||||
self.startdate = date(tm.tm_year, tm.tm_mon, tm.tm_mday)
|
self.startdate = date(tm.tm_year, tm.tm_mon, tm.tm_mday)
|
||||||
|
|
||||||
|
if maybe_loop_module:
|
||||||
|
loop_module, = maybe_loop_module
|
||||||
|
if loop_module['version'] == 0:
|
||||||
|
self.loop_index = np.fromstring(loop_module['data'][4:],
|
||||||
|
dtype='<u4')
|
||||||
|
self.loop_index = np.trim_zeros(self.loop_index, 'b')
|
||||||
|
else:
|
||||||
|
raise ValueError("Unrecognised version for data module: %d" %
|
||||||
|
data_module['version'])
|
||||||
|
|
||||||
if maybe_log_module:
|
if maybe_log_module:
|
||||||
log_module, = maybe_log_module
|
log_module, = maybe_log_module
|
||||||
try:
|
try:
|
||||||
|
|||||||
Reference in New Issue
Block a user