|
|
@ -103,12 +103,12 @@ def parse_contents(contents, filename):
|
|
|
|
# Add spectral values to dataframe
|
|
|
|
# Add spectral values to dataframe
|
|
|
|
stats.loc[col, keys] = values
|
|
|
|
stats.loc[col, keys] = values
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
info = {'filename': filename, 'instrument type': inst_type}
|
|
|
|
json_data = {}
|
|
|
|
json_data = {}
|
|
|
|
|
|
|
|
json_data['info'] = info
|
|
|
|
json_data['timeseries'] = df.to_json(orient='table')
|
|
|
|
json_data['timeseries'] = df.to_json(orient='table')
|
|
|
|
json_data['spectrum'] = dfs.to_json(orient='table')
|
|
|
|
json_data['spectrum'] = dfs.to_json(orient='table')
|
|
|
|
json_data['statistics'] = stats.to_json(orient='table')
|
|
|
|
json_data['statistics'] = stats.to_json(orient='table')
|
|
|
|
json_data['filename'] = filename
|
|
|
|
|
|
|
|
json_data['instrument type'] = inst_type
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return json.dumps(json_data)
|
|
|
|
return json.dumps(json_data)
|
|
|
|
|
|
|
|
|
|
|
@ -128,14 +128,14 @@ def read_json_data(json_data):
|
|
|
|
if json_data is None:
|
|
|
|
if json_data is None:
|
|
|
|
return html.Div([])
|
|
|
|
return html.Div([])
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
info = json.loads(json_data)['info']
|
|
|
|
df = pd.read_json(json.loads(json_data)['timeseries'], orient='table')
|
|
|
|
df = pd.read_json(json.loads(json_data)['timeseries'], orient='table')
|
|
|
|
ts = []
|
|
|
|
ts = []
|
|
|
|
for col in df.columns:
|
|
|
|
for col in df.columns:
|
|
|
|
trace = go.Scatter(x=df.index, y=df[col], name=col, opacity=0.8)
|
|
|
|
trace = go.Scatter(x=df.index, y=df[col], name=col, opacity=0.8)
|
|
|
|
ts.append(trace)
|
|
|
|
ts.append(trace)
|
|
|
|
|
|
|
|
|
|
|
|
filename = json.loads(json_data)['filename']
|
|
|
|
layout = {'title': info['filename'], 'xaxis': {'rangeslider': {}}}
|
|
|
|
layout = {'title': filename, 'xaxis': {'rangeslider': {}}}
|
|
|
|
|
|
|
|
graph_timeseries = dcc.Graph(id='time-series',
|
|
|
|
graph_timeseries = dcc.Graph(id='time-series',
|
|
|
|
figure={
|
|
|
|
figure={
|
|
|
|
'data': ts,
|
|
|
|
'data': ts,
|
|
|
@ -205,7 +205,7 @@ def read_json_data(json_data):
|
|
|
|
},
|
|
|
|
},
|
|
|
|
)
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
if json.loads(json_data)['instrument type'] == 'WP':
|
|
|
|
if info['instrument type'] == 'WP':
|
|
|
|
elements = html.Div([
|
|
|
|
elements = html.Div([
|
|
|
|
graph_timeseries,
|
|
|
|
graph_timeseries,
|
|
|
|
html.Div([
|
|
|
|
html.Div([
|
|
|
@ -224,9 +224,6 @@ def read_json_data(json_data):
|
|
|
|
return elements
|
|
|
|
return elements
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#####
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def main():
|
|
|
|
def main():
|
|
|
|
port = 8050
|
|
|
|
port = 8050
|
|
|
|
wb.open('http://localhost:{}'.format(port))
|
|
|
|
wb.open('http://localhost:{}'.format(port))
|
|
|
|