The following demo script creates two SCAN GQEs: sinus and cosinus. They are repeatedly displayed while they are filled with data.
#!/usr/bin/env python
import Spectra
import math, time
START = 0.
STOP = 10.
NP = 101
sin = Spectra.SCAN( name = "Sinus", start = START, stop = STOP, np = NP, at = "(1,2,1)",
title = 'A Title',
colour = 2, xlabel = 'Angle', ylabel = 'sinus', date = True,
comment = 'nice curve')
cos = Spectra.SCAN( name = "Cosinus", start = START, stop = STOP, np = NP, at = "(1,2,2)",
title = 'Another Title',
colour = 4, xlabel = 'Angle', ylabel = 'cosinus', date = True,
comment = 'another nice curve')
delta = (STOP - START)/(NP - 1)
x = 0
for i in range( NP):
sin.setX( i, x)
sin.setY( i, math.sin( x))
cos.setX( i, x)
cos.setY( i, math.cos( x))
x += delta
Spectra.gra_command( "autoscale/y")
Spectra.gra_display()
time.sleep(0.1)
(sts, result) = Spectra.gra_yesno( "Enter Spectra")
if result == 1:
Spectra.gra_input()