Grant commited on
Commit
6754b64
·
1 Parent(s): a0203d5

plot smooth data

Browse files
.ipynb_checkpoints/app-checkpoint.py CHANGED
@@ -3,6 +3,7 @@ import pandas as pd
3
  import numpy as np
4
  import time
5
  import plotly.graph_objects as go
 
6
 
7
  np.random.seed(2024)
8
 
@@ -27,16 +28,17 @@ def plot_interactive_scatter(uid: str):
27
 
28
  def plot_interactive_line(uid_data: pd.DataFrame, uid: str):
29
 
30
- hover_text = list(uid_data.apply(lambda row: f"{row['site']}: {np.round(row['aPLLR'], 3)}", axis=1))
 
31
 
32
  line_trace = go.Scatter(
33
  x=np.arange(len(uid_data)),
34
- y=uid_data.aPLLR,
35
  mode='lines+markers',
36
  name='aPLLR Values',
37
  text=hover_text,
38
  hoverinfo='text',
39
- marker=dict(color='black')
40
  )
41
  line_fig = go.Figure(data=[line_trace])
42
  line_fig.update_layout(
 
3
  import numpy as np
4
  import time
5
  import plotly.graph_objects as go
6
+ from scipy.ndimage import gaussian_filter1d
7
 
8
  np.random.seed(2024)
9
 
 
28
 
29
  def plot_interactive_line(uid_data: pd.DataFrame, uid: str):
30
 
31
+ plot_data = gaussian_filter1d(-np.log10(uid_data.aPLLR))
32
+ hover_text = [f"{x}: {y}" for x, y in zip(uid_data.site, plot_data)]
33
 
34
  line_trace = go.Scatter(
35
  x=np.arange(len(uid_data)),
36
+ y=plot_data,
37
  mode='lines+markers',
38
  name='aPLLR Values',
39
  text=hover_text,
40
  hoverinfo='text',
41
+ marker=dict(color='orange')
42
  )
43
  line_fig = go.Figure(data=[line_trace])
44
  line_fig.update_layout(
.ipynb_checkpoints/requirements-checkpoint.txt ADDED
@@ -0,0 +1,6 @@
 
 
 
 
 
 
 
1
+ fastapi
2
+ uvicorn[standard]
3
+ pandas
4
+ plotly
5
+ numpy
6
+ scipy
app.py CHANGED
@@ -3,6 +3,7 @@ import pandas as pd
3
  import numpy as np
4
  import time
5
  import plotly.graph_objects as go
 
6
 
7
  np.random.seed(2024)
8
 
@@ -27,16 +28,17 @@ def plot_interactive_scatter(uid: str):
27
 
28
  def plot_interactive_line(uid_data: pd.DataFrame, uid: str):
29
 
30
- hover_text = list(uid_data.apply(lambda row: f"{row['site']}: {np.round(row['aPLLR'], 3)}", axis=1))
 
31
 
32
  line_trace = go.Scatter(
33
  x=np.arange(len(uid_data)),
34
- y=uid_data.aPLLR,
35
  mode='lines+markers',
36
  name='aPLLR Values',
37
  text=hover_text,
38
  hoverinfo='text',
39
- marker=dict(color='black')
40
  )
41
  line_fig = go.Figure(data=[line_trace])
42
  line_fig.update_layout(
 
3
  import numpy as np
4
  import time
5
  import plotly.graph_objects as go
6
+ from scipy.ndimage import gaussian_filter1d
7
 
8
  np.random.seed(2024)
9
 
 
28
 
29
  def plot_interactive_line(uid_data: pd.DataFrame, uid: str):
30
 
31
+ plot_data = gaussian_filter1d(-np.log10(uid_data.aPLLR))
32
+ hover_text = [f"{x}: {y}" for x, y in zip(uid_data.site, plot_data)]
33
 
34
  line_trace = go.Scatter(
35
  x=np.arange(len(uid_data)),
36
+ y=plot_data,
37
  mode='lines+markers',
38
  name='aPLLR Values',
39
  text=hover_text,
40
  hoverinfo='text',
41
+ marker=dict(color='orange')
42
  )
43
  line_fig = go.Figure(data=[line_trace])
44
  line_fig.update_layout(
requirements.txt CHANGED
@@ -2,4 +2,5 @@ fastapi
2
  uvicorn[standard]
3
  pandas
4
  plotly
5
- numpy
 
 
2
  uvicorn[standard]
3
  pandas
4
  plotly
5
+ numpy
6
+ scipy