# -*- coding: utf-8 -*- """ Created on Fri Feb 23 09:31:38 2018 @author: noordam """ #============================================================================== # input #============================================================================== xIni =90.0; # initial location of the NWO point 1 dX=0.5; # x-distance of NWO point 1 between calculations nSteps =10; # number of calculations #============================================================================== # find the output files #============================================================================== import os outputFiles =[]; dirName = "D:\\noordam\\Documents\\DAMNWO\\calculations\\test1\\input\\DAMTestNewInput.Calc\\Stability\\Bishop" for file in os.listdir(dirName): if file.endswith(".sto"): outputFileName = os.path.join(dirName, file) outputFiles.append(outputFileName) print(outputFileName) #============================================================================== # get all the safetyFactors #============================================================================== calculatedDistances=[] position = xIni; for i in range(nSteps): positionString = '%.2f' % position position = position+dX positionString = positionString.replace(".", "_") calculatedDistances.append(positionString) #============================================================================== # get all the safetyFactors #============================================================================== allfMin =[] for k in range(len(calculatedDistances)): stringIsFound = False i=0; while not stringIsFound and i < len(outputFiles): if calculatedDistances[k] not in outputFiles[i]: i=i+1; continue else: stringIsFound = True outputFile = open(outputFiles[i],'r') textInFile = outputFile.readlines() j = len(textInFile)-1; fsIsFound = False while not fsIsFound and j>=0: if "Fmin" not in textInFile[j]: j=j-1; continue else: fsIsFound = True [float(s) for s in textInFile[j].split() if s.isdigit()] fMin =float(s); allfMin.append(fMin)