Separating traces when two monitors are in the same venue#

Our monitors are very dumb - if there are two sensor units on within radio range, it can’t tell their readings apart. We will fix this for the next project!

If you want to use several monitors in the same building and can retrieve the data by smartphone or laptop every week or so, it’s best to make them standalone. There’s a hidden configuration option for this - please ask while we get that documented.

This page is just a convenient way of exploring data so we know how to separate it.

Venue 10 has already borrowed venue 2’s monitor, and you can kind of eyeball the two curves if you zoom in enough.

# Using plotly.express

# import ipywidgets as widgets
import pandas as pd
import numpy as np
import plotly.express as px
import plotly.graph_objects as go   
#from IPython.display import display


df = pd.read_csv("./venue-10/venue_10_with_device_58BF25DB81A1.csv")
df["timestamp"] = pd.to_datetime(df['timestamp'])
df = df.drop('voltage', axis=1) # often NaN, just get rid of it
df = df.dropna(axis=0, how="any") 
df = df[(df.temperature >-10)] # eliminate rogue data
    
trace = go.Scatter(customdata=df, 
                    y=df['temperature'], 
                    x = df['timestamp'], 
                    mode='markers', 
                    hoverinfo='all', 
                    #name=x
                    )
    


g = go.FigureWidget(data=trace,
                    layout = go.Layout(
                        yaxis=dict(range=[-3,18])
                    ))

# example syntax for two plots on same x-axis - I'd like to show the boiler temperature in
# parallel - but havne't had time to sort the syntax.
#fig = make_subplots(rows=2, cols=1, shared_xaxes=True)

# for i, col in enumerate(cols, start=1):
#     fig.add_trace(go.Scatter(x=df[col].index, y=df[col].values), row=i, col=1)

fig = go.Figure(g)
fig.update_layout(showlegend=True, 
              autosize = True, 
              width=1000, 
              height=500,
)




fig.update_layout(
    hovermode='x unified',
   # range=[range_min, range_max],
    hoverlabel=dict(
        bgcolor="white",
        # font_size=16,
        font_family="Rockwell"
    )
)

#Add range slider
fig.update_layout(
    xaxis=dict(
        rangeselector=dict(
            buttons=list([
                dict(
                     label="All",
                     step="all"
                     ),
                                dict(count=1,
                     label="Hour",
                     step="hour",
                     stepmode="todate"),
                dict(count=1,
                     label="Day",
                     step="day",
                     stepmode="backward"),
                dict(count=7,
                     label="Week",
                     step="day",
                     stepmode="backward"),
                dict(count=1,
                     label="Year",
                     step="year",
                     stepmode="backward")
            ])
        ),
        rangeslider=dict(
            visible=True,
        ),
        type="date"
    )
)


#fig.add_hline(y=16, annotation_text='16C - usual minimum for children', annotation_font_color="blue", line_color='red', layer='above', line_dash='dash')
# fig.update_yaxes(range = [-5, dfCollatedDataSet['temperature'].max()+5])
fig.show()