def dsosettings(): global dsobench message = [] rnge = request.args.get('rnge') scal = request.args.get('scal') ofset = request.args.get('ofset') stat = DSO.channel1(dsobench, action=['Set', 'DC', rnge, scal, ofset, 'Volt', 'OFF']) message += ['CHANNEL 1: %s <%s>' %(stat[1], stat[0])] rnge2 = request.args.get('rnge2') scal2 = request.args.get('scal2') ofset2 = request.args.get('ofset2') stat = DSO.channel2(dsobench, action=['Set', 'DC', rnge2, scal2, ofset2, 'Volt', 'OFF']) message += ['CHANNEL 2: %s <%s>' %(stat[1], stat[0])] trnge = request.args.get('trnge') tdelay = request.args.get('tdelay') tscal = request.args.get('tscal') stat = DSO.timebase(dsobench, action=['Set', 'NORMAL', trnge + 'ns', tdelay + 'ns', tscal + 'ns']) message += ['TIMEBASE: %s <%s>' %(stat[1], stat[0])] avenum = request.args.get('avenum') stat = DSO.acquiredata(dsobench, action=['Set', 'average', '100', avenum]) message += ['ACQUIRE DATA: %s <%s>' %(stat[1], stat[0])] # Generate Figure DSO.waveform(dsobench, action=['Set', 'max', 'channel1', 'ascii', '?', '?']) # "error: undefined header" will appear #this will light up channel1:display ans = list(DSO.waveform(dsobench))[1] y, dx = ans['DATA'], float(ans['XINCrement']) unitY = list(DSO.channel1(dsobench))[1]["UNITs"] DSO.display2D(dx, y, units=['s', unitY], channel=1) #Figure will be in static/img DSO.waveform(dsobench, action=['Set', 'max', 'channel2', 'ascii', '?', '?']) # "error: undefined header" will appear #this will light up channel1:display ans = list(DSO.waveform(dsobench))[1] y, dx = ans['DATA'], float(ans['XINCrement']) unitY = list(DSO.channel2(dsobench))[1]["UNITs"] DSO.display2D(dx, y, units=['s', unitY], channel=2) #Figure will be in static/img return jsonify(message=message)
def dsoabout(): global dsobench message = [] status = DSO.model(dsobench) # model message += ['Model: %s (%s)' % (status[1], status[0])] status = DSO.channel1(dsobench) # channel 1 message += ['Channel 1: %s (%s)' % (status[1], status[0])] status = DSO.channel2(dsobench) # channel 2 message += ['Channel 2: %s (%s)' % (status[1], status[0])] status = DSO.timebase(dsobench) # timebase message += ['Timebase: %s (%s)' % (status[1], status[0])] status = DSO.acquiredata(dsobench) # acquire data message += ['Acquisition of Data: %s (%s)' % (status[1], status[0])] return jsonify(message=message)