def example_Create56x3Plots(): ''' create 56x3 plots ''' PySpectra.cls() PySpectra.delete() PySpectra.setTitle("56 x 3 Scans") PySpectra.setComment("Display many Scans") PySpectra.setWsViewport("DINA4") for i in range(56): t = PySpectra.Scan(name="t%d_a" % i, lineColor='blue', nPts=200, yLabel='rand') t.y = np.random.random_sample((len(t.x), )) * 1000. t = PySpectra.Scan(name="t%d_b" % i, lineColor='red', nPts=200, yLabel='rand', overlay="t%d_a" % i) t.y = np.random.random_sample((len(t.x), )) * 1000. t = PySpectra.Scan(name="t%d_c" % i, lineColor='green', nPts=200, yLabel='rand', overlay="t%d_a" % i) t.y = np.random.random_sample((len(t.x), )) * 1000. PySpectra.display() return
def testAntiDerivative( self): print "testCalc.testAntiDerivative" PySpectra.cls() PySpectra.delete() scan = PySpectra.Scan( name = "t1", xMin = 0., xMax = 10.0, nPts = 201) scan.y = np.sin( scan.y) with self.assertRaises( ValueError) as context: calc.antiderivative( name = None) #print("testSetXY: %s" % repr( context.exception)) self.assertTrue( "calc.antiderivative: name not specified" in context.exception) with self.assertRaises( ValueError) as context: calc.derivative( name = "notExist") self.assertTrue( "calc.derivative: failed to find notExist" in context.exception) calc.antiderivative( name = scan.name, nameNew = "t1_ad") PySpectra.display() #PySpectra.show() PySpectra.processEventsLoop( 1) print "testCalc.testAntiDerivative, DONE"
def testFillData(self): print "testPySpectra.testFillData" PySpectra.cls() PySpectra.delete() PySpectra.setTitle("scan.setY()") scan = PySpectra.Scan(name='t1', xLabel="up to 200 pts", nPts=201, yMin=-10., yMax=10.) self.assertEqual(scan.currentIndex, 200) #scan.y = np.tan( scan.x) startTime = time.time() for i in range(len(scan.y)): scan.setY(i, math.tan(float(i) / 10)) PySpectra.display() diffTime = time.time() - startTime self.assertLess(diffTime, 12) PySpectra.display() PySpectra.processEventsLoop(1) print "testPySpectra.testFillData, DONE"
def test_createScanByLimit(self): print "testPySpectra.test_createScanByLimit" PySpectra.cls() PySpectra.delete() PySpectra.setTitle("create scan by limits") scan = PySpectra.Scan(name="test1", xMin=0., xMax=1.0, nPts=101, dType=np.float64, at=(2, 2, 3), lineColor='red', lineStyle='solidLine') self.assertEqual(scan.xMin, 0.) self.assertEqual(scan.xMax, 1.) self.assertEqual(scan.nPts, 101) self.assertEqual(scan.dType, np.float64) self.assertEqual(len(scan.x), 101) self.assertEqual(scan.x.dtype, np.float64) self.assertEqual(len(scan.y), 101) self.assertEqual(scan.y.dtype, np.float64) self.assertEqual(scan.lineColor, 'red') PySpectra.display() PySpectra.processEventsLoop(1) print "testPySpectra.test_createScanByLimit DONE"
def testCreateScansByGqes(self): print "testPySpectra.testCreateScansByGqes" PySpectra.cls() PySpectra.delete() PySpectra.setTitle("create scan by putData-gqes") x = np.linspace(0., 10., 100) tan = np.tan(x) sin = np.sin(x) cos = np.cos(x) hsh = { 'putData': { 'gqes': [{ 'x': x, 'y': tan, 'name': 'tan' }, { 'x': x, 'y': cos, 'name': 'cos' }, { 'x': x, 'y': sin, 'name': 'sin', 'showGridY': False, 'symbolColor': 'blue', 'showGridX': True, 'yLog': False, 'symbol': '+', 'xLog': False, 'symbolSize': 5 }] } } PySpectra.toPyspLocal(hsh) lst = PySpectra.getGqeList() self.assertEqual(len(lst), 3) self.assertEqual(lst[0].name, 'tan') self.assertEqual(lst[1].name, 'cos') self.assertEqual(lst[2].name, 'sin') comparison = x == lst[0].x self.assertTrue(comparison.all()) comparison = tan == lst[0].y self.assertTrue(comparison.all()) comparison = cos == lst[1].y self.assertTrue(comparison.all()) comparison = sin == lst[2].y self.assertTrue(comparison.all()) PySpectra.display() PySpectra.processEventsLoop(1) #utils.launchGui() print "testPySpectra.testCreateScansByGqes, DONE"
def test_doty(self): print "testPySpectra.test_doty" PySpectra.cls() PySpectra.delete() PySpectra.setTitle("2 plots, the seconds has doty as the x-axis") scan1 = PySpectra.Scan(name="notdotyscan", xMin=10., xMax=30.0, nPts=101, dType=np.float64, lineColor='red', lineStyle='solidLine') self.assertEqual(scan1.doty, False) scan2 = PySpectra.Scan(name="dotyscan", xMin=10., xMax=30.0, nPts=101, dType=np.float64, doty=True, lineColor='red', lineStyle='solidLine') self.assertEqual(scan2.doty, True) PySpectra.display() PySpectra.processEventsLoop(1) print "testPySpectra.test_doty DONE"
def example_PlotsWithTextContainer(): ''' create 3 scans and a text container ''' PySpectra.cls() PySpectra.delete() PySpectra.setTitle("here could be a title") PySpectra.setComment("this is a comment") PySpectra.setWsViewport("DINA5") textScan = PySpectra.Scan(name="textContainer", textOnly=True) textScan.addText(text="some information", x=0., y=0.95, color='blue') textScan.addText(text="and more infos", x=0., y=0.85, color='blue') t1 = PySpectra.Scan("t1", lineColor='blue', xLabel='Position', yLabel='sin') t1.y = np.sin(t1.x) t2 = PySpectra.Scan("t2", xLabel='Position', yLabel='cos', symbol='o', symbolColor='red', symbolSize=5) t2.y = np.cos(t2.x) t3 = PySpectra.Scan("t3", xLabel='Position', yLabel='tan', symbol='+', lineColor='cyan', symbolColor='green', symbolSize=5) t3.y = np.tan(t3.x) PySpectra.display()
def testFastDisplay_v2( self): ''' version 2: directly use the plotDataItem.setData() function ''' print "testGraphics.testDisplay_v2" PySpectra.cls() PySpectra.delete() scan1 = PySpectra.Scan( name = 't1', nPts = 1000, yMin = -1., yMax = 1.) scan2 = PySpectra.Scan( name = 't2', nPts = 1000, yMin = -1., yMax = 1.) data = np.random.normal(size=(10,1000)) x = np.linspace( 0., 10., 1000) ptr = 0 scan1.x = x scan2.x = x scan1.y = data[0] scan2.y = data[0] PySpectra.display() startTime = time.time() for i in range( 200): scan1.plotDataItem.setData(x, data[ptr%10]) scan2.plotDataItem.setData(x, data[ptr%10]) ptr += 1 PySpectra.processEvents() diffTime = time.time() - startTime self.assertLess( diffTime, 7.) self.assertGreater( diffTime, 1.5) print "testGraphics.testDisplay_v2, DONE"
def example_ImageRandom(): import random PySpectra.setWsViewport('DINA5S') PySpectra.cls() PySpectra.delete() (xmin, xmax) = (-2., 1) (ymin, ymax) = (-1.5, 1.5) (width, height) = (500, 500) r1 = np.linspace(xmin, xmax, width) r2 = np.linspace(ymin, ymax, height) n3 = np.empty((width, height)) for i in range(width): for j in range(height): n3[i, j] = i + random.random() * j + 100. m = PySpectra.Image(name="ImageRandom", data=n3, xMin=xmin, xMax=xmax, width=width, yMin=ymin, yMax=ymax, height=height, xLabel="x-Axis", yLabel="y-Axis") PySpectra.cls() PySpectra.display() return
def example_GaussAndSinusOverlay(): ''' overlay 2 scans ''' PySpectra.cls() PySpectra.delete() PySpectra.setTitle("2 Overlay Scans") PySpectra.setWsViewport("DINA5") g = utils.createGauss(name="gauss", xMin=-5., xMax=5., nPts=101, lineColor='red', x0=0., sigma=1., amplitude=1.) t1 = PySpectra.Scan(name="sinus", lineColor='blue', xMin=-5, xMax=5., yMin=-1.5, yMax=1.5, yLabel='sin') t1.y = np.sin(t1.x) PySpectra.overlay("sinus", "gauss") PySpectra.display()
def example_CreatePDF(): ''' create a pdf file ''' printer = os.getenv("PRINTER") if printer is None: print( "examplecreatePDF: environment variable PRINTER not defined, returning" ) return PySpectra.cls() PySpectra.delete() PySpectra.setTitle("Create PDF file and send it to the printer") PySpectra.setWsViewport("DINA5") scan = PySpectra.Scan(name='PDF Output', nPts=100, xMin=-1., xMax=1., xLabel='Position', yLabel="Counts") scan.y = np.sin(scan.x) PySpectra.setWsViewport("DINA4") PySpectra.display() PySpectra.createPDF(flagPrint=True) return
def testFastDisplay_v1( self): ''' version 1: set the scan data and call display ''' print "testGraphics.testDisplay_v1" PySpectra.cls() PySpectra.delete() scan1 = PySpectra.Scan( name = 't1', nPts = 100, yMin = -1., yMax = 1.) scan2 = PySpectra.Scan( name = 't2', nPts = 100, yMin = -1., yMax = 1.) PySpectra.display() data = np.random.normal(size=(10,100)) x = np.linspace( 0., 10., 100) ptr = 0 scan1.x = x scan2.x = x startTime = time.time() for i in range( 100): PySpectra.cls() scan1.y = data[ptr%10] scan2.y = data[ptr%10] PySpectra.display() ptr += 1 PySpectra.processEvents() diffTime = time.time() - startTime self.assertLess( diffTime, 8.) self.assertGreater( diffTime, 3.) print "testGraphics.testDisplay_v1, DONE"
def testDisplayTwo( self): print "testGraphics.testDisplayTwo" PySpectra.cls() PySpectra.delete() sinus = PySpectra.Scan( name = 'sinus', xMin = 0., xMax = 6.0, nPts = 101, dType = np.float64, lineWidth = 5., lineColor = 'red', lineStyle = 'dashed') sinus.y = np.sin( sinus.y) cosinus = PySpectra.Scan( name = "cosinus", xMin = 0., xMax = 6.0, nPts = 101, dType = np.float64, lineWidth = 3., lineColor = 'blue', lineStyle = 'dotted') cosinus.y = np.cos( cosinus.y) PySpectra.display() #PySpectra.show() PySpectra.processEventsLoop( 1) print "testGraphics.testDisplayTwo, DONE"
def testLissajous( self): ''' ''' print "testGraphics.testLissayous" PySpectra.cls() PySpectra.delete() scan = PySpectra.Scan( name = 'Lissajous', nPts = 1000, xMin = -1., xMax = 1.) x = np.linspace( 0., 6.5, 1000) y = np.linspace( 0., 6.5, 1000) scan.x = np.cos( x) scan.y = np.sin( y) PySpectra.display() startTime = time.time() for i in range( 500): x = x + 0.005 scan.plotDataItem.setData(np.cos( x), np.sin( y)) PySpectra.processEvents() diffTime = time.time() - startTime self.assertLess( diffTime, 20.) print "testGraphics.testLissajous, DONE"
def example_Overlay2FirstLog(): PySpectra.cls() PySpectra.delete() PySpectra.setTitle("2 Overlay Scans, first (red) has log scale") PySpectra.setComment( "Sadly, there are no major tick mark strings at the right axis") PySpectra.setWsViewport("DINA5") g1 = utils.createGauss(name="gauss", xMin=-5., xMax=5., nPts=101, lineColor='red', x0=0., sigma=1., amplitude=1.) g1.yLog = True g2 = utils.createGauss(name="gauss2", xMin=-5., xMax=5., nPts=101, lineColor='green', x0=0.5, sigma=1.2, amplitude=1.) PySpectra.overlay("gauss2", "gauss") PySpectra.display()
def testScanningTwoPlots( self): ''' using setX and setY ''' print "testGraphics.testScanningTwoPlots" PySpectra.cls() PySpectra.delete() PySpectra.setTitle( "two plot, x-axis is not re-scaled") sinus = PySpectra.Scan( name = 'sinus', xMin = 0., xMax = 6.0, nPts = 101, autoscaleX = False, lineColor = 'red') cosinus = PySpectra.Scan( name = 'cosinus', xMin = 0., xMax = 6.0, nPts = 101, autoscaleX = False, lineColor = 'blue') for i in range( sinus.nPts): sinus.setX( i, i/10.) sinus.setY( i, math.sin( i/10.)) cosinus.setX( i, i/10.) cosinus.setY( i, math.cos( i/10.)) PySpectra.display( ['sinus', 'cosinus']) time.sleep( 0.01) print "testGraphics.testScanningTwoPlots, DONE"
def example_GaussManyOverlay(): ''' gauss plot ''' PySpectra.cls() PySpectra.delete() PySpectra.setWsViewport("DINA5") g = PySpectra.Scan(name="gauss", xMin=-10., xMax=10., nPts=101) #mu = 0. #sigma = 1. #g.y = 1/(sigma*np.sqrt(2.*np.pi))*np.exp( -(g.y-mu)**2/(2*sigma**2)) mu1 = 0. sigma1 = 1. mu2 = 6.5 sigma2 = 1.2 g.y = 1./(sigma1*np.sqrt(2.*np.pi))*np.exp( -(g.y-mu1)**2/(2*sigma1**2)) + \ 2./(sigma2*np.sqrt(2.*np.pi))*np.exp( -(g.y-mu2)**2/(2*sigma2**2)) g.autoscaleX = False g.autoscaleY = False g.xMax = 11 g.xMin = -4 g.yMin = 0 g.yMax = 2 for i in range(1, 50): # don't want i == 0 gqe = PySpectra.Scan(name="gauss%d" % i, xMin=-5., xMax=5., nPts=101) gqe.x = g.x + 0.02 * i gqe.y = g.y + 0.02 * i PySpectra.overlay("gauss%d" % i, "gauss") gqe.useTargetWindow = True PySpectra.display() return
def example_Overlay2BothLog(): PySpectra.cls() PySpectra.delete() PySpectra.setTitle("2 Overlay Scans, both with log scale") PySpectra.setComment("both axes have different ranges") PySpectra.setWsViewport("DINA5") g1 = utils.createGauss(name="gauss", xMin=-5., xMax=5., nPts=101, lineColor='red', x0=0., sigma=1., amplitude=1.) g1.yLog = True g2 = utils.createGauss(name="gauss2", xMin=-5., xMax=5., nPts=101, lineColor='green', x0=0.5, sigma=1.2, amplitude=1.) g2.yLog = True g2.yMin = 0.001 g2.yMax = 1. PySpectra.overlay("gauss2", "gauss") PySpectra.display()
def test_read(self): print "testPySpectra.test_read" PySpectra.cls() PySpectra.delete() PySpectra.setTitle("the graphics window should contain 24 plots") PySpectra.read("%s/test/data/ti_au_tio2_sio2_kat55a_0001.fio" % pySpectraPath) lst = PySpectra.getGqeList() self.assertEqual(len(lst), 24) self.assertEqual(lst[0].name, "TI_AU_TIO2_SIO2_KAT55A_0001") self.assertEqual(lst[1].name, "TI_AU_TIO2_SIO2_KAT55A_0001_RING") PySpectra.display() PySpectra.processEventsLoop(1) PySpectra.cls() PySpectra.delete() PySpectra.setTitle("the graphics window should contain 4 plots") PySpectra.read("%s/test/data/SPLITTER_PXE_BL_22_2.dat" % pySpectraPath) lst = PySpectra.getGqeList() self.assertEqual(len(lst), 4) self.assertEqual(lst[0].name, "scan1") self.assertEqual(lst[1].name, "scan2") self.assertEqual(lst[2].name, "scan3") self.assertEqual(lst[3].name, "scan4") PySpectra.display() PySpectra.processEventsLoop(1) print "testPySpectra.test_read DONE"
def example_ImageMB(): PySpectra.setWsViewport('DINA5S') PySpectra.cls() PySpectra.delete() (xmin, xmax) = (-2., 0.5) (ymin, ymax) = (-1.25, 1.25) (width, height) = (750, 750) maxiter = 512 m = PySpectra.Image(name="MandelbrotSet", flagAxes=True, maxIter=maxiter, xMin=xmin, xMax=xmax, width=width, yMin=ymin, yMax=ymax, height=height) m.flagZoomMbSlow = False m.zoomMb() PySpectra.cls() PySpectra.display() return
def testYToMinusY( self): print "testCalc.testYToMinusY" PySpectra.cls() PySpectra.delete() scan = PySpectra.Scan( name = "t1", xMin = 2., xMax = 10.0, nPts = 201) scan.y = np.sin( scan.y) with self.assertRaises( ValueError) as context: calc.yToMinusY( name = None) #print("testSetXY: %s" % repr( context.exception)) self.assertTrue( "calc.yToMinusY: name not specified" in context.exception) with self.assertRaises( ValueError) as context: calc.yToMinusY( name = "notExist") #print("testSetXY: %s" % repr( context.exception)) self.assertTrue( "calc.yToMinusY: failed to find notExist" in context.exception) scanMY = calc.yToMinusY( name = scan.name, nameNew = "t1_y2MinusY") self.assertEqual( len( scan.y), len( scanMY.y)) self.assertEqual( len( scan.x), len( scanMY.x)) for i in range( len( scan.y)): self.assertEqual( scan.y[i], - scanMY.y[i]) self.assertEqual( scan.x[i], scanMY.x[i]) PySpectra.display() #PySpectra.show() PySpectra.processEventsLoop( 1) print "testCalc.testYToMinusY, DONE"
def testClose( self): ''' ''' print "testGraphics.testClose" PySpectra.cls() PySpectra.delete() PySpectra.setTitle( "testing close()") sinus = PySpectra.Scan( name = 'sinus', xMin = 0., xMax = 6.0, nPts = 101, lineColor = 'red', doty = True) sinus.y = np.sin( sinus.y) PySpectra.display() PySpectra.processEventsLoop( 1) PySpectra.close() PySpectra.cls() PySpectra.delete() PySpectra.setTitle( "testing close(), again") sinus = PySpectra.Scan( name = 'sinus', xMin = 0., xMax = 6.0, nPts = 101, lineColor = 'red', doty = True) sinus.y = np.sin( sinus.y) PySpectra.display() PySpectra.processEventsLoop( 1) print "testGraphics.testClose, DONE"
def example_OverlayDoty(): ''' create 2 overlaid scans ''' PySpectra.cls() PySpectra.delete() PySpectra.setTitle("2 Overlay scans, x-axis tick labels show date") PySpectra.setWsViewport("DINA5") t1 = PySpectra.Scan(name="t1", xMin=0, xMax=10, nPts=101, lineColor='blue', xLabel='Position', yLabel='sin', doty=True) t1.y = np.sin(t1.x) t2 = PySpectra.Scan("t2", xLabel='Position', yLabel='cos', xMin=0, xMax=10, nPts=101, lineColor='green', doty=True) t2.y = np.cos(t2.x) t2.overlay = "t1" PySpectra.display()
def createHardCopy(printer=None, flagPrint=False, format='DINA4'): ''' create postscript/pdf file and send it to the printer ''' fName = None if spectraInstalled and useSpectra: Spectra.gra_command(" set 0.1/border=1") if flagPrint: if printer is None: raise ValueError( "graPyspIfc.createHardCopy: flagPrint == True but no printer" ) Spectra.gra_command( " postscript/%s/redisplay/nolog/nocon/print/lp=%s" % (format, printer)) else: Spectra.gra_command(" postscript/%s/redisplay/nolog/nocon/print" % (format)) Spectra.gra_command(" set 0.1/border=0") Spectra.gra_command(" postscript/redisplay/nolog/nocon/print/lp=%s" % printer) else: fName = PySpectra.createPDF(flagPrint=flagPrint, format=format) # # necessary to bring pqt and mpl again in-sync, mind lastIndex # PySpectra.cls() PySpectra.display() return fName
def testMisc(self): print "testPySpectra.testMisc" PySpectra.cls() PySpectra.delete() t1 = PySpectra.Scan(name="t1", xMin=0., xMax=5., nPts=101, color='red', at="(1,2,1)") t2 = PySpectra.Scan(name="t2", xMin=0., xMax=5., nPts=101, at=(1, 2, 2)) PySpectra.display() lst = PySpectra.getDisplayList() self.assertEqual(t1.getTotalCounts(), 252.5) self.assertTrue(len(lst) == 2) self.assertTrue(PySpectra.info() == 2) self.assertTrue(PySpectra.getIndex('t1') == 0) self.assertEqual(t1.at[0], 1) self.assertEqual(t1.at[1], 2) self.assertEqual(t1.at[2], 1) self.assertEqual(t2.at[0], 1) self.assertEqual(t2.at[1], 2) self.assertEqual(t2.at[2], 2) self.assertEqual(t1.lineColor, 'red') with self.assertRaises(ValueError) as context: t1.getX(102) #print repr( context.exception) self.assertTrue('GQE.Scan.getX: t1, index 102 out of range [0, 101]' in context.exception) with self.assertRaises(ValueError) as context: t1.getX(-1) #print repr( context.exception) self.assertTrue('GQE.Scan.getX: t1, index -1 < 0' in context.exception) with self.assertRaises(ValueError) as context: t1.getY(102) #print repr( context.exception) self.assertTrue('GQE.Scan.getY: t1, index 102 out of range [0, 101]' in context.exception) with self.assertRaises(ValueError) as context: t1.getY(-1) #print repr( context.exception) self.assertTrue('GQE.Scan.getY: t1, index -1 < 0' in context.exception) return
def exampleImageMBVia_toPyspLocal_OneChunk(): ''' this examples simulates the toPyspMonitor() interface replace PySpectra.toPyspLocal() with HasyUtils.toPyspMonitor() to connect to pyspMonitor.py ''' print("toPyspLocal_OneChunk") PySpectra.setWsViewport('DINA5S') PySpectra.cls() PySpectra.delete() (xmin, xmax) = (-2., 1.0) (ymin, ymax) = (-1.5, 1.5) (width, height) = (500, 500) maxiter = 128 # # do the clean-up before we start # hsh = PySpectra.toPyspLocal( {'command': ['delete', 'setWsViewport DINA5S', 'cls']}) if hsh['result'] != "done": print("error from ['delete', 'setWsViewport DINA5S', 'cls']") return # # fill the image, pixel by pixel # r1 = np.linspace(xmin, xmax, width) r2 = np.linspace(ymin, ymax, height) #data = np.ndarray( (width, height), np.int32) 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) PySpectra.toPyspLocal({ 'putData': { 'images': [{ 'name': "Mandelbrot", 'data': data, 'xMin': xmin, 'xMax': xmax, 'yMin': ymin, 'yMax': ymax }] } }) PySpectra.cls() PySpectra.display() print("toPyspLocal_OneChunk DONE") return
def _display(line): ''' display display <nameGqe> ... ''' lst = None if line is not None: if len(line) > 0: lst = line.split(' ') PySpectra.display(lst) return "done"
def testOverlay( self): print "testGraphics.testOverlay" PySpectra.cls() PySpectra.delete() sinus = PySpectra.Scan( name = 'sinus', xMin = 0., xMax = 6.0, nPts = 101, dType = np.float64, lineWidth = 5., lineColor = 'red', lineStyle = 'dashed') sinus.y = np.sin( sinus.y) tan = PySpectra.Scan( name = 'tangens', xMin = 0., xMax = 6.0, nPts = 101, dType = np.float64, lineWidth = 2., lineColor = 'green', lineStyle = 'dashed') tan.y = np.tan( tan.y) # # cosinus has to be plotted in the same viewport as sinus # cosinus = PySpectra.Scan( name = "cosinus", xMin = 0., xMax = 6.0, nPts = 101, dType = np.float64, lineWidth = 3., lineColor = 'blue', overlay = "sinus", lineStyle = 'dotted') self.assertEqual( cosinus.overlay, 'sinus') cosinus.y = np.cos( cosinus.y) # # cossquare has to be plotted in the same viewport as tangens # cossquare = PySpectra.Scan( name = "cossquare", xMin = 0., xMax = 6.0, nPts = 101, dType = np.float64, yMin = -5, yMax = 5., lineWidth = 1., overlay = 'tangens', lineColor = 'blue', lineStyle = 'dotted') self.assertEqual( cossquare.overlay, 'tangens') cossquare.y = np.cos( tan.x) * np.cos( tan.x) PySpectra.display() #PySpectra.show() PySpectra.processEventsLoop( 1) print "testGraphics.testOverlay, DONE"
def main(): t1 = pysp.Scan( name = "t1", color = 'blue', yLabel = 'sin') t1.y = np.sin( t1.x) t1.currentIndex = 10 t2 = pysp.Scan( name = "t2", color = 'blue', yLabel = 'rand') t2.y = np.random.random_sample( (len( t2.x), )) for i in range( 10, len( t1.x)): t1.currentIndex = i pysp.display() t2.y = np.random.random_sample( (len( t2.x), )) t2.lastIndex = 0 pysp.processEventsLoop()
def example_LogXScale(): PySpectra.cls() PySpectra.delete() PySpectra.setWsViewport("DINA5") PySpectra.setTitle("log x-scale") t1 = PySpectra.Scan(name="t1", xMin=0.01, xMax=100., nPts=101, lineColor='blue', xLabel='Position', yLabel='signal', yLog=False, xLog=True) PySpectra.display()