From 3228d83d86f969e6486790b1f09e848cd4d3bf81 Mon Sep 17 00:00:00 2001 From: etienne Date: Tue, 9 Oct 2018 10:58:11 +0200 Subject: [PATCH] Reformat the complexe output in impedance --- extraction/extract_item_into_dict.py | 26 +++++++++++++++++++++----- 1 file changed, 21 insertions(+), 5 deletions(-) diff --git a/extraction/extract_item_into_dict.py b/extraction/extract_item_into_dict.py index 43d7f07..d3baf6f 100644 --- a/extraction/extract_item_into_dict.py +++ b/extraction/extract_item_into_dict.py @@ -1,4 +1,5 @@ """This file tries to split one matlab item into a dictionnary""" +import numpy as np def _convert_matlab_datetime_vector_to_utc(date_vector): @@ -70,12 +71,27 @@ def extract_impedance_from_item(item): dict_item["datetime"] = _convert_matlab_datetime_vector_to_utc(item[2][0]) dict_item["sense_current"] = item[3][0][0][0][0] # Current in sense branch (Amps)| Complexes - dict_item["battery_current"] = item[3][0][0][1][0] # urrent in battery branch (Amps)| Complexes + dict_item["sense_current_real"] = np.array([complx.real for complx in dict_item["sense_current"]]) + dict_item["sense_current_imag"] = np.array([complx.imag for complx in dict_item["sense_current"]]) + + dict_item["battery_current"] = item[3][0][0][1][0] # Current in battery branch (Amps)| Complexes + dict_item["battery_current_real"] = np.array([complx.real for complx in dict_item["battery_current"]]) + dict_item["battery_current_imag"] = np.array([complx.imag for complx in dict_item["battery_current"]]) + dict_item["current_ratio"] = item[3][0][0][2][0] # Ratio of the above currents| Complexes - # Battery impedance (Ohms) computed from raw data| Complexes but multiple array of 1 complexe - dict_item["battery_impedance"] = item[3][0][0][3] - # alibrated and smoothed battery impedance (Ohms)| Complexes but multiple array of 1 complexe - dict_item["rectified_impedance"] = item[3][0][0][4] + dict_item["current_ratio_real"] = np.array([complx.real for complx in dict_item["current_ratio"]]) + dict_item["current_ratio_imag"] = np.array([complx.imag for complx in dict_item["current_ratio"]]) + + # Battery impedance (Ohms) computed from raw data| Complexes + dict_item["battery_impedance"] = np.array([val[0] for val in item[3][0][0][3]]) + dict_item["battery_impedance_real"] = np.array([complx.real for complx in dict_item["battery_impedance"]]) + dict_item["battery_impedance_imag"] = np.array([complx.imag for complx in dict_item["battery_impedance"]]) + + # Calibrated and smoothed battery impedance (Ohms)| Complexes + dict_item["rectified_impedance"] = np.array([val[0] for val in item[3][0][0][4]]) + dict_item["rectified_impedance_real"] = np.array([complx.real for complx in dict_item["rectified_impedance"]]) + dict_item["rectified_impedance_imag"] = np.array([complx.imag for complx in dict_item["rectified_impedance"]]) + dict_item["re"] = item[3][0][0][5][0][0] # Estimated electrolyte resistance (Ohms)| float_ dict_item["rct"] = item[3][0][0][6][0][0] # Estimated charge transfer resistance (Ohms)| float_ -- GitLab