/usr/lib/aster/Utilitai/courbes.py is in code-aster 11.5.0+dfsg2-4.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 | # coding=utf-8
# CONFIGURATION MANAGEMENT OF EDF VERSION
# ======================================================================
# COPYRIGHT (C) 1991 - 2004 EDF R&D WWW.CODE-ASTER.ORG
# THIS PROGRAM IS FREE SOFTWARE; YOU CAN REDISTRIBUTE IT AND/OR MODIFY
# IT UNDER THE TERMS OF THE GNU GENERAL PUBLIC LICENSE AS PUBLISHED BY
# THE FREE SOFTWARE FOUNDATION; EITHER VERSION 2 OF THE LICENSE, OR
# (AT YOUR OPTION) ANY LATER VERSION.
#
# THIS PROGRAM IS DISTRIBUTED IN THE HOPE THAT IT WILL BE USEFUL, BUT
# WITHOUT ANY WARRANTY; WITHOUT EVEN THE IMPLIED WARRANTY OF
# MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. SEE THE GNU
# GENERAL PUBLIC LICENSE FOR MORE DETAILS.
#
# YOU SHOULD HAVE RECEIVED A COPY OF THE GNU GENERAL PUBLIC LICENSE
# ALONG WITH THIS PROGRAM; IF NOT, WRITE TO EDF R&D CODE_ASTER,
# 1 AVENUE DU GENERAL DE GAULLE, 92141 CLAMART CEDEX, FRANCE.
# ======================================================================
#==================================================
# fonction "COURBES"
# usage : permet de tracer des courbes en interactif
# avec XMGRACE ou dans un fichier postscript
#==================================================
import Stanley
from Stanley import xmgrace
from Stanley import as_courbes
def COURBES(listcourb,titre=' ',soustitre=' ',legx=' ',legy=' ',bornex=None,borney=None,fichier=None):
# ARGUMENTS
# listcourb : tuple de courbes, chaque courbe etant definie soit par
# (TABLE1, NOM_PARA_X, TABLE2, NOM_PARA_Y, LEGENDE)
# soit par :
# (FONCTION,LEGENDE)
# titre et sous_titre : facultatifs, titre et sous-tritre du graphique
# legx, legy : facultatifs, legendes des axes
# bornex, borney : facultatifs, bornes sur les axes
# fichier : facultatif : sortie au format postscript si present
#
# exemples d'appel :
#--------------------
# courb1=(SYYPRT,'ABSC_CURV',SYYPRT,'SIYY','PRT')
# courb2=(SYYMLC10,'ABSC_CURV',SYYMLC10,'SIYY','MLC10')
# courb3=(SYYML100,'ABSC_CURV',SYYML100,'SIYY','MLC100')
# listcourb=(courb1,courb2,courb3)
# COURBES(listcourb,titre='Plaque trouee',legx='Abcisses curvilignes',legy='Contraintes (MPa)',bornex=(0,100),borney=(500,1000))
# fonc1=(F1,'F_PRT')
# fonc2=(F2,'F_MLC10')
# fonc3=(F3,'F_MLC100')
# listfonc=(fonc1,fonc2,fonc3)
# COURBES(listfonc,titre='Fonctions')
# postscript
# COURBES(listfonc,titre='Plaque trouee',fichier='./fort.24')
#--------------------------------------------------------------
# initialisation du trace de courbes
if (fichier!=None):
graphe=xmgrace.Xmgr(10,' -hardcopy -nosafe')
print "Nombre de courbes ",len(listcourb)," sur le fichier :",fichier
else:
graphe=xmgrace.Xmgr(10,' -noask')
print "Nombre de courbes ",len(listcourb)
graphe.Nouveau_graphe()
# dimensionnement des axes
if bornex != None :
xmin=list(bornex)[0]
xmax=list(bornex)[1]
ctest1 = as_courbes.Courbe()
ctest1.x=[xmin,xmax]
ctest1.y=[0.0,0.0]
graphe.Courbe(ctest1)
if borney != None :
ymin=list(borney)[0]
ymax=list(borney)[1]
ctest2 = as_courbes.Courbe()
ctest2.x=[0.0,0.0]
ctest2.y=[ymin,ymax]
graphe.Courbe(ctest2)
if titre != None :
if soustitre != None :
graphe.Titre(titre,soustitre)
else :
graphe.Titre(titre,' ')
if legx != None :
graphe.Axe_x(legx)
if legy != None :
graphe.Axe_y(legy)
k = 0
for courbi in listcourb:
sigi = as_courbes.Courbe()
try :
# cas d une table
sigi.Lire_x(courbi[0],courbi[1])
sigi.Lire_y(courbi[2],courbi[3])
legende=courbi[4]
except :
# cas d une fonction
sigi.x,sigi.y=courbi[0].Valeurs()
legende=courbi[1]
graphe.Courbe(sigi,legende)
graphe.Send('WITH G'+repr(graphe.gr_act))
graphe.Send('S' + str(k) + ' SYMBOL ' + str(k+2))
graphe.Send('S' + str(k) + ' SYMBOL SIZE 0.5')
graphe.Send('S' + str(k) + ' SYMBOL COLOR '+str(k+2))
graphe.Send('S' + str(k) + ' LINE COLOR '+str(k+2))
k = k + 1
graphe.Send('REDRAW')
if (fichier!=None):
graphe.Sortie_EPS(fichier)
graphe.Fermer()
else:
graphe.Attendre()
k=0
#===========================================
|