from pymoku import Moku
from pymoku.instruments import *
import time, logging

logging.basicConfig(format='%(asctime)s:%(name)s:%(levelname)s::%(message)s')
logging.getLogger('pymoku').setLevel(logging.INFO)

# Use Moku.get_by_serial() or get_by_name() if you don't know the IP
m = Moku.get_by_name('example')

i = Oscilloscope()
m.attach_instrument(i)

try:
	i.set_samplerate(10)
	i.set_xmode(OSC_ROLL)
	i.commit()
	i.datalogger_stop()

	i.datalogger_start(start=0, duration=10, use_sd=True, ch1=True, ch2=True, filetype='bin')

	while True:
		time.sleep(1)
		trems, treme = i.datalogger_remaining()
		samples = i.datalogger_samples()
		print("Captured (%d samples); %d seconds from start, %d from end" % (samples, trems, treme))

		if i.datalogger_completed():
			break

	e = i.datalogger_error()

	if e:
		print("Error occured: %s" % e)

	i.datalogger_stop()
	i.datalogger_upload()
except Exception as e:
	print(e)
finally:
	m.close()

from pymoku import Moku
from pymoku.instruments import *
import time, logging

logging.basicConfig(format='%(asctime)s:%(name)s:%(levelname)s::%(message)s')
logging.getLogger('pymoku').setLevel(logging.INFO)

# Use Moku.get_by_serial() or get_by_name() if you don't know the IP
m = Moku('192.168.69.122')#.get_by_name('example')

i = Oscilloscope()
m.attach_instrument(i)

try:
	i.set_samplerate(10)
	i.set_xmode(OSC_ROLL)
	i.commit()
	i.datalogger_stop()

	i.datalogger_start(start=0, duration=10, use_sd=True, ch1=True, ch2=True, filetype='bin')

	while True:
		time.sleep(1)
		trems, treme = i.datalogger_remaining()
		samples = i.datalogger_samples()
		print("Captured (%d samples); %d seconds from start, %d from end" % (samples, trems, treme))

		if i.datalogger_completed():
			break

	e = i.datalogger_error()

	if e:
		print("Error occured: %s" % e)

	i.datalogger_stop()
	i.datalogger_upload()
except Exception as e:
	print(e)
finally:
	m.close()

Make sure the schema gets pulled in as a module
HG-1494: Make sure the schema gets pulled in as a module

  from pymoku import Moku
  from pymoku.instruments import *
  import time, logging
  
  logging.basicConfig(format='%(asctime)s:%(name)s:%(levelname)s::%(message)s')
  logging.getLogger('pymoku').setLevel(logging.INFO)
  
  # Use Moku.get_by_serial() or get_by_name() if you don't know the IP
- m = Moku.get_by_name('example')
+ m = Moku('192.168.69.122')#.get_by_name('example')
  
  i = Oscilloscope()
  m.attach_instrument(i)
  
  try:
  	i.set_samplerate(10)
  	i.set_xmode(OSC_ROLL)
  	i.commit()
  	i.datalogger_stop()
  
  	i.datalogger_start(start=0, duration=10, use_sd=True, ch1=True, ch2=True, filetype='bin')
  
  	while True:
  		time.sleep(1)
  		trems, treme = i.datalogger_remaining()
  		samples = i.datalogger_samples()
  		print("Captured (%d samples); %d seconds from start, %d from end" % (samples, trems, treme))
  
  		if i.datalogger_completed():
  			break
  
  	e = i.datalogger_error()
  
  	if e:
  		print("Error occured: %s" % e)
  
  	i.datalogger_stop()
  	i.datalogger_upload()
  except Exception as e:
  	print(e)
  finally:
  	m.close()
  
Make sure the schema gets pulled in as a module
## Code Before:
from pymoku import Moku
from pymoku.instruments import *
import time, logging

logging.basicConfig(format='%(asctime)s:%(name)s:%(levelname)s::%(message)s')
logging.getLogger('pymoku').setLevel(logging.INFO)

# Use Moku.get_by_serial() or get_by_name() if you don't know the IP
m = Moku.get_by_name('example')

i = Oscilloscope()
m.attach_instrument(i)

try:
	i.set_samplerate(10)
	i.set_xmode(OSC_ROLL)
	i.commit()
	i.datalogger_stop()

	i.datalogger_start(start=0, duration=10, use_sd=True, ch1=True, ch2=True, filetype='bin')

	while True:
		time.sleep(1)
		trems, treme = i.datalogger_remaining()
		samples = i.datalogger_samples()
		print("Captured (%d samples); %d seconds from start, %d from end" % (samples, trems, treme))

		if i.datalogger_completed():
			break

	e = i.datalogger_error()

	if e:
		print("Error occured: %s" % e)

	i.datalogger_stop()
	i.datalogger_upload()
except Exception as e:
	print(e)
finally:
	m.close()

## Instruction:
Make sure the schema gets pulled in as a module
## Code After:
from pymoku import Moku
from pymoku.instruments import *
import time, logging

logging.basicConfig(format='%(asctime)s:%(name)s:%(levelname)s::%(message)s')
logging.getLogger('pymoku').setLevel(logging.INFO)

# Use Moku.get_by_serial() or get_by_name() if you don't know the IP
m = Moku('192.168.69.122')#.get_by_name('example')

i = Oscilloscope()
m.attach_instrument(i)

try:
	i.set_samplerate(10)
	i.set_xmode(OSC_ROLL)
	i.commit()
	i.datalogger_stop()

	i.datalogger_start(start=0, duration=10, use_sd=True, ch1=True, ch2=True, filetype='bin')

	while True:
		time.sleep(1)
		trems, treme = i.datalogger_remaining()
		samples = i.datalogger_samples()
		print("Captured (%d samples); %d seconds from start, %d from end" % (samples, trems, treme))

		if i.datalogger_completed():
			break

	e = i.datalogger_error()

	if e:
		print("Error occured: %s" % e)

	i.datalogger_stop()
	i.datalogger_upload()
except Exception as e:
	print(e)
finally:
	m.close()
