shorter examples

This commit is contained in:
Michael Davidsaver
2013-03-31 09:49:17 -04:00
parent 63aaf8afe7
commit 0049d2c59f
4 changed files with 11 additions and 20 deletions

View File

@@ -5,12 +5,8 @@ from numpy.random import randint, uniform
class WfSup(object):
def __init__(self, rec, args):
self.VAL = rec.field('VAL')
self.NORD = rec.field('NORD')
self.nelm = rec.field('NELM').getval()
self.arr = self.VAL.getarray()
self.x = np.arange(self.nelm)
self.arr = rec.field('VAL').getarray()
self.x = np.arange(rec.NELM)
self.phase = 0.0
@@ -19,11 +15,9 @@ class WfSup(object):
def process(self, rec, reason):
pha = self.phase*np.pi/180.0
self.phase += 10.0
if self.phase>=360.0:
self.phase == 360.0
self.phase = np.fmod(self.phase+10.0, 360.0)
N=randint(1,self.nelm)
N=randint(1, rec.NELM)
val=self.arr[:N]
x=self.x[:N]
@@ -35,7 +29,7 @@ class WfSup(object):
val[:]*=uniform(0.5,2.0)
val[:]+=2
self.NORD.putval(N)
self.NORD = N
def build(rec, args):
return WfSup(rec, args)