From e837d52834ff82eff0728827862bcbd8f0e76498 Mon Sep 17 00:00:00 2001 From: "pascale.noyret" Date: Tue, 23 Oct 2018 14:25:38 +0200 Subject: [PATCH] qques comentaires et on enleve la projetction de la matrice de correlation --- PSEN_Eficas/PSEN/PSSEWrapper.py | 53 +++++++++++++++++++-------------- 1 file changed, 31 insertions(+), 22 deletions(-) diff --git a/PSEN_Eficas/PSEN/PSSEWrapper.py b/PSEN_Eficas/PSEN/PSSEWrapper.py index da0d3253..7f503a6f 100755 --- a/PSEN_Eficas/PSEN/PSSEWrapper.py +++ b/PSEN_Eficas/PSEN/PSSEWrapper.py @@ -128,11 +128,12 @@ if __name__ == '__main__': #=============================================================================== -# Recuperation donn�es utilisateurs - User data +# Recuperation donnees utilisateurs - User data #=============================================================================== +# Lecture du fichier PSENConfig - > sauvegarde avec le nom en du - #extract laws from Eficas Output + #extract laws from Eficas Output PSENconfig est le fichier qui continent le dico Paths = PSENconfig.Dico['DIRECTORY'] SimuParams = PSENconfig.Dico['SIMULATION'] @@ -174,6 +175,11 @@ if __name__ == '__main__': if PSENconfig.Dico.has_key('CORRELATION'): NonActiveIndices.append(LawNames.index(shortkey)) + # Travail sur la Matrice de correlatin + # remplit CorrMatrix + # --> creation d un dictionnaire + # clef = matrice = la matrice entree par l utilisateur mois les laws non actives, et si timeserie on a juste 1 dans la diagonale + if PSENconfig.Dico.has_key('CORRELATION'): #Treat Correlation Matrix - eliminate non-activated laws CorrMatrix0 = {} @@ -206,6 +212,7 @@ if __name__ == '__main__': CorrMatrix0['laws'] = LawNames2 else: #acceptable only if all active distributions are time series or if only 1 active distribution + # a supprimer if len(Laws)==1: #create correlation matrix of 1 x 1 CorrMatrix0 = {} @@ -246,34 +253,36 @@ if __name__ == '__main__': #CorrMaxtrix0['matrix'][i][i] = 1 #retreat CorrelationMatrix - if isDuplicateLaws: - CorrMatrix = {} - CorrMatrix['laws']=Laws.keys() - CorrMatrix['matrix']=np.eye(len(Laws.keys())) - for x,lawname1 in enumerate(Laws.keys()): - for i,lawname1_0 in enumerate(CorrMatrix0['laws']): - if lawname1_0 in lawname1: - break - for y, lawname2 in enumerate(Laws.keys()): - for j,lawname2_0 in enumerate(CorrMatrix0['laws']): - if lawname2_0 in lawname2: - break - if x!=y: - CorrMatrix['matrix'][x][y] = CorrMatrix0['matrix'][i][j] - CorrMatrix['matrix'][y][x] = CorrMatrix0['matrix'][j][i] + #if isDuplicateLaws: + # CorrMatrix = {} + # CorrMatrix['laws']=Laws.keys() + # CorrMatrix['matrix']=np.eye(len(Laws.keys())) + # for x,lawname1 in enumerate(Laws.keys()): + # for i,lawname1_0 in enumerate(CorrMatrix0['laws']): + # if lawname1_0 in lawname1: + # break + # for y, lawname2 in enumerate(Laws.keys()): + # for j,lawname2_0 in enumerate(CorrMatrix0['laws']): + # if lawname2_0 in lawname2: + # break + # if x!=y: + # CorrMatrix['matrix'][x][y] = CorrMatrix0['matrix'][i][j] + # CorrMatrix['matrix'][y][x] = CorrMatrix0['matrix'][j][i] ## if i==j: ## CorrMatrix['matrix'][x][y] = 0 ## CorrMatrix['matrix'][y][x] = 0 ## else: ## CorrMatrix['matrix'][x][y] = CorrMatrix0['matrix'][i][j] ## CorrMatrix['matrix'][y][x] = CorrMatrix0['matrix'][j][i] - else: - CorrMatrix = CorrMatrix0 + #else: + # CorrMatrix = CorrMatrix0 + + CorrMatrix = CorrMatrix0 #retest for positive definiteness - if not np.all(np.linalg.eigvals(CorrMatrix['matrix'])>0): - print 'Error: Correlation matrix is not positive definite.' - sys.exit(1) + #if not np.all(np.linalg.eigvals(CorrMatrix['matrix'])>0): + # print 'Error: Correlation matrix is not positive definite.' + # sys.exit(1) #execution file name -- 2.39.2