Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def session():
with nidmm.Session('FakeDevice', False, True, 'Simulate=1, DriverSetup=Model:4082; BoardType:PXIe') as simulated_session:
yield simulated_session
def test_error_message():
try:
# We pass in an invalid model name to force going to error_message
with nidmm.Session('FakeDevice', False, True, 'Simulate=1, DriverSetup=Model:invalid_model; BoardType:PXIe'):
assert False
except nidmm.Error as e:
assert e.code == -1074134964
assert e.description.find('The option string parameter contains an entry with an unknown option value.') != -1
def session():
with nidmm.Session('FakeDevice', False, True, 'Simulate=1, DriverSetup=Model:4082; BoardType:PXIe') as simulated_session:
yield simulated_session
def example(resource_name, options, function, range, points, rate):
with nidmm.Session(resource_name=resource_name, options=options) as session:
session.configure_waveform_acquisition(measurement_function=nidmm.Function[function], range=range, rate=rate, waveform_points=points)
with session.initiate():
while True:
time.sleep(0.1)
backlog, acquisition_state = session.read_status()
if acquisition_state == nidmm.AcquisitionStatus.FINISHED_WITH_NO_BACKLOG:
break
measurements = session.fetch_waveform(array_size=backlog)
print(measurements)
def example(resource_name, option_string, function, range, digits):
with nidmm.Session(resource_name=resource_name, options=option_string) as session:
session.configure_measurement_digits(measurement_function=nidmm.Function[function], range=range, resolution_digits=digits)
print(session.read())
def example(resource_name, options, function, range, digits, samples, triggers):
with nidmm.Session(resource_name=resource_name, options=options) as session:
session.configure_measurement_digits(measurement_function=nidmm.Function[function], range=range, resolution_digits=digits)
session.configure_multi_point(trigger_count=triggers, sample_count=samples)
measurements = session.read_multi_point(array_size=samples)
print('Measurements: ', measurements)