Initial data inspection and plotting#
[1]:
import pathlib
from rich import print
import cellpy
from cellpy.utils import plotutils
Hint
If you have plotly installed, some of the functions will produce interactive plots. If not, the output will be simpler matplotlib figures. If you have not installed plotly, you can do so by running pip install plotly.
Either load raw data or your saved cellpy files:
[2]:
filedir = pathlib.Path("data") # foldername within the same directory
c = cellpy.get(filedir / "out" / "20210210_FC.h5")
Looking at the data#
Your CellpyCell object (here called c) contains all your raw data as well as some additional elements, in the format of pandas DataFrames:
Raw data:
c.data.raw, raw data from the run (with unitsc.data.raw_units)Summary:
c.data.summarywith cycle-based summariesSteps:
c.data.stepswith Stats from each step (and step type), created using thec.make_step_tablemethod
[3]:
c.data.raw.head(2)
[3]:
| test_id | data_point | test_time | step_time | date_time | step_index | cycle_index | is_fc_data | current | voltage | charge_capacity | discharge_capacity | charge_energy | discharge_energy | dv_dt | internal_resistance | ac_impedance | aci_phase_angle | |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| data_point | ||||||||||||||||||
| 1 | 1 | 1 | 5.008961 | 5.008961 | 2021-05-10 10:14:45 | 1 | 1 | 0 | 0.0 | 3.051165 | 0.0 | 0.0 | 0.0 | 0.0 | -0.000061 | 0.0 | 0.0 | 0.0 |
| 2 | 1 | 2 | 10.019319 | 10.019319 | 2021-05-10 10:14:50 | 1 | 1 | 0 | 0.0 | 3.051165 | 0.0 | 0.0 | 0.0 | 0.0 | 0.000000 | 0.0 | 0.0 | 0.0 |
[4]:
c.data.summary.head(2)
[4]:
| data_point | test_time | date_time | end_voltage_charge | end_voltage_discharge | charge_capacity | discharge_capacity | coulombic_efficiency | cumulated_coulombic_efficiency | cumulated_charge_capacity | ... | cumulated_charge_capacity_areal | cumulated_discharge_capacity_areal | coulombic_difference_areal | cumulated_coulombic_difference_areal | discharge_capacity_loss_areal | charge_capacity_loss_areal | cumulated_discharge_capacity_loss_areal | cumulated_charge_capacity_loss_areal | shifted_charge_capacity_areal | shifted_discharge_capacity_areal | |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| cycle_index | |||||||||||||||||||||
| 1 | 5797 | 174328.601353 | 2021-05-12 10:40:11 | 4.200052 | 3.129170 | 0.003819 | 0.003324 | 87.049469 | 87.049469 | 0.003819 | ... | 3.818560 | 3.324036 | 0.494524 | 0.494524 | NaN | NaN | NaN | NaN | 0.494524 | 4.313083 |
| 2 | 7188 | 317161.773416 | 2021-05-14 02:20:47 | 4.200052 | 3.188442 | 0.003422 | 0.003234 | 94.510786 | 181.560255 | 0.007241 | ... | 7.240795 | 6.558417 | 0.187854 | 0.682378 | 0.089654 | 0.396324 | 0.089654 | 0.396324 | 0.682378 | 4.104613 |
2 rows × 49 columns
[5]:
c.data.steps.head(2)
[5]:
| index | cycle | step | sub_step | point_avr | point_std | point_min | point_max | point_first | point_last | ... | ir_std | ir_min | ir_max | ir_first | ir_last | ir_delta | rate_avr | type | sub_type | info | |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 0 | 0 | 1 | 1 | 1 | 2157.5 | 1245.48886 | 1 | 4314 | 1 | 4314 | ... | 0.0 | 0.000000 | 0.000000 | 0.000000 | 0.000000 | 0.0 | 0.00000 | rest | NaN | |
| 1 | 1 | 1 | 2 | 1 | 4315.0 | NaN | 4315 | 4315 | 4315 | 4315 | ... | NaN | 6.650723 | 6.650723 | 6.650723 | 6.650723 | 0.0 | 1.75791 | ir | NaN |
2 rows × 64 columns
Simple plotting#
The plotutils module contains several convenient plot functions:
Raw plots#
The raw_plot gives an overview of your datacollection, plotting voltage vs time:
[6]:
plotutils.raw_plot(c, title="Voltage vs time")
Cycle info plots#
The cycle_info_plot function plots the raw data together with step and cycle info:
[7]:
plotutils.cycle_info_plot(c, title="Cycle info plot:")