cellpy.utils.ica
#
ica contains routines for creating and working with incremental capacity analysis data
Module Contents#
Classes#
Class for dq-dv handling. |
Functions#
|
Calculates dq-dv data for all cycles contained in |
|
Convenience function for creating dq-dv data from a given capacity and |
|
Convenience function for creating dq-dv data from several given capacity and |
|
Convenience functions for creating dq-dv data from given arrays |
|
Returns tuple with first and last item. |
|
Returns tuple with min and max in x. |
- class Converter(capacity=None, voltage=None, points_pr_split=10, max_points=None, voltage_resolution=None, capacity_resolution=None, minimum_splits=3, interpolation_method='linear', increment_method='diff', pre_smoothing=False, smoothing=False, post_smoothing=True, normalize=True, normalizing_factor=None, normalizing_roof=None, savgol_filter_window_divisor_default=50, savgol_filter_window_order=3, voltage_fwhm=0.01, gaussian_order=0, gaussian_mode='reflect', gaussian_cval=0.0, gaussian_truncate=4.0)[source]#
Class for dq-dv handling.
Typical usage is to (1) set the data, (2) inspect the data, (3) pre-process the data, (4) perform the dq-dv transform, and finally (5) post-process the data.
A short note about normalization:
If
normalization
is set toFalse
, then no normalization will be done.If
normalization
isTrue
, andnormalization_factor
isNone
, the total capacity of the half cycle will be used for normalization, else thenormalization_factor
will be used.If
normalization
isTrue
, andnormalization_roof
is notNone
, the capacity divided bynormalization_roof
will be used for normalization.
- inspect_data(capacity=None, voltage=None, err_est=False, diff_est=False)[source]#
Check and inspect the data.
- dqdv(cell, split=False, tidy=True, label_direction=False, **kwargs)[source]#
Calculates dq-dv data for all cycles contained in the given CellpyCell object, returns data as pandas.DataFrame(s)
- Parameters:
cell (CellpyCell-object)
split (bool) – return one frame for charge and one for discharge if True (defaults to False).
tidy (bool) – returns the split frames in wide format (defaults to True. Remark that this option is currently not available for non-split frames).
- Returns:
cycle: cycle number (if split is set to True). voltage: voltage dq: the incremental capacity
- Return type:
one or two
pandas.DataFrame
with the following columns
Additional key-word arguments are sent to Converter:
- Keyword Arguments:
cycle (int or list of ints (cycle numbers)) – will process all (or up to max_cycle_number) if not given or equal to None.
points_pr_split (int) – only used when investigating data using splits, defaults to 10.
max_points – None
voltage_resolution (float) – used for interpolating voltage data (e.g. 0.005)
capacity_resolution – used for interpolating capacity data
minimum_splits (int) – defaults to 3.
interpolation_method – scipy interpolation method
increment_method (str) – defaults to “diff”
pre_smoothing (bool) – set to True for pre-smoothing (window)
smoothing (bool) – set to True for smoothing during differentiation (window)
post_smoothing (bool) – set to True for post-smoothing (gaussian)
normalize (bool) – set to True for normalizing to capacity
normalizing_factor (float)
normalizing_roof (float)
savgol_filter_window_divisor_default (int) – used for window smoothing, defaults to 50
savgol_filter_window_order – used for window smoothing
voltage_fwhm (float) – used for setting the post-processing gaussian sigma, defaults to 0.01
gaussian_order (int) – defaults to 0
gaussian_mode (str) – defaults to “reflect”
gaussian_cval (float) – defaults to 0.0
gaussian_truncate (float) – defaults to 4.0
Example
>>> from cellpy.utils import ica >>> charge_df, dcharge_df = ica.dqdv(my_cell, split=True) >>> charge_df.plot(x="voltage",y="dq")
- dqdv_cycle(cycle_df, splitter=True, label_direction=False, **kwargs)[source]#
Convenience function for creating dq-dv data from a given capacity and voltage cycle.
Returns a tuple of numpy arrays with ‘voltage’ and ‘incremental_capacity’.
- Parameters:
cycle_df (pandas.DataFrame) – the cycle data (‘voltage’, ‘capacity’, ‘direction’ (1 or -1)).
splitter (bool) – insert a np.NaN row between charge and discharge.
label_direction (bool) – include ‘direction’ (1 or -1).
- Returns:
Returns a tuple of numpy arrays with ‘voltage’ and ‘incremental_capacity’.
Additional key-word arguments are sent to Converter:
- Keyword Arguments:
points_pr_split (int) – only used when investigating data using splits, defaults to 10.
max_points – None
voltage_resolution (float) – used for interpolating voltage data (e.g. 0.005)
capacity_resolution – used for interpolating capacity data
minimum_splits (int) – defaults to 3.
interpolation_method – scipy interpolation method
increment_method (str) – defaults to “diff”
pre_smoothing (bool) – set to True for pre-smoothing (window)
smoothing (bool) – set to True for smoothing during differentiation (window)
post_smoothing (bool) – set to True for post-smoothing (gaussian)
normalize (bool) – set to True for normalizing to capacity
normalizing_factor (float)
normalizing_roof (float)
savgol_filter_window_divisor_default (int) – used for window smoothing, defaults to 50
savgol_filter_window_order – used for window smoothing
voltage_fwhm (float) – used for setting the post-processing gaussian sigma, defaults to 0.01
gaussian_order (int) – defaults to 0
gaussian_mode (str) – defaults to “reflect”
gaussian_cval (float) – defaults to 0.0
gaussian_truncate (float) – defaults to 4.0
Example
>>> cycle_df = my_data.get_cap( >>> ... 1, >>> ... categorical_column=True, >>> ... method = "forth-and-forth" >>> ... insert_nan=False, >>> ... ) >>> voltage, incremental = ica.dqdv_cycle(cycle_df)
- dqdv_cycles(cycles_df, not_merged=False, label_direction=False, **kwargs)[source]#
Convenience function for creating dq-dv data from several given capacity and voltage cycles.
Returns a DataFrame with a ‘voltage’ and a ‘incremental_capacity’ column.
- Parameters:
cycles_df (pandas.DataFrame) – the cycle data (‘cycle’, ‘voltage’, ‘capacity’, ‘direction’ (1 or -1)).
not_merged (bool) – return list of frames instead of concatenating ( defaults to False).
label_direction (bool) – include ‘direction’ (1 or -1).
- Returns:
pandas.DataFrame
with columns ‘cycle’, ‘voltage’, ‘dq’ (and ‘direction’ if label_direction is True).
Additional key-word arguments are sent to Converter:
- Keyword Arguments:
points_pr_split (int) – only used when investigating data using splits, defaults to 10.
max_points – None
voltage_resolution (float) – used for interpolating voltage data (e.g. 0.005)
capacity_resolution – used for interpolating capacity data
minimum_splits (int) – defaults to 3.
interpolation_method – scipy interpolation method
increment_method (str) – defaults to “diff”
pre_smoothing (bool) – set to True for pre-smoothing (window)
smoothing (bool) – set to True for smoothing during differentiation (window)
post_smoothing (bool) – set to True for post-smoothing (gaussian)
normalize (bool) – set to True for normalizing to capacity
normalizing_factor (float)
normalizing_roof (float)
savgol_filter_window_divisor_default (int) – used for window smoothing, defaults to 50
savgol_filter_window_order – used for window smoothing
voltage_fwhm (float) – used for setting the post-processing gaussian sigma, defaults to 0.01
gaussian_order (int) – defaults to 0
gaussian_mode (str) – defaults to “reflect”
gaussian_cval (float) – defaults to 0.0
gaussian_truncate (float) – defaults to 4.0
Example
>>> cycles_df = my_data.get_cap( >>> ... categorical_column=True, >>> ... method = "forth-and-forth", >>> ... label_cycle_number=True, >>> ... insert_nan=False, >>> ... ) >>> ica_df = ica.dqdv_cycles(cycles_df)
- dqdv_np(voltage, capacity, voltage_resolution=None, capacity_resolution=None, voltage_fwhm=0.01, pre_smoothing=True, diff_smoothing=False, post_smoothing=True, post_normalization=True, interpolation_method=None, gaussian_order=None, gaussian_mode=None, gaussian_cval=None, gaussian_truncate=None, points_pr_split=None, savgol_filter_window_divisor_default=None, savgol_filter_window_order=None, max_points=None, **kwargs)[source]#
Convenience functions for creating dq-dv data from given arrays of capacity and voltage data.
- Parameters:
voltage – nd.array or pd.Series
capacity – nd.array or pd.Series
voltage_resolution – used for interpolating voltage data (e.g. 0.005)
capacity_resolution – used for interpolating capacity data
voltage_fwhm – used for setting the post-processing gaussian sigma
pre_smoothing – set to True for pre-smoothing (window)
diff_smoothing – set to True for smoothing during differentiation (window)
post_smoothing – set to True for post-smoothing (gaussian)
post_normalization – set to True for normalizing to capacity
interpolation_method – scipy interpolation method
gaussian_order – int
gaussian_mode – mode
gaussian_cval
gaussian_truncate
points_pr_split – only used when investigating data using splits
savgol_filter_window_divisor_default – used for window smoothing
savgol_filter_window_order – used for window smoothing
max_points – restricting to max points in vector (capacity-selected)
- Returns:
(voltage, dqdv)