def main(**kwargs): #Prints print("Running with:") for key, value in kwargs.items(): print(key, value) file_parser = CDevsFileParser(kwargs["infile"]) matrix_and_time_and_lineno_gen = file_parser.matrixAndTimeAndLineTuple() rows = [["Time","Line","Sum","Min","Max","Mean"]] for matrix_str,time,lineno in matrix_and_time_and_lineno_gen: cdevs_matrix = CDevsMatrix(matrix_str,kwargs["col_width"]) matrix_sum = cdevs_matrix.sum() matrix_min = cdevs_matrix.min() matrix_max = cdevs_matrix.max() matrix_mean = cdevs_matrix.mean() if(invalidMatrixMeanFromMinAndMax(matrix_mean,matrix_min,matrix_max)): raise Exception("Matrix mean: " + str(matrix_mean) + " is smaller than the min: " + str(matrix_min) + " or larger than the max: " + str(matrix_max)) rows.append([time,lineno,matrix_sum,matrix_min,matrix_max,matrix_mean]) writeRowsAsCSV(rows,kwargs["out"])