add option to include all detections, and make default
This commit is contained in:
+15
-9
@@ -33,12 +33,16 @@ def get_data(now=None):
|
|||||||
return df, now
|
return df, now
|
||||||
|
|
||||||
|
|
||||||
def create_plot(df_plt_today, now, is_top):
|
def create_plot(df_plt_today, now, is_top=None):
|
||||||
readings = 10
|
if is_top is not None:
|
||||||
if is_top:
|
readings = 10
|
||||||
plt_selection_today = (df_plt_today['Com_Name'].value_counts()[:readings])
|
if is_top:
|
||||||
|
plt_selection_today = (df_plt_today['Com_Name'].value_counts()[:readings])
|
||||||
|
else:
|
||||||
|
plt_selection_today = (df_plt_today['Com_Name'].value_counts()[-readings:])
|
||||||
else:
|
else:
|
||||||
plt_selection_today = (df_plt_today['Com_Name'].value_counts()[-readings:])
|
plt_selection_today = df_plt_today['Com_Name'].value_counts()
|
||||||
|
readings = len(df_plt_today['Com_Name'].value_counts())
|
||||||
|
|
||||||
df_plt_selection_today = df_plt_today[df_plt_today.Com_Name.isin(plt_selection_today.index)]
|
df_plt_selection_today = df_plt_today[df_plt_today.Com_Name.isin(plt_selection_today.index)]
|
||||||
|
|
||||||
@@ -56,11 +60,14 @@ def create_plot(df_plt_today, now, is_top):
|
|||||||
|
|
||||||
# norm values for color palette
|
# norm values for color palette
|
||||||
norm = plt.Normalize(confmax.values.min(), confmax.values.max())
|
norm = plt.Normalize(confmax.values.min(), confmax.values.max())
|
||||||
if is_top:
|
if is_top or is_top is None:
|
||||||
# Set Palette for graphics
|
# Set Palette for graphics
|
||||||
pal = "Greens"
|
pal = "Greens"
|
||||||
colors = plt.cm.Greens(norm(confmax)).tolist()
|
colors = plt.cm.Greens(norm(confmax)).tolist()
|
||||||
plot_type = "Top"
|
if is_top:
|
||||||
|
plot_type = "Top"
|
||||||
|
else:
|
||||||
|
plot_type = 'All'
|
||||||
name = "Combo"
|
name = "Combo"
|
||||||
else:
|
else:
|
||||||
# Set Palette for graphics
|
# Set Palette for graphics
|
||||||
@@ -141,8 +148,7 @@ def main(daemon, sleep_m):
|
|||||||
else:
|
else:
|
||||||
data, time = get_data(now)
|
data, time = get_data(now)
|
||||||
if not data.empty:
|
if not data.empty:
|
||||||
create_plot(data, time, is_top=True)
|
create_plot(data, time)
|
||||||
create_plot(data, time, is_top=False)
|
|
||||||
else:
|
else:
|
||||||
print('empty dataset')
|
print('empty dataset')
|
||||||
if daemon:
|
if daemon:
|
||||||
|
|||||||
Reference in New Issue
Block a user