Python project for analyzing alarm data from building monitoring systems. Includes alarm analyzer, plotting, tests, and source data files.
66 lines
2.4 KiB
Python
66 lines
2.4 KiB
Python
#!/usr/bin/env python
|
|
# Script to show the enhanced analysis results
|
|
|
|
import pandas as pd
|
|
import os
|
|
|
|
def show_results():
|
|
print("=== ENHANCED ALARM ANALYSIS RESULTS ===")
|
|
print()
|
|
|
|
# Check that output directory exists and show files
|
|
if os.path.exists('output'):
|
|
print("Output files created:")
|
|
for file in sorted(os.listdir('output')):
|
|
print(f" - {file}")
|
|
print()
|
|
else:
|
|
print("Output directory not found!")
|
|
return
|
|
|
|
# Show sample from paired_alarm_events.csv
|
|
try:
|
|
print("Sample from paired_alarm_events.csv (first 5 rows with sensor names and groups):")
|
|
paired_df = pd.read_csv('output/paired_alarm_events.csv')
|
|
print(paired_df[['Sensor_Id', 'Sensor_Name', 'Sensor_Group', 'Alarm_Type', 'Duration_Minutes']].head())
|
|
print()
|
|
except Exception as e:
|
|
print(f"Could not read paired_alarm_events.csv: {e}")
|
|
|
|
# Show top groups by alarm count
|
|
try:
|
|
print("Top groups by alarm count:")
|
|
groups_count_df = pd.read_csv('output/top_groups_by_alarm_count.csv')
|
|
print(groups_count_df.head(10))
|
|
print()
|
|
except Exception as e:
|
|
print(f"Could not read top_groups_by_alarm_count.csv: {e}")
|
|
|
|
# Show sample of group statistics
|
|
try:
|
|
print("Sample of group statistics (top 10 by alarm count):")
|
|
group_stats_df = pd.read_csv('output/group_statistics.csv')
|
|
print(group_stats_df[['Sensor_Group', 'Total_Alarm_Count', 'Avg_Duration', 'Total_Severity_Score']].head(10))
|
|
print()
|
|
except Exception as e:
|
|
print(f"Could not read group_statistics.csv: {e}")
|
|
|
|
# Show top sensors by alarm count to compare
|
|
try:
|
|
print("Top sensors by alarm count (with names):")
|
|
sensors_count_df = pd.read_csv('output/top_sensors_by_alarm_count.csv')
|
|
print(sensors_count_df.head(10))
|
|
print()
|
|
except Exception as e:
|
|
print(f"Could not read top_sensors_by_alarm_count.csv: {e}")
|
|
|
|
print("Analysis completed successfully with enhanced group and sensor name information!")
|
|
print()
|
|
print("Key enhancements:")
|
|
print("- Sensor IDs now replaced with meaningful sensor names")
|
|
print("- Groups properly mapped using hierarchical structure processing")
|
|
print("- Group-based analysis now available throughout the system")
|
|
print("- All output files contain enhanced sensor name and group information")
|
|
|
|
if __name__ == "__main__":
|
|
show_results() |