Allow looping through cycles if max is 0

This commit is contained in:
rasmusthog 2022-10-17 19:35:48 +02:00
parent 2e9b5e5bc0
commit c02b575b54

View file

@ -41,11 +41,10 @@ def read_neware(path, options={}):
# Convert from .xlsx to .csv to make readtime faster
if path.endswith('xlsx'):
csv_details = ''.join(path[:-5]) + '_details.csv'
csv_summary = ''.join(path[:-5]) + '_summary.csv'
csv_summary = os.path.abspath(''.join(path[:-5]) + '_summary.csv')
if not os.path.isfile(csv_summary):
Xlsx2csv(path, outputencoding="utf-8").convert(csv_summary, sheetid=3)
Xlsx2csv(path, outputencoding="utf-8").convert(os.path.abspath(csv_summary), sheetid=3)
if not os.path.isfile(csv_details):
Xlsx2csv(path, outputencoding="utf-8").convert(csv_details, sheetid=4)
@ -432,15 +431,17 @@ def process_biologic_data(df, options=None):
df = df[headers].copy()
# Complete set of new units and get the units used in the dataset, and convert values in the DataFrame from old to new.
set_units(options)
options['old_units'] = get_old_units(df=df, options=options)
df = add_columns(df=df, options=options)
df = unit_conversion(df=df, options=options)
df = unit_conversion(df=df, options=options)
# Creates masks for charge and discharge curves
if options['mode'] == 'GC':
chg_mask = (df['status'] == 1) & (df['status_change'] != 1)
@ -453,8 +454,13 @@ def process_biologic_data(df, options=None):
# Initiate cycles list
cycles = []
if df['cycle'].max() == 0:
no_cycles = 1
else:
no_cycles = int(df['cycle'].max())
# Loop through all the cycling steps, change the current and capacities in the
for i in range(int(df["cycle"].max())):
for i in range(no_cycles):
sub_df = df.loc[df['cycle'] == i].copy()