# EXAMPLE METRICS CALCULATIONS

import numpy as np
import pandas as pd

#RESULTS DATA FORMAT

# contains one row for each simulated event, identifies if the line broke
breaks_df = pd.read_csv('sample_breaks_results.csv', index_col = 0)    

# contains one row for each simulated event, and results for each municipality
sll_df = pd.read_csv('sample_sll_results.csv', index_col = 0)  
vwl_df = pd.read_csv('sample_vwl_results.csv', index_col = 0)  
vewl_df = pd.read_csv('sample_vewl_results.csv', index_col = 0)  


# calculate metrics
line_sll_raw = np.dot(breaks_df.transpose(),sll_df.sum(axis= 1))/breaks_df.sum()
line_vwl_raw = np.dot(breaks_df.transpose(),vwl_df.sum(axis= 1))/breaks_df.sum()
line_vewl_raw = np.dot(breaks_df.transpose(),vewl_df.sum(axis= 1))/breaks_df.sum()

line_sll = line_sll_raw.rank()
line_vwl = line_vwl_raw.rank()
line_vewl = line_vewl_raw.rank()


