Skip to content

Commit

Permalink
Allow files with no current or charge information through
Browse files Browse the repository at this point in the history
  • Loading branch information
ml-evs committed Feb 4, 2024
1 parent d58b610 commit af3d865
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions navani/echem.py
Original file line number Diff line number Diff line change
Expand Up @@ -181,9 +181,11 @@ def bio_state(x):
df['dV'] = np.diff(df['Ewe/V'], prepend=df['Ewe/V'][0])
df['state'] = df['dV'].map(lambda x: bio_state(x))

not_rest_idx = df[df['state'] != 'R'].index
df['cycle change'] = False
df.loc[not_rest_idx, 'cycle change'] = df.loc[not_rest_idx, 'state'].ne(df.loc[not_rest_idx, 'state'].shift())
if "state" in df.columns:
not_rest_idx = df[df['state'] != 'R'].index
df.loc[not_rest_idx, 'cycle change'] = df.loc[not_rest_idx, 'state'].ne(df.loc[not_rest_idx, 'state'].shift())

df['half cycle'] = (df['cycle change'] == True).cumsum()

# Renames Ewe/V to Voltage and the capacity column to Capacity
Expand Down Expand Up @@ -213,8 +215,9 @@ def bio_state(x):
df.rename(columns = {'Ewe/V':'Voltage'}, inplace = True)
return df
else:
print('Unknown column layout')
return None
print('Warning: unhandled column layout. No capacity or charge columns found.')
df.rename(columns = {'Ewe/V':'Voltage'}, inplace = True)
return df

def ivium_processing(df):
df['dq'] = np.diff(df['time /s'], prepend=0)*df['I /mA']
Expand Down

0 comments on commit af3d865

Please sign in to comment.