Remove outcommented lines in splice_cycles

This commit is contained in:
rasmusvt 2022-05-10 17:30:00 +02:00
parent 8d8cad966d
commit 8f94fa4dc6

View file

@ -178,19 +178,17 @@ def process_batsmall_data(df, options=None):
def splice_cycles(df, options: dict) -> pd.DataFrame: def splice_cycles(df, options: dict) -> pd.DataFrame:
''' Splices two cycles together - if e.g. one charge cycle are split into several cycles due to change in parameters. ''' Splices two cycles together - if e.g. one charge cycle are split into several cycles due to change in parameters.
Incomplete, only accomodates BatSmall so far.''' Incomplete, only accomodates BatSmall so far, and only for charge.'''
if options['kind'] == 'batsmall': if options['kind'] == 'batsmall':
# Creates masks for charge and discharge curves # Creates masks for charge and discharge curves
chg_mask = df['current'] >= 0 chg_mask = df['current'] >= 0
dchg_mask = df['current'] < 0
# Loop through all the cycling steps, change the current and capacities in the # Loop through all the cycling steps, change the current and capacities in the
for i in range(df["count"].max()): for i in range(df["count"].max()):
sub_df = df.loc[df['count'] == i+1] sub_df = df.loc[df['count'] == i+1]
sub_df_chg = sub_df.loc[chg_mask] sub_df_chg = sub_df.loc[chg_mask]
#sub_df_dchg = sub_df.loc[dchg_mask]
# get indices where the program changed # get indices where the program changed
chg_indices = sub_df_chg[sub_df_chg["comment"].str.contains("program")==True].index.to_list() chg_indices = sub_df_chg[sub_df_chg["comment"].str.contains("program")==True].index.to_list()
@ -203,33 +201,16 @@ def splice_cycles(df, options: dict) -> pd.DataFrame:
if chg_indices: if chg_indices:
last_chg = chg_indices.pop() last_chg = chg_indices.pop()
#dchg_indices = sub_df_dchg[sub_df_dchg["comment"].str.contains("program")==True].index.to_list()
#if dchg_indices:
# del dchg_indices[0]
if chg_indices: if chg_indices:
for i in chg_indices: for i in chg_indices:
add = df['specific_capacity'].iloc[i-1] add = df['specific_capacity'].iloc[i-1]
df['specific_capacity'].iloc[i:last_chg] = df['specific_capacity'].iloc[i:last_chg] + add df['specific_capacity'].iloc[i:last_chg] = df['specific_capacity'].iloc[i:last_chg] + add
#if dchg_indices:
# for i in dchg_indices:
# add = df['specific_capacity'].iloc[i-1]
# df['specific_capacity'].iloc[i:last_dchg] = df['specific_capacity'].iloc[i:last_dchg] + add
return df return df
def process_neware_data(df, options={}): def process_neware_data(df, options={}):
""" Takes data from NEWARE in a DataFrame as read by read_neware() and converts units, adds columns and splits into cycles. """ Takes data from NEWARE in a DataFrame as read by read_neware() and converts units, adds columns and splits into cycles.