예제 #1
0
from scitools.Lumpy import Lumpy
lumpy = Lumpy()
lumpy.make_reference()

infile = open('table.dat', 'r')
lines = infile.readlines()
infile.close()
data = {}   #  data[property][measurement_no] = propertyvalue
first_line = lines[0]
properties = first_line.split()
for p in properties:
    data[p] = {}

for line in lines[1:]:
    words = line.split()
    i = int(words[0])       # measurement number
    values = words[1:]      # values of properties
    for p, v in zip(properties, values):
        if v != 'no':
            data[p][i] = float(v)

# Compute mean values
for p in data:
    values = data[p].values()
    data[p]['mean'] = sum(values)/len(values)

for p in sorted(data):
    print 'Mean value of property %s = %g' % (p, data[p]['mean'])

# Clean up variables that we don't want in the object plot
del p, v, values, line, words, first_line, properties, lines, i, infile
예제 #2
0
from scitools.Lumpy import Lumpy

# Table of columns
lumpy = Lumpy() 
lumpy.make_reference()
Cdegrees = [20, 25, 30, 35, 40]
Fdegrees = [(9.0/5)*C + 32 for C in Cdegrees]
table1 = [Cdegrees, Fdegrees]
del Cdegrees, Fdegrees, C
lumpy.object_diagram()

# Table of rows
lumpy = Lumpy() 
Cdegrees = [20, 25, 30, 35, 40]
Fdegrees = [(9.0/5)*C + 32 for C in Cdegrees]
table2 = [[C, F] for C, F in zip(Cdegrees, Fdegrees)]
del Cdegrees, Fdegrees, C, F
lumpy.object_diagram()

예제 #3
0
    from scitools.Lumpy import Lumpy
except ImportError:
    print 'No Lumpy installed'
    sys.exit(1)
import sys
from classes import Y, Derivative, VelocityProfile, Account, AccountP, \
     Person, Circle
from Complex import Complex
from Vec2D import Vec2D
from Polynomial import Polynomial as P

# Run lumpy.object_diagram() from the main program, not a function,
# to avoid seeing the lumpy variable explicitly in the diagrams

lumpy = Lumpy() 
lumpy.make_reference()   # not necessary for class diagrams
y = Y(v0=4)
lumpy.object_diagram()
lumpy.class_diagram()
del y # remove it from the next diagrams

lumpy = Lumpy() 
v = VelocityProfile(beta=0.06, mu0=0.02, n=0.3, R=1)
lumpy.object_diagram()
lumpy.class_diagram()
del v

lumpy = Lumpy() 
v = Account('John Doe', '93351545761', 1000)
lumpy.object_diagram()
lumpy.class_diagram()
예제 #4
0
from scitools.Lumpy import Lumpy
lumpy = Lumpy() 
lumpy.make_reference()
l0 = [1, 4, 3]
l1 = l0
l2 = l1[:-1]
l1[0] = 100
lumpy.object_diagram()

lumpy = Lumpy() 
lumpy.make_reference()  # not necessary
n1 = 21.5
n2 = 21
l3 = [l1, l2, [n1, n2]]
s1 = 'some string'
lumpy.object_diagram()

lumpy = Lumpy() 
lumpy.make_reference()  # not necessary
from numpy import *
a = zeros(4)
lumpy.object_diagram()



예제 #5
0
    from scitools.Lumpy import Lumpy
except ImportError:
    print 'No Lumpy installed'
    sys.exit(1)
import sys
from classes import Y, Derivative, VelocityProfile, Account, AccountP, \
     Person, Circle
from Complex import Complex
from Vec2D import Vec2D
from Polynomial import Polynomial as P

# run lumpy.object_diagram() from the main program, not a function,
# to avoid seeing the lumpy variable explicitly in the diagrams

lumpy = Lumpy() 
lumpy.make_reference()   # not necessary for class diagrams
y = Y(v0=4)
lumpy.object_diagram()
lumpy.class_diagram()
del y # remove it from the next diagrams

lumpy = Lumpy() 
v = VelocityProfile(beta=0.06, mu0=0.02, n=0.3, R=1)
lumpy.object_diagram()
lumpy.class_diagram()
del v

lumpy = Lumpy() 
v = Account('John Doe', '93351545761', 1000)
lumpy.object_diagram()
lumpy.class_diagram()