Python project for analyzing alarm data from building monitoring systems. Includes alarm analyzer, plotting, tests, and source data files.
37 lines
1.3 KiB
Python
37 lines
1.3 KiB
Python
#!/usr/bin/env python
|
|
# Script to create visualizations with enhanced group and sensor name information
|
|
|
|
from alarm_analyzer import AlarmAnalyzer
|
|
|
|
def main():
|
|
print("Creating analyzer instance for visualizations...")
|
|
# Create analyzer instance
|
|
analyzer = AlarmAnalyzer('CardinalAlarmsDec25.csv', 'SensorReport Cardinal 2025-12-23_processed.xlsx')
|
|
|
|
print("Loading data...")
|
|
# Load data
|
|
alarm_data, sensor_data = analyzer.load_data()
|
|
print(f"Loaded {len(alarm_data)} alarm records")
|
|
|
|
if analyzer.sensor_mapping:
|
|
print(f"Created sensor mapping for {len(analyzer.sensor_mapping)} sensors")
|
|
else:
|
|
print("No sensor mapping created - sensor report may not have been processed correctly")
|
|
|
|
print("Categorizing alarms...")
|
|
# Categorize alarms
|
|
categorized_data = analyzer.categorize_alarms()
|
|
|
|
print("Pairing events and calculating durations...")
|
|
# Pair events and calculate durations
|
|
paired_events = analyzer.pair_events_and_calculate_durations()
|
|
|
|
print("Creating enhanced visualizations...")
|
|
# Create visualizations with enhanced group and sensor name information
|
|
analyzer.create_visualizations(save_plots=True, output_dir='plots')
|
|
|
|
print("Visualizations created successfully!")
|
|
print("Plots have been saved to the plots directory.")
|
|
|
|
if __name__ == '__main__':
|
|
main() |