Esempio n. 1
0
  def test_create_double(self):
    import numpy
    import random

    len=random.randint(1,7)
    num=random.randint(128,512)
    data=numpy.random.random_sample((num,len))

    probe=Probe(self.sim,'Double data',data)  
Esempio n. 2
0
  def test_create_float(self):
    import numpy
    import random

    len=random.randint(1,7)
    num=random.randint(128,512)
    data=numpy.float32(numpy.random.random_sample((num,len)))

    probe=Probe(self.sim,'Float data',data)  
Esempio n. 3
0
  def setUp(self):
    import os
    import random
    import numpy
    from Danu import Output

    self.filename = 'test-Probe.h5'
    if  os.path.exists(self.filename):
      os.remove(self.filename)

    self.fh=Output(self.filename,'w')
    self.sim=self.fh.add_simulation('Test Probe')

    # Int data
    self.idata_name='Int data'
    len=random.randint(1,7)
    num=random.randint(128,512)
    self.idata=numpy.zeros((num,len))
    self.idata_len=len
    i=0
    while i < num:
      l=0
      while l < len:
	self.idata[i][l]=random.randint(0,100000)
	l=l+1
      i=i+1
    probe=Probe(self.sim,self.idata_name,self.idata)  

    # Float data
    self.fdata_name='Float data'
    len=random.randint(1,7)
    num=random.randint(128,512)
    self.fdata=numpy.float32(numpy.random.random_sample((num,len)))
    self.fdata_len=len
    probe=Probe(self.sim,self.fdata_name,self.fdata)  

    # Double data
    self.rdata_name='Double data'
    len=random.randint(1,7)
    num=random.randint(128,512)
    self.rdata=numpy.random.random_sample((num,len))
    self.rdata_len=len
    probe=Probe(self.sim,self.rdata_name,self.rdata)  
Esempio n. 4
0
  def setUp(self):
    import os
    from Danu import Output
    import random
    import numpy

    self.filename = 'test-Probe.h5'
    if  os.path.exists(self.filename):
      os.remove(self.filename)

    self.fh=Output(self.filename,'w')
    self.sim=self.fh.add_simulation('Test Probe')
    self.probe_name='Dummy Probe'
    data=numpy.ones((3,10))
    Probe(self.sim,self.probe_name,data)
Esempio n. 5
0
  def test_create_int(self):
    import numpy
    import random

    len=random.randint(1,7)
    num=random.randint(128,512)
    idata=numpy.zeros((num,len))
    i=0
    while i < num:
      l=0
      while l < len:
	idata[i][l]=random.randint(0,100000)
	l=l+1
      i=i+1

    probe=Probe(self.sim,'Int Data',idata)  
Esempio n. 6
0
  def runTest(self):
    import random
    import numpy

    print 'Begin basic test'
    try:
      probe=Probe()
    except:
      print 'Caught invalid number of arguments'

    try:
      probe=Probe(self.sim)
    except:
      print 'Caught invalid number of arguments'

    try:
      probe=Probe(self.sim,'Dummy Probe')
    except:
      print 'Caught invalid number of arguments'

    try:
      data=numpy.ones((10))
      probe=Probe(self.sim,'Dummy Probe',data)
    except:
      print 'Caught incorrect argument type'

    # Simple constructor and delete
    len=2
    num=20
    data=numpy.ones((num,len))
    probe= Probe(self.sim,'Dummy Probe',data)
    del probe

    probe=self.sim.probe_open('Dummy Probe')
    self.assertEqual(probe.length(),len)
    self.assertEqual(probe.number(),num)