diff --git a/galvani/BioLogic.py b/galvani/BioLogic.py index 35eceb8..4eaf057 100644 --- a/galvani/BioLogic.py +++ b/galvani/BioLogic.py @@ -33,7 +33,7 @@ def fieldname_to_dtype(fieldname): return (fieldname, np.float_) elif fieldname in ("Q charge/discharge/mA.h", "step time/s", "Q charge/mA.h", "Q discharge/mA.h", - "Efficiency/%", "Capacity/mA.h") + "Temperature/°C", "Efficiency/%", "Capacity/mA.h") return (fieldname, np.float_) elif fieldname in ("cycle number", "I Range", "Ns", "half cycle"): return (fieldname, np.int_) @@ -41,8 +41,15 @@ def fieldname_to_dtype(fieldname): return ("dQ/mA.h", np.float_) elif fieldname in ("I/mA", "/mA"): return ("I/mA", np.float_) - elif fieldname in ("Ewe/V", "/V"): + elif fieldname in ("Ewe/V", "/V", "Ecell/V"): return ("Ewe/V", np.float_) + elif fieldname.endswith(("/s", "/Hz", "/deg", + "/W", "/mW", "/W.h", "/mW.h", + "/A", "/mA", "/A.h", "/mA.h", + "/V", "/mV", + "/F", "/mF", "/uF", + "/C", "/Ohm",)): + return (fieldname, np.float_) else: raise ValueError("Invalid column header: %s" % fieldname) @@ -66,7 +73,7 @@ def MPTfile(file_or_path, encoding='ascii'): mpt_file = file_or_path magic = next(mpt_file) - if magic != b'EC-Lab ASCII FILE\r\n': + if magic not in (b'EC-Lab ASCII FILE\r\n', b'BT-Lab ASCII FILE\r\n'): raise ValueError("Bad first line for EC-Lab file: '%s'" % magic) nb_headers_match = re.match(rb'Nb header lines : (\d+)\s*$', @@ -213,6 +220,7 @@ VMPdata_colID_dtype_map = { 433: ('-Im(Zwe-ce)/Ohm', '/V', ' +SPDX-License-Identifier CC-BY-4.0 diff --git a/tests/testdata/020-formation_CB5.mpt b/tests/testdata/020-formation_CB5.mpt new file mode 100644 index 0000000..88bfdaf --- /dev/null +++ b/tests/testdata/020-formation_CB5.mpt @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:c323f95a3f5f1465d07ef8654a86df1de65e3a5dc3af11e7fb27d187f2ffe43e +size 681331 diff --git a/tests/testdata/020-formation_CB5.mpt.license b/tests/testdata/020-formation_CB5.mpt.license new file mode 100644 index 0000000..148639d --- /dev/null +++ b/tests/testdata/020-formation_CB5.mpt.license @@ -0,0 +1,2 @@ +SPDX-FileCopyrightText Chihyu Chen +SPDX-License-Identifier CC-BY-4.0