Beispiel #1
0
"""
Draw the Diff2 class hierarchy.
"""
try:
    from scitools.Lumpy import Lumpy
except ImportError:
    print 'No Lumpy installed'
    sys.exit(1)
import sys

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

lumpy = Lumpy()
import Line_Parabola

p = Line_Parabola.Parabola(1, -2, 2)
l = Line_Parabola.Line(1, 0)  # needed this to draw Line-Parabola correctly
lumpy.class_diagram()
del p, Line_Parabola


def f(x):
    return x + 1.0 / x**2


lumpy = Lumpy()

import Diff2

diff = []
Beispiel #2
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
Beispiel #3
0
from scitools.Lumpy import Lumpy

lumpy = Lumpy()
from numpy import zeros

B = zeros((100, 20))
c = B[-1, -1]
del zeros
lumpy.object_diagram()
Beispiel #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()



Beispiel #5
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()

from scitools.Lumpy import Lumpy

lumpy = Lumpy() 
from numpy import zeros
B = zeros((100,20))
c = B[-1,-1]
del zeros
lumpy.object_diagram()

Beispiel #7
0
try:
    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()
Beispiel #8
0
"""
Draw the Diff2 class hierarchy.
"""
try:
    from scitools.Lumpy import Lumpy
except ImportError:
    print "No Lumpy installed"
    sys.exit(1)
import sys

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

lumpy = Lumpy()
import Line_Parabola

p = Line_Parabola.Parabola(1, -2, 2)
l = Line_Parabola.Line(1, 0)  # needed this to draw Line-Parabola correctly
lumpy.class_diagram()
del p, Line_Parabola


def f(x):
    return x + 1.0 / x ** 2


lumpy = Lumpy()

import Diff2

diff = []
Beispiel #9
0
try:
    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()
Beispiel #10
0
from scitools.Lumpy import Lumpy
lumpy = Lumpy() 
lumpy.make_reference()

class Y:
    def __init__(self, v0):
        self.v0 = v0
        self.g = 9.81

    def value(self, t):
        return self.v0*t - 0.5*self.g*t**2

y = Y(3)
lumpy.class_diagram()