Salome HOME
19-07-16
[tools/eficas.git] / monCode / Matrix_Cata.py
1 # coding: utf-8
2 from Accas import *
3
4 class loi      ( ASSD ) : pass
5 class variable ( ASSD ) : pass
6
7 class Matrice:
8   def __init__(self,nbLigs=None,nbCols=None,methodeCalculTaille=None,formatSortie="ligne",valSup=None,valMin=None,structure=None):
9       self.nbLigs=nbLigs
10       self.nbCols=nbCols
11       self.methodeCalculTaille=methodeCalculTaille
12       self.formatSortie=formatSortie
13       self.valSup=valSup
14       self.valMin=valMin
15       self.structure=structure
16
17   def __convert__(self,valeur):
18     # Attention ne verifie pas grand chose
19     if type(valeur) != types.ListType :
20       return None
21     return valeur
22
23   def info(self):
24       return "Matrice %s x %s" % (self.nbLigs, self.nbCols)
25
26       __repr__=info
27       __str__=info
28
29
30
31 class myModel(ASSD): pass
32
33 JdC = JDC_CATA(code='PATTERNS',
34                execmodul=None,
35                regles=(AU_MOINS_UN ( 'CORRELATION' ),
36                 )
37 )
38
39 DETERMINISTICVARIABLE = OPER ( nom = "DETERMINISTICVARIABLE",
40                                sd_prod = variable,
41                                op = None,
42                                fr = "Variable deterministe",
43                                ang = "Deterministic variable",
44             
45   N = SIMP ( statut = 'o', typ = "TXM", fr = "Nom", ang = "Name", defaut = "Var1" ),
46   T = SIMP ( statut = 'o', defaut = "in", into = ( "in" , "out", ), typ = "TXM", fr = "Type", ang = "Type" ),
47   R = SIMP ( statut = 'o', defaut = 0, typ = "I", fr = "Rang", ang = "Rank" ),
48 )
49
50 DISTRIBUTION = OPER ( nom = "DISTRIBUTION",
51                       sd_prod = loi,
52                       op = 68,
53                       fr = "Definitions des lois marginales utilisees par les variables d'entree", 
54                       
55   R = SIMP ( statut = "o", typ = "R", max = 1, val_min = 0., fr = "Parametre R de la loi | R > 0", ang = "R parameter | R > 0", defaut = 0.5 ),
56   # T > R
57   T = SIMP ( statut = "o", typ = "R", max = 1, val_min = 0., fr = "Parametre T de la loi | T > R", ang = "T parameter | T > R", defaut = 0.7 ),
58   A = SIMP ( statut = "o", typ = "R", max = 1, fr = "Borne inferieure du support de la loi", ang = "Support lower bound", defaut = 0.1 ),
59   # B > A
60   B = SIMP ( statut = "o", typ = "R", max = 1, fr = "Borne superieure du support de la loi", ang = "Support upper bound", defaut = 0.3 ),
61 )
62
63 VARIABLE = PROC ( nom = "VARIABLE",
64                   op = None,
65                   docu = "",
66                   fr = "Variable probabiliste",
67                   ang = "Probabilistic variable",
68
69   ModelVariable = SIMP ( statut = "o", typ = ( variable, ), fr = "Variable d'entrée du modèle", ang = "Input variable of the model" ),
70   Distribution = SIMP ( statut = "o", typ = ( loi, ), fr = "Modélisation probabiliste", ang = "Probabilistic modelisation" ),
71 )
72
73 CORRELATION = PROC ( nom = 'CORRELATION',
74                      op = None,
75                      docu = "",
76                      fr = "Correlation entre variables",
77                      ang = "Variable correlation",
78
79   CorrelationMatrix = SIMP ( statut = "o", typ = Matrice(nbLigs=None,
80                                                          nbCols=None,
81                                                          methodeCalculTaille='NbDeVariables',
82                                                          valSup=1,
83                                                          valMin=-1,
84                                                          structure="symetrique"),
85                              fr = "Matrice de correlation entre les variables d'entree",
86                              ang = "Correlation matrix for input variables" ),
87 )