Files
AlarmAnalysis/demonstrate_enhanced_features.py
andy f08a1a9bf5 Initial commit: alarm analysis project
Python project for analyzing alarm data from building monitoring systems.
Includes alarm analyzer, plotting, tests, and source data files.
2026-02-26 09:03:54 -05:00

65 lines
3.0 KiB
Python

#!/usr/bin/env python
# Final demonstration of enhanced group-based analysis
import pandas as pd
import os
def demonstrate_enhanced_features():
print("=== ENHANCED GROUP-BASED ANALYSIS DEMONSTRATION ===")
print()
# Load the enhanced group statistics
group_stats_path = os.path.join('output', 'group_statistics.csv')
if not os.path.exists(group_stats_path):
print(f"Group statistics file not found at {group_stats_path}")
return
group_stats_df = pd.read_csv(group_stats_path)
print("NEW ENHANCED METRICS ADDED TO GROUP STATISTICS:")
print()
print("1. Total_Sensors_In_Group - Total number of sensors in each group (from sensor report)")
print("2. Percentage_Monitoring_Points_Alarmed - Percentage of sensors in the group that experienced alarms")
print("3. Alarm_Time_Percentage - Percentage of total possible sensor-time that was spent in alarm condition")
print()
print("SAMPLE ENHANCED DATA (Top 5 groups by alarm count):")
print(group_stats_df[['Sensor_Group', 'Total_Alarm_Count', 'Unique_Sensors',
'Total_Sensors_In_Group', 'Percentage_Monitoring_Points_Alarmed',
'Alarm_Time_Percentage']].head())
print()
print("INTERPRETATION OF NEW METRICS:")
print()
print("- Total_Sensors_In_Group: Shows the actual size of each monitoring group")
print("- Percentage_Monitoring_Points_Alarmed: Reveals how widespread alarm events are within each group")
print("- Alarm_Time_Percentage: Indicates how much time the group's sensors spend in alarm condition")
print()
# Example interpretation
print("EXAMPLE ANALYSIS:")
sci_mansfield = group_stats_df[group_stats_df['Sensor_Group'] == 'SCI - Mansfield'].iloc[0]
print(f"- SCI - Mansfield group has {sci_mansfield['Total_Sensors_In_Group']} total sensors,")
print(f" {sci_mansfield['Unique_Sensors']} experienced alarms ({sci_mansfield['Percentage_Monitoring_Points_Alarmed']}% of group),")
print(f" and spent {sci_mansfield['Alarm_Time_Percentage']}% of total possible time in alarm condition.")
print()
snx_trailer = group_stats_df[group_stats_df['Sensor_Group'] == 'SNX Trailer'].iloc[0]
print(f"- SNX Trailer group has {snx_trailer['Total_Sensors_In_Group']} total sensors,")
print(f" all {snx_trailer['Unique_Sensors']} experienced alarms (100% of group),")
print(f" and spent {snx_trailer['Alarm_Time_Percentage']}% of total possible time in alarm condition.")
print()
print("These new metrics provide deeper insights into:")
print("- Group size and coverage")
print("- Alarm distribution within groups")
print("- Overall alarm activity intensity per group")
print()
print("The enhanced analysis provides better visibility into which groups have the most comprehensive")
print("alarm coverage and which groups are experiencing the most persistent alarm conditions.")
if __name__ == "__main__":
demonstrate_enhanced_features()