Loading data - data.py¶
This module defines the Dataset class that is used to load the .csv
files holding the data to be fitted. After the fit is performed it also
stores the initial parameters, the fitted parameters and the fit
estimations.
This module also defines the function load() used in the
Dataset.load_c() and Dataset.load_q() methods to load the .csv files.
-
class
data.Dataset(files_c, files_q=None, t_label='t [s]', c_label='C [M]', q_label='Q [C]')¶ Loads and stores kinetics data, also stores fit results and axes labels.
Parameters: - files_c (list) – The path(s) of the concentration vs time files.
- files_q (list, optional) – The path(s) of the charge passed vs time files, if this parameter is not set, further fitting will proceed without taking the charge passed in account.
- t_label|c_label|q_label (str, optional) – Set the corresponding attributes values. Used to set the x and y axes labels when plotting.
-
df_c|df_c_std|df_c_fit Store respectively the mean concentration, the concentration standard deviations and the corresponding fit results. Defined by the load_c method or directly at initialization using the files_c parameter.
Type: pandas.DataFrame
-
df_q|df_q_std|df_q_fit Store respectively the mean charge passed, the charge passed standard deviations and the corresponding fit results. Defined by the load_q method or directly at initialization using the files_q parameter.
Type: pandas.DataFrame
-
t_label|c_label|q_label Labels to be used for the x and y axes when plotting the datasets.
Type: str
-
fit_results¶ Stores the results of the fit, for details see the lmfit.minimizer.MinimizerResult documentation: https://lmfit.github.io/lmfit-py/fitting.html
Defined when the fit.fit_dataset() function is run on the Dataset object.
Type: lmfit.MinimizerResult
-
init_params¶ Stores the initial parameters for the fit, for details on this object class see: https://lmfit.github.io/lmfit-py/parameters.html
Defined when the fit.fit_dataset() function is run on the Dataset object.
Type: lmfit.parameter.Parameters
-
names¶ Species names which concentration evolution over time is tracked. Used in particular to label the data when plotting. Defined in the load_c method.
Type: list
-
load_c(files)¶ Loads / processes .csv files holding concentration over time data.
Recommendations for the .csv file formatting: the files headers are formatted in this fashion: “t, species name 1, species name 2…”; first column is time, other columns are concentrations.
An example file can be found here: https://is.gd/GZPZFK
Relies on the load() function from this module, see also this function documentation for more details.
Parameters: files (list) – Path(s) of the .csv files.
-
load_q(files)¶ Loads / processes .csv files holding charge passed over time data.
Recommendations for the .csv file formatting: the files headers should be formatted in this fashion: “t,Q”; first column is the time, second column is the charge passed.
An example file can be found here: https://is.gd/0Ma7Ii
Relies on the load() function from this module, see also this function Docstring for more details.
Parameters: files (list) – Paths of the .csv files.
-
data.load(files)¶ Loads and processes data from .csv files, stores it in Dataframes.
The .csv files should have the same headers, the same number of columns and the same number of rows. The header should be held in the first row.
These .csv files are typically generated from raw data files from experiments using custom code to satisfy these requirements.
Parameters: files (list) – Path(s) to the file(s), each column in each file must have the same number of rows. Returns: Averages DataFrame and standard deviation DataFrame. Return type: pandas.DataFrame, pandas.DataFrame