diff --git a/beamtime/electrochemistry/io.py b/beamtime/electrochemistry/io.py new file mode 100644 index 0000000..f688e90 --- /dev/null +++ b/beamtime/electrochemistry/io.py @@ -0,0 +1,34 @@ +import pandas as pd + + +def read_battsmall(path): + ''' Reads BATTSMALL-data into a DataFrame. + + Input: + path (required): string with path to datafile + + Output: + df: pandas DataFrame containing the data as-is, but without additional NaN-columns.''' + + df = pd.read_csv(data1, skiprows=2, sep='\t') + df = df.loc[:, ~df.columns.str.contains('^Unnamed')] + + return df + + +def clean_battsmall_data(df, t='ms', C='mAh/g', I='mA', U='V'): + ''' Takes BATTSMALL-data in the form of a DataFrame and cleans the data up and converts units into desired units. + Also adds a column indicating whether or not it is charge or discharge. + + Input: + df (required): A pandas DataFrame containing BATTSMALL-data, as obtained from read_battsmall(). + t (optional): Unit for time data. Defaults to ms. + C (optional): Unit for specific capacity. Defaults to mAh/g. + I (optional): Unit for current. Defaults mA. + U (optional): Unit for voltage. Defaults to V. + + Output: + df: A cleaned up DataFrame with desired units and additional column about charge/discharge. + ''' + + \ No newline at end of file