1 #@ MODIF courbes Utilitai DATE 14/09/2004 AUTEUR MCOURTOI M.COURTOIS
2 # -*- coding: iso-8859-1 -*-
3 # CONFIGURATION MANAGEMENT OF EDF VERSION
4 # ======================================================================
5 # COPYRIGHT (C) 1991 - 2004 EDF R&D WWW.CODE-ASTER.ORG
6 # THIS PROGRAM IS FREE SOFTWARE; YOU CAN REDISTRIBUTE IT AND/OR MODIFY
7 # IT UNDER THE TERMS OF THE GNU GENERAL PUBLIC LICENSE AS PUBLISHED BY
8 # THE FREE SOFTWARE FOUNDATION; EITHER VERSION 2 OF THE LICENSE, OR
9 # (AT YOUR OPTION) ANY LATER VERSION.
11 # THIS PROGRAM IS DISTRIBUTED IN THE HOPE THAT IT WILL BE USEFUL, BUT
12 # WITHOUT ANY WARRANTY; WITHOUT EVEN THE IMPLIED WARRANTY OF
13 # MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. SEE THE GNU
14 # GENERAL PUBLIC LICENSE FOR MORE DETAILS.
16 # YOU SHOULD HAVE RECEIVED A COPY OF THE GNU GENERAL PUBLIC LICENSE
17 # ALONG WITH THIS PROGRAM; IF NOT, WRITE TO EDF R&D CODE_ASTER,
18 # 1 AVENUE DU GENERAL DE GAULLE, 92141 CLAMART CEDEX, FRANCE.
19 # ======================================================================
21 #==================================================
23 # usage : permet de tracer des courbes en interactif
24 # avec XMGRACE ou dans un fichier postscript
25 #==================================================
28 from Stanley import xmgrace
29 from Stanley import as_courbes
31 def COURBES(listcourb,titre=' ',soustitre=' ',legx=' ',legy=' ',bornex=None,borney=None,fichier=None):
35 # listcourb : tuple de courbes, chaque courbe etant definie soit par
36 # (TABLE1, NOM_PARA_X, TABLE2, NOM_PARA_Y, LEGENDE)
39 # titre et sous_titre : facultatifs, titre et sous-tritre du graphique
40 # legx, legy : facultatifs, legendes des axes
41 # bornex, borney : facultatifs, bornes sur les axes
42 # fichier : facultatif : sortie au format postscript si present
46 # courb1=(SYYPRT,'ABSC_CURV',SYYPRT,'SIYY','PRT')
47 # courb2=(SYYMLC10,'ABSC_CURV',SYYMLC10,'SIYY','MLC10')
48 # courb3=(SYYML100,'ABSC_CURV',SYYML100,'SIYY','MLC100')
49 # listcourb=(courb1,courb2,courb3)
50 # COURBES(listcourb,titre='Plaque trouee',legx='Abcisses curvilignes',legy='Contraintes (MPa)',bornex=(0,100),borney=(500,1000))
52 # fonc2=(F2,'F_MLC10')
53 # fonc3=(F3,'F_MLC100')
54 # listfonc=(fonc1,fonc2,fonc3)
55 # COURBES(listfonc,titre='Fonctions')
57 # COURBES(listfonc,titre='Plaque trouee',fichier='./fort.24')
58 #--------------------------------------------------------------
60 # initialisation du trace de courbes
63 graphe=xmgrace.Xmgr(10,' -hardcopy -nosafe')
64 print "Nombre de courbes ",len(listcourb)," sur le fichier :",fichier
67 graphe=xmgrace.Xmgr(10,' -noask')
68 print "Nombre de courbes ",len(listcourb)
70 graphe.Nouveau_graphe()
72 # dimensionnement des axes
76 ctest1 = as_courbes.Courbe()
84 ctest2 = as_courbes.Courbe()
90 if soustitre != None :
91 graphe.Titre(titre,soustitre)
93 graphe.Titre(titre,' ')
103 for courbi in listcourb:
104 sigi = as_courbes.Courbe()
108 sigi.Lire_x(courbi[0],courbi[1])
109 sigi.Lire_y(courbi[2],courbi[3])
113 sigi.x,sigi.y=courbi[0].Valeurs()
116 graphe.Courbe(sigi,legende)
117 graphe.Send('WITH G'+repr(graphe.gr_act))
118 graphe.Send('S' + str(k) + ' SYMBOL ' + str(k+2))
119 graphe.Send('S' + str(k) + ' SYMBOL SIZE 0.5')
120 graphe.Send('S' + str(k) + ' SYMBOL COLOR '+str(k+2))
121 graphe.Send('S' + str(k) + ' LINE COLOR '+str(k+2))
123 graphe.Send('REDRAW')
126 graphe.Sortie_EPS(fichier)
133 #===========================================