Skip to content

Commit

Permalink
Everything except simplified kripendorf working
Browse files Browse the repository at this point in the history
  • Loading branch information
grigsos committed Mar 27, 2023
1 parent 20e013e commit 934b391
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 18 deletions.
4 changes: 2 additions & 2 deletions src/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,12 @@ def main():

mainFolderPath,configFileMain,hashL, xlsxList = initialisation.main()
levelListM,inputsSubListM, inputsDimListM, inputsInterDimensionalListM, kripSimplifiedListM=data_import.main(mainFolderPath,configFileMain, xlsxList)
outputDataframeMain, subDimConsistencyListMain, DimConsistencyListMain, DimWeightListMain,DimConsistencyListMain=data_processing.main(inputsSubListM, inputsDimListM)
outputDataframeMain, DimConsistencyListMain, DimWeightListMain=data_processing.main(inputsSubListM, inputsDimListM)

from src.methods import report_generator # to make global variable work
report_generator.main(mainFolderPath,configFileMain,len(xlsxList),levelListM,inputsSubListM, inputsDimListM,
inputsInterDimensionalListM, kripSimplifiedListM,outputDataframeMain,
subDimConsistencyListMain, DimConsistencyListMain,DimWeightListMain)
DimConsistencyListMain,DimWeightListMain)

logging.info("Program ended")
logging.info("Program runtime: " + f"{(time.time() - start_time):.2f}" + " seconds")
Expand Down
7 changes: 4 additions & 3 deletions src/methods/data_processing.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ def main(subInputList,dimInputList):
#matrix = matrix_make(data)
#print(ahp(matrix,RI[matrix.shape[0]]))
subDimListWeights, subDimConsistencyList = process_list_to_usable(subInputList)
DimWeightList,DimConsistencyList,colList = process_dataframe_to_usable(dimInputList)
DimWeightList,colList = process_dataframe_to_usable(dimInputList)

outputList = multiply_weights(subDimListWeights,DimWeightList)
outputCalcWeights= convert_to_dataframe(outputList,colList)
Expand All @@ -25,9 +25,10 @@ def main(subInputList,dimInputList):
outputConsistency = convert_to_dataframe(subDimConsistencyList,colList)
#outputDimConsistency = convert_to_dataframe(DimConsistencyList,colList)



logging.info("M - Data processing finished successfully")
return outputCalcWeights,outputSubDimweights,outputConsistency, DimWeightList,DimConsistencyList
return outputCalcWeights,outputConsistency, DimWeightList


def process_list_to_usable(uncutList):
Expand Down Expand Up @@ -65,7 +66,7 @@ def process_dataframe_to_usable(uncutDataframe):



return workingListWeights, workingConsistencyIndexList, columnList
return workingListWeights, columnList

def multiply_weights(sudDimWeights, dimWeights):
finalList=[]
Expand Down
21 changes: 8 additions & 13 deletions src/methods/report_generator.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
##############Main function##############
def main(mFP,cFM,nList,levelListSM,weightListSM, dimensionListSM,
interDimensionalListSM, kripSimplifiedListSM, outputDataframeSM,
subDimConsistencyListSM, DimConsistencyListSM,DimWeightListSM):
subDimConsistencyListSM,DimWeightListSM):
logging.info("M - Report generation started")
outFolderPath = check_output_folder(cFM.get("Settings", "outputFolder"),mFP) #check if output folder exists
listDimension,combinedList=get_subsection(cFM) #get subsections and dimensions from config file
Expand All @@ -23,7 +23,7 @@ def main(mFP,cFM,nList,levelListSM,weightListSM, dimensionListSM,
csv_dim_inputs_pre(dimensionListSM,sOF) #generates csv file with dimensions inputs
csv_interdim_comparisions_input(interDimensionalListSM,sOF) #generates csv file with interdimensional comparisions
csv_calculated_weights(outputDataframeSM,sOF,combinedList,DimWeightListSM,listDimension) #generates csv file with calculated weights

csv_consistency_indexes(subDimConsistencyListSM,sOF,listDimension) #generates csv file with consistency indexes

logging.info("M - Report generation finished successfully")
return None
Expand Down Expand Up @@ -102,27 +102,22 @@ def csv_kripke_simplified(kSL,sOF): #doesn't work

def csv_calculated_weights(df,sOF,combL,DimWeightListSMFunc,listDimensionFunc):
data = {}

# Loop through each array in the list and create a column name and add to the dictionary
for i, array in enumerate(DimWeightListSMFunc):
column_name = 'col' + str(i + 1) # Create a column name for the array
data[column_name] = array # Add the array to the dictionary with its column name

# Create a pandas dataframe using the dictionary
column_name = 'col' + str(i + 1)
data[column_name] = array
dfDimension = pd.DataFrame(data)
dfDimension.index=listDimensionFunc


df.index=combL
dfDimension.columns=df.columns


finalout = pd.concat([dfDimension,df],axis=0)
outPath=os.path.join(sOF, "Calculated_weights.csv")
finalout.to_csv(outPath, index=True)
return None

def csv_consistency_indexes():
def csv_consistency_indexes(sDCL,sOF,listDimensionFunc):
sDCL.index=listDimensionFunc
outPath=os.path.join(sOF, "Consistency_indexes.csv")
sDCL.to_csv(outPath, index=True)
return None


Expand Down

0 comments on commit 934b391

Please sign in to comment.