From: Eric Fayolle Date: Mon, 10 Oct 2022 14:40:02 +0000 (+0200) Subject: Fusion des fonctionnalités Sortie Panda + Lancement fenêtré X-Git-Tag: merge_uncertainty_odysee_1210~2 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=61a900ee85d66be5483eafcde12135ca63fa67c7;p=tools%2Feficas.git Fusion des fonctionnalités Sortie Panda + Lancement fenêtré --- 61a900ee85d66be5483eafcde12135ca63fa67c7 diff --cc generator/generator_UQ.py index 69200c5f,ec984e76..506bae17 --- a/generator/generator_UQ.py +++ b/generator/generator_UQ.py @@@ -469,11 -411,16 +469,17 @@@ class UQGenerator(PythonGenerator) # print('txtResultCT:',txtResultCT) optionalResultList=getStrVarList(optionalResultNames) optionalResultStrList=getStrVarStrList(optionalResultNames) + post_csv_rnScript=os.path.basename(self.ScriptPosttraitement).split('.')[0] + post_csv_rnPath=os.path.dirname(self.ScriptPosttraitement) + print (post_csv_rnScript) + print (post_csv_rnPath) txtPrintResult=printResult.format( + post_csv_rnScript = post_csv_rnScript, + post_csv_rnPath = post_csv_rnPath, optionalResultList = optionalResultList, optionalResultStrList = optionalResultStrList, - resultSkList = getStrVarList(self.resultSkList)) + resultSkList = getStrVarList(self.resultSkList), + Uncertain_inputs = self.creeTexteInputVariablesSummary(self.indent1) ) txtResult= txtResultCT.format( optionalResult=result ) txtResult+=txtPrintResult diff --cc generator/textePersalys.py index e1e698b8,44317a2e..928d53ca --- a/generator/textePersalys.py +++ b/generator/textePersalys.py @@@ -223,53 -217,13 +223,55 @@@ if __name__ == '__main__' # inputs = [a, b] # outputs = [d] -printResult=""" import numpy as np +# empiricalMean = ot.Sample(result.getMean())[nInputs:] +# empiricalStandardDeviation = ot.Sample(result.getStandardDeviation())[nInputs:] +# resultNp.reshape(nbindex,nbsorties) + +printResultMC=""" import numpy as np - from post_csv_rn import write_result_from_persalys + sys.path.append(os.path.abspath('{post_csv_rnPath}')) + from {post_csv_rnScript} import write_result_from_persalys - #from post_csv_rn import write_result_from_persalys - # import pandas as pnd - # from functools import reduce + #Noms de lignes + #index = ['meanFirstOrder', 'meanSecondOrderOrder', 'standardDeviationFirstOrder' ] + indexNp = [ {optionalResultStrList} ] + nResult = len(indexNp) + + #resultNp = np.array([meanFirstOrder, meanSecondOrderOrder, standardDeviationFirstOrder ]) + #Lignes de résultats demandés pour toutes les fcts d'aggrégation en colonne + resultNp = np.array([ {optionalResultList} ]) + resultNp = resultNp.reshape(nResult, nOutputs) #En MC à cause du ot.Sample( PointsCollection) il y a un niveau de liste en trop + + #Tableau skyline localisant les variables (hors fctAgg) dans le tableau de résultat global + # ex pour deux variables et respectivement 7 et 3 fcts aggrégation : resultSk = [0,7,10] + #nOutVar = len(resSk)-1 + resSk = [ {resultSkList} ] + + print('\\n\\n') + print('*********************************************************************************\\n') + print(' UNCERTAINTY QUANTIFICATION RESULTS\\n') + + print(head_study,'\\n') + + print('Uncertain inputs list :','\\n') + print( +{Uncertain_inputs}'\\n' + ) + print('\\nElapsed Time : ', centralTendency.getElapsedTime(),'\\n') #Monte Carlo ou Taylor + + print('\\nDesign of Experiment :') + print(result.getDesignOfExperiment().getInputSample(),'\\n') #TODO: générer un fichier csv + + print('\\nCoefficient of Variation :') + print(ot.Sample(result.getCoefficientOfVariation())[nInputs:],'\\n') #TODO: générer un fichier csv + write_result_from_persalys(resultNp, indexNp, resSk, outputs) + + print('\\n*********************************************************************************\\n') +""" + + +printResultTaylor=""" import numpy as np - from post_csv_rn import write_result_from_persalys ++ sys.path.append(os.path.abspath('{post_csv_rnPath}')) ++ from {post_csv_rnScript} import write_result_from_persalys #resultNp = np.array([meanFirstOrder, meanSecondOrderOrder, standardDeviationFirstOrder ]) #Lignes de résultats demandés pour toutes les fcts d'aggrégation en colonne @@@ -277,35 -231,41 +279,36 @@@ #Noms de lignes #index = ['meanFirstOrder', 'meanSecondOrderOrder', 'standardDeviationFirstOrder' ] + #nResult = len(indexNp) indexNp = [ {optionalResultStrList} ] + #nResult = len(indexNp) #Tableau skyline localisant les variables (hors fctAgg) dans le tableau de résultat global - #resultSk = [0,7,10] + # ex pour deux variables et respectivement 7 et 3 fcts aggrégation : resultSk = [0,7,10] + #nOutVar = len(resSk)-1 resSk = [ {resultSkList} ] - #nOutVar = len(resSk)-1 + print('\\n\\n') + print('*********************************************************************************\\n') + print(' UNCERTAINTY QUANTIFICATION RESULTS\\n') + + print(head_study,'\\n') - write_result_from_persalys(resultNp, indexNp, resSk, outputs) + print('Uncertain inputs list :','\\n') + print( +{Uncertain_inputs}'\\n' + ) + print('\\nElapsed Time : ', centralTendency.getElapsedTime(),'\\n') #Monte Carlo ou Taylor - # print('\\n') - # for i in range(nOutVar): - # # Récupère les couples (fctAggrégation,Nom de variable ss fct Agg) - # # des champs de description des sorties. - # # Les sorties concernées proviennent de la section de résultatNp - # # qui doit correspondre à une même variable hors fct Agg - # fctAgg_outVarName = list( map(lambda o: eval(o.getDescription()), - # outputs[resSk[i]:resSk[i+1]]) ) - # outVarName = fctAgg_outVarName[0][1] - # checkOutVarName = reduce( lambda n1,n2: n1 == n2, - # [True]+list( map(lambda o: o[1] == outVarName, - # fctAgg_outVarName) ) ) - # assert(checkOutVarName == True) - # print(outVarName) - # columns = list(map(lambda o1: o1[0], fctAgg_outVarName) ) - # resultDf = pnd.DataFrame(resultNp[:,resSk[i]:(resSk[i+1])], - # index = indexNp, - # columns = columns ) - # print(resultDf,'\\n') - # #name_csv = str.replace(str.replace(outVarName,"@","_"),' ','-') - # name_csv = outVarName - # resultDf.to_csv(name_csv+'-uncertainty.csv') + # print('\\nDesign of Experiment :') + # print(result.getDesignOfExperiment().getInputSample(),'\\n') #TODO: Activer uniquement en MC + fichier csv + # print('\\nCoefficient of Variation :') + # print(result.getCoefficientOfVariation(),'\\n') #TODO: Activer uniquement en MC + fichier csv + write_result_from_persalys(resultNp, indexNp, resSk, outputs) + + print('\\n*********************************************************************************\\n') """ ## Tendance Centrale Taylor