Venue 11 - lots of Lascar loggers#

Venue 11 was able to deploy a bunch of Lascars at once - commercial USB-stick loggers that also record temperature, and relative humidity if you pay enough. We can’t always support this, but it can be useful for understanding balance and circulation problems and thinking about which rooms are really struggling with heat loss.

You can get a line to disappear by clicking on it in the legend.

Hide code cell source
# Using plotly.express

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

# leave out sc_boiler, appears to be 7:30-23:00
rooms = ["sc_art_room","sc_garden","sc_library","sc_lounge","sc_office","sc_studio","sc_wellspring"]
list_of_df = []
list_of_traces = []
for x in rooms:
    df1 = pd.read_csv("./venue-11/october/" + x + ".csv",encoding='latin-1',usecols=[0,1,2], header=0, names= ['entry_id', 'time', 'temperature'])
    df2 = pd.read_csv("./venue-11/december/" + x + ".csv",encoding='latin-1',usecols=[0,1,2], header=0, names= ['entry_id', 'time', 'temperature'])
    df = pd.concat([df1, df2])
    df["timestamp"] = pd.to_datetime(df['time'])
    #range_min = df['timestamp'].min()
    #range_max = df['timestamp'].max()
    #list_of_df.append(df) # in place??
    #print(range_min, " to ", range_max) # this just uses the range of the last file, not ideal
    
    #print(df.sample(6))
    
    
    trace = go.Scatter(customdata=df, 
                        y=df['temperature'], 
                        x = df['timestamp'], 
                        mode='lines', 
                        hoverinfo='all', 
                        name=x,
                        )
    list_of_traces.append(trace)
    


g = go.FigureWidget(data=list_of_traces,
                    layout = go.Layout(
                        yaxis=dict(range=[10,25])
                    ))

# 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()