def testCreateScan(self): graPyspIfc.setSpectra(False) graPyspIfc.cls() graPyspIfc.delete() scan = graPyspIfc.Scan(name="s1", lineColor="red", nPts=201) self.assertEqual(scan.xMin, 0.) self.assertEqual(scan.xMax, 10.) self.assertEqual(scan.lineColor, "red") self.assertEqual(scan.nPts, 201) scan.display() PySpectra.processEventsLoop(1) if utils.getHostname() != definitions.hostTK: return graPyspIfc.setSpectra(True) graPyspIfc.cls() graPyspIfc.delete() scan = graPyspIfc.Scan(name="s1", lineColor="blue", nPts=201) self.assertEqual(scan.xMin, 0.) self.assertEqual(scan.xMax, 10.) self.assertEqual(scan.lineColor, "blue") self.assertEqual(scan.nPts, 201) scan.display() time.sleep(1) graPyspIfc.close()
def testFillScan(self): graPyspIfc.setSpectra(False) graPyspIfc.cls() graPyspIfc.delete() scan = graPyspIfc.Scan(name="s1", color="blue", nPts=101) scan.y = numpy.random.normal(size=(101)) scan.x = numpy.linspace(0., 10., 101) scan.display() PySpectra.processEventsLoop(1) if utils.getHostname() != definitions.hostTK: return graPyspIfc.setSpectra(True) graPyspIfc.cls() graPyspIfc.delete() scan = graPyspIfc.Scan(name="s1", color="blue", nPts=101) scan.y = numpy.random.normal(size=(101)) scan.x = numpy.linspace(0., 10., 101) scan.display() time.sleep(1) graPyspIfc.close()
def testToPyspMonitorColumns(self): import random print "testZmqIfc.testToPyspMonitor1" if utils.getHostname() != definitions.hostTK: return hsh = HasyUtils.toPyspMonitor({'command': ['cls', 'delete']}) self.assertEqual(hsh['result'], 'done') MAX = 25 pos = np.linspace(0, 10, MAX) d1 = np.random.random_sample((len(pos), )) * 1000. d2 = np.random.random_sample((len(pos), )) * 1000. hsh = HasyUtils.toPyspMonitor({ 'putData': { 'title': "testing putData & columns", 'comment': "a comment", 'columns': [{ 'name': "eh_mot01", 'data': pos }, { 'name': "eh_c01", 'data': d1 }, { 'name': "eh_c02", 'data': d2, 'symbolColor': 'blue', 'symbol': '+', 'symbolSize': 5, 'xLog': False, 'yLog': False, 'showGridX': False, 'showGridY': False }] } }) self.assertEqual(hsh['result'], 'done') HasyUtils.toPyspMonitor({'command': ['display']}) self.assertEqual(hsh['result'], 'done') time.sleep(1) # # retrieve the data # hsh = HasyUtils.toPyspMonitor({'getData': True}) self.assertEqual(hsh['result'], 'done') # # ... and compare. # for i in range(MAX): self.assertEqual(pos[i], hsh['getData']['EH_C01']['x'][i]) self.assertEqual(d1[i], hsh['getData']['EH_C01']['y'][i]) self.assertEqual(d2[i], hsh['getData']['EH_C02']['y'][i]) print "testZmqIfc.testToPyspMonitorColumns DONE" return
def testWrite(self): print("testGraPyspIfc.testWrite") graPyspIfc.cls() graPyspIfc.delete() graPyspIfc.setSpectra(False) (xMin, xMax, nPts) = (0., 10., 20) x = numpy.linspace(xMin, xMax, nPts) y = numpy.random.random_sample(nPts) rand = graPyspIfc.Scan(name="rand", lineColor='blue', x=x, y=y, nPts=nPts) graPyspIfc.write(names="rand") graPyspIfc.close() if utils.getHostname() != definitions.hostTK: return graPyspIfc.setSpectra(True) (xMin, xMax, nPts) = (0., 10., 20) x = numpy.linspace(xMin, xMax, nPts) y = numpy.random.random_sample(nPts) rand = graPyspIfc.Scan(name="rand", lineColor='blue', x=x, y=y, nPts=nPts) with self.assertRaises(ValueError) as context: graPyspIfc.write() #print("testSetXY: %s" % repr( context.exception)) self.assertTrue( "graPyspIfc.write: expecting a string containing the name" in context.exception) with self.assertRaises(ValueError) as context: graPyspIfc.write(["rand"]) #print("testSetXY: %s" % repr( context.exception)) self.assertTrue( "graPyspIfc.write: input must no be a list" in context.exception) scan = graPyspIfc.getGqe("rand") self.assertEqual(scan, 1) graPyspIfc.write("rand") graPyspIfc.close() print("testGraPyspIfc.testMisc DONE") return
def testToPyspMonitorCompleteImagePutData(self): ''' use putData to transfer a complete image at once ''' print "testZmqIfc.testToPyspMonitor6" if utils.getHostname() != definitions.hostTK: return hsh = HasyUtils.toPyspMonitor({'command': ['cls', 'delete']}) self.assertEqual(hsh['result'], 'done') hsh = HasyUtils.toPyspMonitor({'command': ['setWsViewport dina5s']}) self.assertEqual(hsh['result'], 'done') (xmin, xmax) = (-2., -0.5) (ymin, ymax) = (0, 1.5) (width, height) = (100, 100) maxiter = 25 # # fill the image, pixel by pixel # r1 = np.linspace(xmin, xmax, width) r2 = np.linspace(ymin, ymax, height) data = np.ndarray((width, height), np.float64) for i in range(width): for j in range(height): res = mandelbrot(r1[i] + 1j * r2[j], maxiter) data[i][j] = int(res) # # title: putData transfers the complete image at once # hsh = HasyUtils.toPyspMonitor({ 'command': ['setTitle "putData transfers the complete image at once"'] }) self.assertEqual(hsh['result'], 'done') hsh = HasyUtils.toPyspMonitor({ 'putData': { 'images': [{ 'name': "MandelBrot", 'data': data, 'xMin': xmin, 'xMax': xmax, 'yMin': ymin, 'yMax': ymax }] } }) self.assertEqual(hsh['result'], 'done') hsh = HasyUtils.toPyspMonitor({'command': ['display']}) self.assertEqual(hsh['result'], 'done') time.sleep(2) print "testZmqIfc.testToPyspMonitorCompleteImagePutData DONE" return
def testDelete(self): print("testGraPyspIfc.testDelete") graPyspIfc.setSpectra(False) graPyspIfc.cls() graPyspIfc.delete() (xMin, xMax, nPts) = (0., 10., 20) x = numpy.linspace(xMin, xMax, nPts) y = numpy.random.random_sample(nPts) rand = graPyspIfc.Scan(name="sinus", lineColor='blue', x=x, y=y, nPts=nPts) scan = graPyspIfc.getGqe("sinus") self.assertEqual(scan.name, "sinus") graPyspIfc.deleteScan(rand) scan = graPyspIfc.getGqe("sinus") self.assertEqual(scan, None) graPyspIfc.close() if utils.getHostname() != definitions.hostTK: return graPyspIfc.setSpectra(True) (xMin, xMax, nPts) = (0., 10., 20) x = numpy.linspace(xMin, xMax, nPts) y = numpy.random.random_sample(nPts) rand = graPyspIfc.Scan(name="sinus", lineColor='blue', x=x, y=y, nPts=nPts) scan = graPyspIfc.getGqe("sinus") self.assertEqual(scan, 1) graPyspIfc.deleteScan(rand) scan = graPyspIfc.getGqe("sinus") self.assertEqual(scan, 0) graPyspIfc.close() print("testGraPyspIfc.testDelete DONE") return
def testMotorArrowCurrentAndSetPoint(self): print("testPySpectra.testMotorArrowCurrentAndSetPoint") if utils.getHostname() != definitions.hostTK: return PySpectra.cls() PySpectra.delete() PySpectra.setTitle("test arrows, current and setpoint") g = utils.createGauss(name="gauss", xMin=-5., xMax=5., nPts=101, lineColor='red', x0=0., sigma=1., amplitude=1.) g.x += 50 g.motorNameList = ["eh_mot66"] proxy = PyTango.DeviceProxy("eh_mot66") g.display() POSI = 50 g.setArrowMisc(proxy.position) proxy.position = POSI print("testPySpectra.testArrow: moving %s to %g" % (proxy.name(), POSI)) g.setArrowSetPoint(POSI) while proxy.state() == PyTango.DevState.MOVING: g.updateArrowCurrent() time.sleep(0.1) g.updateArrowCurrent() g.display() POSI = 51 g.setArrowMisc(proxy.position) proxy.position = POSI print("testPySpectra.testArrow: moving %s to %g" % (proxy.name(), POSI)) g.setArrowSetPoint(POSI) while proxy.state() == PyTango.DevState.MOVING: g.setArrowCurrent(proxy.position) time.sleep(0.1) g.setArrowCurrent(proxy.position) return
def testSinusScan(self): graPyspIfc.setSpectra(False) graPyspIfc.cls() graPyspIfc.delete() sinus = graPyspIfc.Scan(name="sinus", lineColor='blue', xMin=-5, xMax=5., yMin=-1.5, yMax=1.5, nPts=21, yLabel='sin') sinus.y = numpy.sin(sinus.x) sinus.display() self.assertEqual(sinus.getCurrent(), 20) PySpectra.processEventsLoop(1) if utils.getHostname() != definitions.hostTK: return graPyspIfc.setSpectra(True) graPyspIfc.cls() graPyspIfc.delete() sinus = graPyspIfc.Scan(name="sinus", lineColor='blue', xMin=-5, xMax=5., yMin=-1.5, yMax=1.5, nPts=21, yLabel='sin') sinus.y = numpy.sin(sinus.x) sinus.display() time.sleep(2) self.assertEqual(sinus.getCurrent(), 20) graPyspIfc.close()
def testMoveMotorStart(self): print "testTangoIfc.testMoveMotorStart" if utils.getHostname() != definitions.hostTK: return PySpectra.cls() PySpectra.delete() PySpectra.setTitle( "watch arrows (setPoint, current) while moving a motor forth and back" ) g = utils.createGauss(name="gauss", xMin=-5., xMax=5., nPts=101, lineColor='red', x0=0., sigma=1., amplitude=1.) g.motorNameList = ["eh_mot66"] proxyPool = PyTango.DeviceProxy(g.motorNameList[0]) proxy = PyTango.DeviceProxy(proxyPool.TangoDevice) POS = proxy.position + 1 g.x += POS g.xMin += POS g.xMax += POS print("testTangoIfc.testMoveMotorNameList: move %s to %g" % (g.motorNameList[0], POS)) tangoIfc.moveStart(g, POS, flagConfirm=False) g.display() g.setArrowSetPoint(POS) while proxy.state() != PyTango.DevState.ON: time.sleep(0.5) g.updateArrowCurrent() POS -= 1 print("testTangoIfc.testMoveMotorNameList: move %s back to %g" % (g.motorNameList[0], POS)) tangoIfc.moveStart(g, POS, flagConfirm=False) g.setArrowSetPoint(POS) while proxy.state() != PyTango.DevState.ON: time.sleep(0.5) g.updateArrowCurrent() print "testTangoIfc.testMoveMotorStart DONE" return
def testCreateHardCopy(self): print("testGraPyspIfc.testCreateHardCopy") graPyspIfc.setSpectra(False) graPyspIfc.cls() graPyspIfc.delete() (xMin, xMax, nPts) = (0., 10., 20) x = numpy.linspace(xMin, xMax, nPts) y = numpy.random.random_sample(nPts) rand = graPyspIfc.Scan(name="sinus", lineColor='blue', x=x, y=y, nPts=nPts) graPyspIfc.createHardCopy() graPyspIfc.createHardCopy(printer='hasps01', flagPrint=True) graPyspIfc.close() if utils.getHostname() != definitions.hostTK: return graPyspIfc.setSpectra(True) (xMin, xMax, nPts) = (0., 10., 20) x = numpy.linspace(xMin, xMax, nPts) y = numpy.random.random_sample(nPts) rand = graPyspIfc.Scan(name="sinus", lineColor='blue', x=x, y=y, nPts=nPts) graPyspIfc.createHardCopy() graPyspIfc.createHardCopy(printer='hasps01', flagPrint=True) graPyspIfc.close() print("testGraPyspIfc.testCreateHardCopy DONE") return
def testCheckTargetWithinLimits(self): print("testPySpectra.testCheckTargetWithinLimits") if utils.getHostname() != definitions.hostTK: return PySpectra.cls() PySpectra.delete() g = PySpectra.Scan(name="gauss", xMin=-5., xMax=5., nPts=101, lineColor='red') mu = 0. sigma = 1. g.y = 1 / (sigma * np.sqrt(2. * np.pi)) * np.exp(-(g.y - mu)**2 / (2. * sigma**2)) g.x += 50 g.motorNameList = ["eh_mot66"] proxy = PyTango.DeviceProxy(g.motorNameList[0]) # # [ 0.0, 149.4232] # self.assertEqual( g.checkTargetWithinLimits(g.motorNameList[0], 51., proxy, flagConfirm=False), True) self.assertEqual( g.checkTargetWithinLimits(g.motorNameList[0], -151., proxy, flagConfirm=False), False) self.assertEqual( g.checkTargetWithinLimits(g.motorNameList[0], 151., proxy, flagConfirm=False), False) return
def testMoveMotorNameList(self): print "testTangoIfc.testMoveMotorNameList" if utils.getHostname() != definitions.hostTK: return PySpectra.cls() PySpectra.delete() PySpectra.setTitle("watch arrows while a motor is tangoIfc.move()ed") g = utils.createGauss(name="gauss", xMin=-5., xMax=5., nPts=101, lineColor='red', x0=0., sigma=1., amplitude=1.) g.motorNameList = ["eh_mot66"] proxyPool = PyTango.DeviceProxy(g.motorNameList[0]) proxy = PyTango.DeviceProxy(proxyPool.TangoDevice) POS = proxy.position + 1 g.x += POS g.xMin += POS g.xMax += POS print("testTangoIfc.testMoveMotorNameList: move %s to %g" % (g.motorNameList[0], POS)) tangoIfc.move(g, POS, flagConfirm=False) POS -= 1 print("testTangoIfc.testMoveMotorNameList: move %s back to %g" % (g.motorNameList[0], POS)) tangoIfc.move(g, POS, flagConfirm=False) print "testTangoIfc.testMoveMotorNameList DONE" return
def testMisc(self): print("testGraPyspIfc.testMisc") graPyspIfc.cls() graPyspIfc.delete() graPyspIfc.setSpectra(False) graPyspIfc.setComment("this is a comment") graPyspIfc.setTitle("this is a title") ret = graPyspIfc.getComment() self.assertEqual(ret, "this is a comment") ret = graPyspIfc.getTitle() self.assertEqual(ret, "this is a title") graPyspIfc.close() if utils.getHostname() != definitions.hostTK: return graPyspIfc.setSpectra(True) ret = graPyspIfc.setComment("this is a comment") self.assertEqual(ret, None) ret = graPyspIfc.setTitle("this is a title") self.assertEqual(ret, None) ret = graPyspIfc.getComment() self.assertEqual(ret, "NoComment") ret = graPyspIfc.getTitle() self.assertEqual(ret, None) graPyspIfc.close() print("testGraPyspIfc.testMisc DONE") return
def test_wsViewPort(self): if utils.getHostname() != 'haso107tk': return print "testIFC.test_wsViewPort" PySpectra.cls() PySpectra.delete() PySpectra.command("setWsViewport DINA4") PySpectra.processEventsLoop(1) PySpectra.command("setWsViewport DINA4P") PySpectra.processEventsLoop(1) PySpectra.command("setWsViewport DINA5") PySpectra.processEventsLoop(1) PySpectra.command("setWsViewport DINA5P") PySpectra.processEventsLoop(1) PySpectra.command("setWsViewport DINA6") PySpectra.processEventsLoop(1) PySpectra.command("setWsViewport DINA6P") PySpectra.processEventsLoop(1) print "testIFC.test_wsViewPort DONE" return
def createPDF(printer=None, fileName=None, flagPrint=False, format='DINA4'): ''' - create a PDF file, the default name is pyspOutput.pdf - a version of the last output file is created - if flagPrint is True, the file is sent to the PRINTER - returns the name of the output file ''' gqeList = PySpectra.getGqeList() if len(gqeList) == 0: return None flag = False if Fig is None: _initGraphic() flag = True setWsViewport(format) cls() display() if fileName is None: fileName = "pyspOutput.pdf" if fileName.find('.pdf') == -1: fileName += ".pdf" if os.path.exists("/usr/local/bin/vrsn"): if os.system("/usr/local/bin/vrsn -s -nolog %s" % fileName): print( "graphics.createPDF: failed to save the current version of %s" % fileName) try: # # the bbox_inches='tight' does not look good, # if there is only one plot on the paper # #Fig.savefig( fileName, bbox_inches='tight') Fig.savefig(fileName) except Exception as e: print("graphics.createPDF: failed to create %s" % fileName) print(repr(e)) return None if flag: cls() close() if flagPrint: if printer is None: printer = os.getenv("PRINTER") if printer is None: if utils.getHostname() != definitions.hostTK: return raise ValueError( "mpl_graphics.createPDF: environment variable PRINTER not defined" ) if os.system("/usr/bin/lpr -P %s %s" % (printer, fileName)): print("mpl_graphics.createPDF: failed to print %s on %s" % (fileName, printer)) else: pass # # it is not clear whether we should print a message here or in the application # # print( "createPDF: printed %s on %s" % (fileName, printer)) return fileName
def testToPyspMonitorSetPixelWorld(self): ''' set the mandelbrot pixel in world coordinates ''' print "testZmqIfc.testToPyspMonitor4" if utils.getHostname() != definitions.hostTK: return hsh = HasyUtils.toPyspMonitor({'command': ['cls', 'delete']}) self.assertEqual(hsh['result'], 'done') hsh = HasyUtils.toPyspMonitor({'command': ['setWsViewport dina5s']}) self.assertEqual(hsh['result'], 'done') # # title: set pixels using world coordinates # hsh = HasyUtils.toPyspMonitor( {'command': ['setTitle "set pixels using world coordinates"']}) self.assertEqual(hsh['result'], 'done') (xmin, xmax) = (-2., -0.5) (ymin, ymax) = (0, 1.5) (width, height) = (50, 50) maxiter = 25 # # create the image # hsh = { 'Image': { 'name': "MandelBrot", 'xMin': xmin, 'xMax': xmax, 'width': width, 'yMin': ymin, 'yMax': ymax, 'height': height } } hsh = HasyUtils.toPyspMonitor(hsh) self.assertEqual(hsh['result'], 'done') # # fill the image, pixel by pixel # r1 = np.linspace(xmin, xmax, width) r2 = np.linspace(ymin, ymax, height) startTime = time.time() for i in range(width): for j in range(height): res = mandelbrot(r1[i] + 1j * r2[j], maxiter) # # Speed: # (50, 50) need 3.9s # (50, 50) need 7s, with testAlive = True # hsh = { 'command': [ 'setPixelWorld MandelBrot %g %g %g' % (r1[i], r2[j], res) ] } hsh = HasyUtils.toPyspMonitor(hsh) self.assertEqual(hsh['result'], 'done') hsh = HasyUtils.toPyspMonitor({'command': ['display']}) self.assertEqual(hsh['result'], 'done') self.assertLess((time.time() - startTime), 5) time.sleep(1) print "testZmqIfc.testToPyspMonitorSetPixelWorld DONE" return
def testToPyspMonitorScan(self): import random print "testZmqIfc.testToPyspMonitor2" if utils.getHostname() != definitions.hostTK: return hsh = HasyUtils.toPyspMonitor({'command': ['cls', 'delete']}) self.assertEqual(hsh['result'], 'done') MAX = 25 pos = np.linspace(0, 10, MAX) d1 = np.random.random_sample((len(pos), )) * 1000. d2 = np.random.random_sample((len(pos), )) * 1000. HasyUtils.toPyspMonitor( {'command': ['setTitle "testing Scan command"']}) self.assertEqual(hsh['result'], 'done') hsh = HasyUtils.toPyspMonitor( {'Scan': { 'name': "d1", 'x': pos, 'y': d1 }}) self.assertEqual(hsh['result'], 'done') hsh = HasyUtils.toPyspMonitor( {'Scan': { 'name': "d2", 'x': pos, 'y': d2 }}) self.assertEqual(hsh['result'], 'done') HasyUtils.toPyspMonitor({'command': ['setComment \"a comment\"']}) self.assertEqual(hsh['result'], 'done') HasyUtils.toPyspMonitor({'command': ['display']}) self.assertEqual(hsh['result'], 'done') time.sleep(1) # # retrieve the data and compare # hsh = HasyUtils.toPyspMonitor({'getData': True}) for i in range(MAX): self.assertEqual(pos[i], hsh['getData']['D1']['x'][i]) self.assertEqual(d1[i], hsh['getData']['D1']['y'][i]) self.assertEqual(d2[i], hsh['getData']['D2']['y'][i]) # # set y-values # HasyUtils.toPyspMonitor( {'command': ['setTitle "set y-values to linear"']}) self.assertEqual(hsh['result'], 'done') for i in range(MAX): HasyUtils.toPyspMonitor( {'command': ['setY d1 %d %g' % (i, float(i) / 10.)]}) HasyUtils.toPyspMonitor({'command': ['cls', 'display']}) self.assertEqual(hsh['result'], 'done') time.sleep(1) print "testZmqIfc.testToPyspMonitorScan DONE" return
def testMoveScanInfo(self): print "testTangoIfc.testMoveScanInfo" if utils.getHostname() != definitions.hostTK: return PySpectra.cls() PySpectra.delete() # # senv ActiveMntGrp mg_pysp # if not utils.runMacro("senv ActiveMntGrp mg_pysp"): print("testTangoIfc.testMoveScanInfo: ruNMacro failed") return # # see, if the pyspMonitor process exists. Otherwise launch it # (status, wasLaunched) = PySpectra.assertPyspMonitorRunning() if not status: print( "testTangoIfc.testMoveScanInfo: failed to launch the pyspMonitor" ) return # # move the motors to good starting points # if not utils.runMacro("umv eh_mot66 50 eh_mot67 12"): print("testTangoIfc.testMoveScanInfo: ruNMacro failed") return # # to the a2scan # if not utils.runMacro("a2scan eh_mot66 50 51 eh_mot67 12 13 40 0.1"): print("testTangoIfc.testMoveScanInfo: ruNMacro failed") return # # the pyspMonitor may still by 'scanning' although # we see that the scan is over. So test 'isAlive' # count = 0 while 1: ret = HasyUtils.toPyspMonitor({'isAlive': True}) if ret['result'] == 'done': break count += 1 time.sleep(0.5) if count > 5: print("testTangoIfc.testMoveScanInfo: isAlive failes") return ret = HasyUtils.toPyspMonitor({'command': 'display sig_gen'}) if ret['result'] != 'done': print( "testTangoIfc.testMoveScanInfo: 'display sig_gen' failed, %s" % repr(ret)) return PySpectra.setTitle("moveStart sig_gen 50.5 False") res = HasyUtils.toPyspMonitor( {'command': 'moveStart sig_gen 50.5 False'}) if res['result'] != 'done': print("testTangoIfc.testMoveScanInfo: moveStart failed failed") return while 1: if HasyUtils.toPyspMonitor({'getDoorState': True})['result'] == 'ON': break time.sleep(0.5) if wasLaunched: print("testTangoIfc.testMoveScanInfo: kill pyspMonitor.py") os.system("kill_proc -f pyspMonitor.py") print "testTangoIfc.testMoveScanInfo DONE" return
def testReUse(self): graPyspIfc.setSpectra(False) graPyspIfc.cls() graPyspIfc.delete() (xMin, xMax, nPts) = (0., 10., 20) x = numpy.linspace(xMin, xMax, nPts) y = numpy.random.random_sample(nPts) rand = graPyspIfc.Scan(name="sinus", lineColor='blue', x=x, y=y, nPts=nPts) graPyspIfc.setComment("using normal update") for i in range(5): rand.y = numpy.random.random_sample(len(x)) graPyspIfc.cls() graPyspIfc.display() PySpectra.processEventsLoop(1) graPyspIfc.setComment("using smart update") graPyspIfc.cls() graPyspIfc.display() for i in range(100): rand.smartUpdateDataAndDisplay(y=numpy.random.random_sample(nPts)) graPyspIfc.setComment("") graPyspIfc.close() if utils.getHostname() != definitions.hostTK: return graPyspIfc.setSpectra(True) graPyspIfc.cls() graPyspIfc.delete() (xMin, xMax, nPts) = (0., 10., 20) x = numpy.linspace(xMin, xMax, nPts) y = numpy.random.random_sample(nPts) rand = graPyspIfc.Scan(name="sinus", lineColor='blue', x=x, y=y, nPts=nPts) for i in range(10): rand.smartUpdateDataAndDisplay(y=numpy.random.random_sample(nPts)) time.sleep(0.5) graPyspIfc.close() return