Correctly load wave statistics into table

master
Dan Howe 5 years ago
parent 36cd0a68cc
commit 8b0022c054

@ -103,7 +103,6 @@ def parse_contents(contents, filename):
# Add spectral values to dataframe
stats.loc[col, keys] = values
json_data = {}
json_data['timeseries'] = df.to_json(orient='table')
json_data['spectrum'] = dfs.to_json(orient='table')
@ -140,8 +139,7 @@ def read_json_data(json_data):
'layout': layout
})
dfs = pd.read_json(json.loads(json_data)['spectrum'],
orient='table')
dfs = pd.read_json(json.loads(json_data)['spectrum'], orient='table')
spec = []
for col in dfs.columns:
# Plot energy spectrum
@ -158,11 +156,13 @@ def read_json_data(json_data):
}
})
stats = pd.read_json(json.loads(json_data)['statistics'], orient='table')
# Add location column
dfs['location'] = dfs.index
stats['location'] = stats.index
# Round spectral values
dfs = dfs.round(1)
stats = stats.round(1)
variables = {
'location': '',
@ -178,13 +178,13 @@ def read_json_data(json_data):
'name': [val, key],
'id': key
} for key, val in variables.items()],
data=dfs.to_dict('records'),
data=stats.to_dict('records'),
editable=False,
sort_action='native',
sort_mode='multi',
row_selectable='multi',
row_deletable=False,
selected_rows=np.arange(dfs.shape[0]),
selected_rows=np.arange(stats.shape[0]),
style_as_list_view=True,
style_cell={
'minWidth': '100px',

Loading…
Cancel
Save