Formatting

This commit is contained in:
2019-05-03 18:39:42 +02:00
parent d991cd496e
commit 56a321f8e3

View File

@@ -144,48 +144,49 @@ VMPmodule_hdr = np.dtype([('shortname', 'S10'),
('version', '<u4'), ('version', '<u4'),
('date', 'S8')]) ('date', 'S8')])
data_dtype_dict = { # Maps from colID to a tuple defining a numpy dtype
4: ('time/s', '<f8'), VMPdata_colID_dtype_map = {
5: ('control/V/mA', '<f4'), 4: ('time/s', '<f8'),
6: ('Ewe/V', '<f4'), 5: ('control/V/mA', '<f4'),
7: ('dQ/mA.h', '<f8'), 6: ('Ewe/V', '<f4'),
8: ('I/mA', '<f4'), # 8 is either I or <I> ?? 7: ('dQ/mA.h', '<f8'),
9: ('Ece/V', '<f4'), 8: ('I/mA', '<f4'), # 8 is either I or <I> ??
11: ('I/mA', '<f8'), 9: ('Ece/V', '<f4'),
13: ('(Q-Qo)/mA.h', '<f8'), 11: ('I/mA', '<f8'),
19: ('control/V', '<f4'), 13: ('(Q-Qo)/mA.h', '<f8'),
20: ('control/mA', '<f4'), 19: ('control/V', '<f4'),
23: ('dQ/mA.h', '<f8'), # Same as 7? 20: ('control/mA', '<f4'),
24: ('cycle number', '<f8'), 23: ('dQ/mA.h', '<f8'), # Same as 7?
32: ('freq/Hz', '<f4'), 24: ('cycle number', '<f8'),
33: ('|Ewe|/V', '<f4'), 32: ('freq/Hz', '<f4'),
34: ('|I|/A', '<f4'), 33: ('|Ewe|/V', '<f4'),
35: ('Phase(Z)/deg', '<f4'), 34: ('|I|/A', '<f4'),
36: ('|Z|/Ohm', '<f4'), 35: ('Phase(Z)/deg', '<f4'),
37: ('Re(Z)/Ohm', '<f4'), 36: ('|Z|/Ohm', '<f4'),
38: ('-Im(Z)/Ohm', '<f4'), 37: ('Re(Z)/Ohm', '<f4'),
39: ('I Range', '<u2'), 38: ('-Im(Z)/Ohm', '<f4'),
70: ('P/W', '<f4'), 39: ('I Range', '<u2'),
76: ('<I>/mA', '<f4'), 70: ('P/W', '<f4'),
77: ('<Ewe>/V', '<f4'), 76: ('<I>/mA', '<f4'),
123: ('Energy charge/W.h', '<f8'), 77: ('<Ewe>/V', '<f4'),
124: ('Energy discharge/W.h', '<f8'), 123: ('Energy charge/W.h', '<f8'),
125: ('Capacitance charge/µF', '<f8'), 124: ('Energy discharge/W.h', '<f8'),
126: ('Capacitance discharge/µF', '<f8'), 125: ('Capacitance charge/µF', '<f8'),
131: ('Ns', '<u2'), 126: ('Capacitance discharge/µF', '<f8'),
169: ('Cs/µF', '<f4'), 131: ('Ns', '<u2'),
172: ('Cp/µF', '<f4'), 169: ('Cs/µF', '<f4'),
434: ('(Q-Qo)/C', '<f4'), 172: ('Cp/µF', '<f4'),
435: ('dQ/C', '<f4'), 434: ('(Q-Qo)/C', '<f4'),
467: ('Q charge/discharge/mA.h', '<f8'), 435: ('dQ/C', '<f4'),
468: ('half cycle', '<u4'), 467: ('Q charge/discharge/mA.h', '<f8'),
473: ('THD Ewe/%', '<f4'), 468: ('half cycle', '<u4'),
474: ('THD I/%', '<f4'), 473: ('THD Ewe/%', '<f4'),
476: ('NSD Ewe/%', '<f4'), 474: ('THD I/%', '<f4'),
477: ('NSD I/%', '<f4'), 476: ('NSD Ewe/%', '<f4'),
479: ('NSR Ewe/%', '<f4'), 477: ('NSD I/%', '<f4'),
480: ('NSR I/%', '<f4'), 479: ('NSR Ewe/%', '<f4'),
} 480: ('NSR I/%', '<f4'),
}
def VMPdata_dtype_from_colIDs(colIDs): def VMPdata_dtype_from_colIDs(colIDs):
@@ -214,11 +215,11 @@ def VMPdata_dtype_from_colIDs(colIDs):
raise NotImplementedError("flag %d not implemented" % colID) raise NotImplementedError("flag %d not implemented" % colID)
else: else:
try: try:
field = data_dtype_dict[colID][0] field = VMPdata_colID_dtype_map[colID][0]
if field in field_list: if field in field_list:
field += str(len(field_list)) field += str(len(field_list))
field_list.append(field) field_list.append(field)
type_list.append(data_dtype_dict[colID][1]) type_list.append(VMPdata_colID_dtype_map[colID][1])
except KeyError: except KeyError:
print(list(zip(field_list, type_list))) print(list(zip(field_list, type_list)))
raise NotImplementedError("column type %d not implemented" raise NotImplementedError("column type %d not implemented"