Skip to content

Commit

Permalink
Merge branch '101-new-hplc-reader' into dev
Browse files Browse the repository at this point in the history
  • Loading branch information
StarmanMartin committed May 31, 2024
2 parents 99d5100 + a6b2595 commit b238cbf
Showing 1 changed file with 14 additions and 10 deletions.
24 changes: 14 additions & 10 deletions converter_app/readers/hplc.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,19 +56,23 @@ def check(self):

def prepare_tables(self):
tables = []
table = self.append_table(tables)

keys = list(self.df.keys())
values = [self.df[x] for x in keys]
for i in range(len(values[0])):
table['rows'].append([])
for x in values:
table['rows'][-1].append(float(x[i]))
waves = [x for x in keys if x.startswith('Wave')]

table['columns'] = [{
'key': str(idx),
'name': f'{value}'
} for idx, value in enumerate(keys)]
time = self.df['time']
for wave_key in waves:
wave = self.df[wave_key]
table = self.append_table(tables)
kv = wave_key.split('_')
table['metadata'][kv[0]] = str(kv[1])
for i, t in enumerate(time):
table['rows'].append([t, float(wave[i])])

table['columns'] = [{
'key': str(idx),
'name': f'{value}'
} for idx, value in enumerate(['Time', 'Wavelength'])]
return tables


Expand Down

0 comments on commit b238cbf

Please sign in to comment.