Beispiel #1
0
        time = time[0:600:1]

    # See if we should use a different time axis
#    if (time[599] < 1e-3):
#        time = time * 1e6
#        tUnit = "uS"
#    elif (time[599] < 1):
#        time = time * 1e3
#        tUnit = "mS"
#    else:
#        tUnit = "S"
    return [time, data]


# Initialize our scope
test = instrument.RigolScope("/dev/usbtmc0")

plot.ion()

while 1:
    t1, d1 = getChannelData(1)
    t2, d2 = getChannelData(2)

    # Start data acquisition again, and put the scope back in local mode
    test.write(":KEY:FORC")

    # Plot the data
    plot.clf()
    plot.plot(t1, d1)
    plot.plot(t2, d2)
    plot.title("Oscilloscope data")
Beispiel #2
0
                                       1)).astype(int)))[1:-1].split(',')),
            state='readonly')
        self.spbox.grid(row=1, columnspan=2)
        Button(self, text=text[1], command=self.submit).grid(column=0, row=2)
        Button(self, text='Cancel', command=self.canc).grid(column=1, row=2)

    def submit(self):
        self.avgnr = self.spbox.get().strip()
        menu.set_avgs(num=self.avgnr)
        self.destroy()

    def canc(self):
        self.destroy()


while True:
    try:
        osc = instrument.RigolScope('/dev/usbtmc1')
    except:
        print('No device connected.')
        input('Connect device and press Enter.(Or press Ctrl+C to exit)')
    else:
        break

root = Tk()
root.geometry('1000x800')
root.columnconfigure(0, weight=1)
root.columnconfigure(1, weight=1)
menu = LeftSide(master=root)
root.mainloop()
Beispiel #3
0
#!/usr/bin/python
import numpy
import matplotlib.pyplot as plot

import instrument
""" Example program to plot the Y-T data from Channel 1"""

# Initialize our scope
test = instrument.RigolScope("/dev/ttyUSB0")

# Stop data acquisition
test.write(":STOP")

# Grab the data from channel 1
test.write(":WAV:POIN:MODE NOR")

test.write(":WAV:DATA? CHAN1")
rawdata = test.read(9000)
data = numpy.frombuffer(rawdata, 'B')

# Get the voltage scale
test.write(":CHAN1:SCAL?")
voltscale = float(test.read(20))

# And the voltage offset
test.write(":CHAN1:OFFS?")
voltoffset = float(test.read(20))

# Walk through the data, and map it to actual voltages
# First invert the data (ya rly)
data = data * -1 + 255
Beispiel #4
0
def array2hex(b):
    return ''.join('{:02x} '.format(x) for x in b).upper()


def array2buf(b):
    bb = ""

    for i in range(len(b)):
        bb += chr(b[i])

    return bb


# Initialize our scope
test = instrument.RigolScope(SCOPE_PORT)
ser = serial.Serial(COM_PORT, BAUDRATE, timeout=5)

print "Recording ... "

# Prepare data acquisition
test.stop()
test.single()

while not test.running:
    print "."

# Trigger SaM
tv_s = [
    0x82, 0x96, 0x9e, 0xc8, 0xf5, 0xea, 0xba, 0x45, 0x16, 0x68, 0x9e, 0xf6,
    0xd9, 0x6b, 0x7c, 0x8d, 0x64, 0x33, 0x44, 0xcb, 0x5, 0xae, 0x45, 0x58,