Spaces:
Sleeping
Sleeping
File size: 2,261 Bytes
4e67a93 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 | #!/usr/bin/env python3
"""
Test script for correlation analysis with plotting
"""
import subprocess
import os
import sys
def main():
# Get script directory
script_dir = os.path.dirname(os.path.abspath(__file__))
# Define paths
kpi_file = os.path.join(script_dir, '../../data/lenovo_kpi_filled.csv')
scores_file = os.path.join(script_dir, '../../data/lenovo-scores-0603.csv')
# Check if files exist
if not os.path.exists(kpi_file):
print(f"Error: KPI file not found: {kpi_file}")
print("Trying alternative path...")
kpi_file = os.path.join(script_dir, 'test_kpi.csv')
if not os.path.exists(kpi_file):
print(f"Error: Alternative KPI file not found: {kpi_file}")
sys.exit(1)
if not os.path.exists(scores_file):
print(f"Error: Scores file not found: {scores_file}")
print("Please ensure the scores file exists")
sys.exit(1)
# Run the analysis with plotting enabled
cmd = [
'python3',
os.path.join(script_dir, 'analyze_correlations_v2.py'),
'-k', kpi_file,
'-s', scores_file,
'-o', 'score_corr_with_plots.yaml',
'-p' # Enable plotting
]
print("Running correlation analysis with plotting...")
print(f"Command: {' '.join(cmd)}")
try:
result = subprocess.run(cmd, capture_output=True, text=True)
print("\nOutput:")
print(result.stdout)
if result.stderr:
print("\nErrors:")
print(result.stderr)
if result.returncode == 0:
print("\nSuccess! Check the following files:")
print("- score_corr_with_plots.yaml (correlation results)")
print("- correlation_plots.png (all plots in one image)")
print("- correlation_AC.png (individual plot)")
print("- correlation_AD.png (individual plot)")
print("- correlation_BC.png (individual plot)")
print("- correlation_BD.png (individual plot)")
else:
print(f"\nError: Process exited with code {result.returncode}")
except Exception as e:
print(f"\nError running analysis: {e}")
if __name__ == "__main__":
main() |