Skip to content

Commit

Permalink
Fixed parser to handle updated Nvx file format with more columns than…
Browse files Browse the repository at this point in the history
… labels. Only columns with header label gets used.
  • Loading branch information
mmemcormier committed Feb 3, 2022
1 parent 2367c96 commit b9d57de
Show file tree
Hide file tree
Showing 2 changed files with 91 additions and 36 deletions.
121 changes: 87 additions & 34 deletions amid-dev-mc.ipynb

Large diffs are not rendered by default.

6 changes: 4 additions & 2 deletions amid.py
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,8 @@ def __init__(self, dstpath, srcpath, uhpc_files, cell_label, bytesIO=None,
headlines.append(lines[i])
l = lines[i].strip().split()
if l[0][:6] == '[Data]':
hline = lines[i+1]
hline = lines[i+1].strip().split(",")
nlabels = len(hline)
nskip = i+1
break

Expand Down Expand Up @@ -138,7 +139,8 @@ def __init__(self, dstpath, srcpath, uhpc_files, cell_label, bytesIO=None,
print('Input cell capacity: {} Ah'.format(self.input_cap))

if bytesIO is None:
self.df = pd.read_csv(self.uhpc_file, header=nskip)
self.df = pd.read_csv(self.uhpc_file, header=nskip,
usecols=np.arange(0, nlabels))
#self.df = pd.read_csv(self.uhpc_file, header=hlinenum)
else:
self.df = pd.read_csv(bytesIO, header=hlinenum)
Expand Down

0 comments on commit b9d57de

Please sign in to comment.