From de84f9dd403aa084bd0bb712253a35be79d21ad7 Mon Sep 17 00:00:00 2001 From: Chris Kerr Date: Wed, 11 Dec 2013 13:14:19 +0000 Subject: [PATCH] Added column IDs from step voltammetry --- BioLogic.py | 27 +++++++++------------------ tests/test_BioLogic.py | 33 ++++++++++++++++++++++++++------- 2 files changed, 35 insertions(+), 25 deletions(-) diff --git a/BioLogic.py b/BioLogic.py index 4a402f3..16ae929 100644 --- a/BioLogic.py +++ b/BioLogic.py @@ -24,8 +24,10 @@ def fieldname_to_dtype(fieldname): "counter inc."): return (fieldname, np.bool_) elif fieldname in ("time/s", "Ewe/V", "P/W", "(Q-Qo)/mA.h", "x", - "control/V", "control/V/mA"): + "control/V", "control/V/mA", "(Q-Qo)/C"): return (fieldname, np.float_) + elif fieldname in ("cycle number",): + return (fieldname, np.int_) elif fieldname in ("dq/mA.h", "dQ/mA.h"): return ("dQ/mA.h", np.float_) elif fieldname in ("I/mA", "/mA"): @@ -60,23 +62,6 @@ def MPTfile(file_or_path): comments = [next(mpt_file) for i in range(nb_headers - 3)] fieldnames = next(mpt_file).decode('ascii').strip().split('\t') - - expected_fieldnames = ( - ["mode", "ox/red", "error", "control changes", "Ns changes", - "counter inc.", "time/s", "control/V/mA", "Ewe/V", "dq/mA.h", - "P/W", "/mA", "(Q-Qo)/mA.h", "x"], - ['mode', 'ox/red', 'error', 'control changes', 'Ns changes', - 'counter inc.', 'time/s', 'control/V', 'Ewe/V', 'dq/mA.h', - '/mA', '(Q-Qo)/mA.h', 'x'], - ["mode", "ox/red", "error", "control changes", "Ns changes", - "counter inc.", "time/s", "control/V", "Ewe/V", "I/mA", - "dQ/mA.h", "P/W"], - ["mode", "ox/red", "error", "control changes", "Ns changes", - "counter inc.", "time/s", "control/V", "Ewe/V", "/mA", - "dQ/mA.h", "P/W"]) - if fieldnames not in expected_fieldnames: - warn("Unrecognised headers for MPT file format %s" % fieldnames) - record_type = np.dtype(list(map(fieldname_to_dtype, fieldnames))) mpt_array = np.loadtxt(mpt_file, dtype=record_type) @@ -155,10 +140,16 @@ def VMPdata_dtype_from_colIDs(colIDs): dtype_dict['dQ/mA.h'] = '