### driver_setup Source: https://github.com/ni/nimi-python/blob/master/docs/nidigital/nidigital.md Gets or sets the driver setup property for the session. ```APIDOC ## driver_setup ### Description Gets or sets the driver setup property. ### Property `nidigital.Session.driver_setup` ``` -------------------------------- ### Run NIDC Power Example Script Source: https://github.com/ni/nimi-python/blob/master/docs/nidcpower/examples.md This snippet shows how to execute a NIDC Power example script with specific command-line options for simulation and driver setup. ```python import pytest from _nidcpower_lcr_source_ac_voltage import main as _main def test_main(): cmd_line = ['--option-string', 'Simulate=1, DriverSetup=Model:4190; BoardType:PXIe', ] _main(cmd_line) if __name__ == '__main__': main() ``` -------------------------------- ### Basic nidcpower Usage Example Source: https://github.com/ni/nimi-python/blob/master/docs/nidcpower/nidcpower.md Opens a session to a Source Meter Unit, configures measurement settings, and performs measurements. Requires the NI-DCPower runtime and the nidcpower module to be installed. ```python import nidcpower # Configure the session. with nidcpower.Session(resource_name='PXI1Slot2/0') as session: session.measure_record_length = 20 session.measure_record_length_is_finite = True session.measure_when = nidcpower.MeasureWhen.AUTOMATICALLY_AFTER_SOURCE_COMPLETE session.voltage_level = 5.0 session.commit() print('Effective measurement rate: {} S/s'.format(session.measure_record_delta_time / 1)) samples_acquired = 0 print('Channel Num Voltage Current In Compliance') row_format = '{0:15} {1:3d} {2:8.6f} {3:8.6f} {4}' with session.initiate(): channel_indices = '0-{}'.format(session.channel_count - 1) channels = session.get_channel_names(channel_indices) for i, channel_name in enumerate(channels): samples_acquired = 0 while samples_acquired < 20: measurements = session.channels[channel_name].fetch_multiple(count=session.fetch_backlog) samples_acquired += len(measurements) for i in range(len(measurements)): print(row_format.format(channel_name, i, measurements[i].voltage, measurements[i].current, measurements[i].in_compliance)) ``` -------------------------------- ### Burst Pattern with Start Trigger Source: https://github.com/ni/nimi-python/blob/master/docs/nidigital/examples.md This example demonstrates how to configure a session to burst a digital pattern, optionally using an external digital edge trigger to start the burst. It loads pin maps, specifications, levels, timing, and pattern files. The session is configured to disconnect all channels upon completion. ```Python #!/usr/bin/python import argparse import nidigital import os import sys def example(resource_name, options, trigger_source=None, trigger_edge=None): with nidigital.Session(resource_name=resource_name, options=options) as session: dir = os.path.join(os.path.dirname(__file__)) # Load the pin map (.pinmap) created using the Digital Pattern Editor pin_map_filename = os.path.join(dir, 'PinMap.pinmap') session.load_pin_map(pin_map_filename) # Load the specifications (.specs), levels (.digilevels), and timing (.digitiming) sheets created using the Digital Pattern Editor spec_filename = os.path.join(dir, 'Specifications.specs') levels_filename = os.path.join(dir, 'PinLevels.digilevels') timing_filename = os.path.join(dir, 'Timing.digitiming') session.load_specifications_levels_and_timing(spec_filename, levels_filename, timing_filename) # Apply the settings from the levels and timing sheets we just loaded to the session session.apply_levels_and_timing(levels_filename, timing_filename) # Loading the pattern file (.digipat) created using the Digital Pattern Editor pattern_filename = os.path.join(dir, 'Pattern.digipat') session.load_pattern(pattern_filename) if trigger_source is None: print('Start bursting pattern') else: # Specify a source and edge for the external start trigger session.start_trigger_type = nidigital.TriggerType.DIGITAL_EDGE session.digital_edge_start_trigger_source = trigger_source session.digital_edge_start_trigger_edge = nidigital.DigitalEdge.RISING if trigger_edge == 'Rising' else nidigital.DigitalEdge.FALLING print('Wait for start trigger and then start bursting pattern') # If start trigger is configured, waiting for the trigger to start bursting and then blocks until the pattern is done bursting # Else just start bursting and block until the pattern is done bursting session.burst_pattern(start_label='new_pattern') # Disconnect all channels using programmable onboard switching session.selected_function = nidigital.SelectedFunction.DISCONNECT print('Done bursting pattern') def _main(argsv): parser = argparse.ArgumentParser(description='Demonstrates how to create and configure a session that bursts a pattern on the digital pattern instrument using a start trigger', formatter_class=argparse.ArgumentDefaultsHelpFormatter) parser.add_argument('-n', '--resource-name', default='PXI1Slot2,PXI1Slot3', help='Resource name of a NI digital pattern instrument. Ensure the resource name matches the instrument name in the pinmap file.') parser.add_argument('-s', '--simulate', default='True', choices=['True', 'False'], help='Whether to run on simulated hardware or real hardware') subparser = parser.add_subparsers(dest='command', help='Sub-command help') start_trigger = subparser.add_parser('start-trigger', help='Configure start trigger') start_trigger.add_argument('-ts', '--trigger-source', default='/PXI1Slot2/PXI_Trig0', help='Source terminal for the start trigger') start_trigger.add_argument('-te', '--trigger-edge', default='Rising', choices=['Rising', 'Falling'], help='Trigger on rising edge or falling edge of start trigger') args = parser.parse_args(argsv) example(args.resource_name, 'Simulate=1, DriverSetup=Model:6571' if args.simulate == 'True' else '', args.trigger_source if args.command == 'start-trigger' else None, args.trigger_edge if args.command == 'start-trigger' else None) def main(): _main(sys.argv[1:]) def test_main(): _main([]) _main(['start-trigger']) def test_example(): resource_name = 'PXI1Slot2,PXI1Slot3' options = {'simulate': True, 'driver_setup': {'Model': '6571'}, } example(resource_name, options) trigger_source = '/PXI1Slot2/PXI_Trig0' trigger_edge = 'Rising' example(resource_name, options, trigger_source, trigger_edge) if __name__ == '__main__': main() ``` -------------------------------- ### Run Main Example with Command Line Arguments Source: https://github.com/ni/nimi-python/blob/master/docs/nidcpower/examples.md Executes the main example function with simulated device options provided via command-line arguments. ```python def test_main(): cmd_line = ['--option-string', 'Simulate=1, DriverSetup=Model:4051; BoardType:PXIe', ] _main(cmd_line) ``` -------------------------------- ### nidigital.Session.start_label Source: https://github.com/ni/nimi-python/blob/master/docs/nidigital/nidigital.md Gets or sets the start label for the sequencer. ```APIDOC ## nidigital.Session.start_label ### Description Gets or sets the start label for the sequencer. ### Method Not specified (assumed to be a method call on a Session object) ### Endpoint Not applicable (Python method) ### Parameters * **label** (string) - Optional - The label to set. If not provided, the current start label is returned. ### Request Example ```python session.start_label("START_SEQ") ``` ### Response * **label** (string) - The start label. ``` -------------------------------- ### Driver Setup Source: https://github.com/ni/nimi-python/blob/master/docs/nidmm/nifgen.md Configures the driver setup. This property is part of the nifgen.Session object. ```APIDOC ## nifgen.Session.driver_setup ### Description Gets or sets the driver setup. ### Method ``` Session.driver_setup ``` ### Parameters None ### Returns (str) The driver setup configuration. ``` -------------------------------- ### Advanced Sequence Example Source: https://github.com/ni/nimi-python/blob/master/docs/nidcpower/examples.md This example demonstrates how to create and execute an advanced sequence with ramping voltage and current. It configures the session for sequencing, defines voltage and current steps, and fetches measurements. ```Python #!/usr/bin/python import argparse import hightime import nidcpower import sys def example(resource_name, options, voltage_max, current_max, points_per_output_function, source_delay): with nidcpower.Session(resource_name=resource_name, options=options) as session: # Configure the session. session.source_mode = nidcpower.SourceMode.SEQUENCE session.voltage_level_autorange = True session.current_limit_autorange = True session.source_delay = hightime.timedelta(seconds=source_delay) properties_used = ['output_function', 'voltage_level', 'current_level'] session.create_advanced_sequence(sequence_name='my_sequence', property_names=properties_used, set_as_active_sequence=True) voltage_per_step = voltage_max / points_per_output_function for i in range(points_per_output_function): session.create_advanced_sequence_step(set_as_active_step=False) session.output_function = nidcpower.OutputFunction.DC_VOLTAGE session.voltage_level = voltage_per_step * i current_per_step = current_max / points_per_output_function for i in range(points_per_output_function): session.create_advanced_sequence_step(set_as_active_step=False) session.output_function = nidcpower.OutputFunction.DC_CURRENT session.current_level = current_per_step * i # Calculate the timeout. aperture_time = session.aperture_time total_points = points_per_output_function * 2 timeout = hightime.timedelta(seconds=((source_delay + aperture_time) * total_points + 1.0)) with session.initiate(): channel_indices = f'0-{session.channel_count - 1}' channels = session.get_channel_names(channel_indices) measurement_group = [session.channels[name].fetch_multiple(total_points, timeout=timeout) for name in channels] session.delete_advanced_sequence(sequence_name='my_sequence') line_format = '{:<15} {:<4} {:<10} {:<10} {:<6}' print(line_format.format('Channel', 'Num', 'Voltage', 'Current', 'In Compliance')) for i, measurements in enumerate(measurement_group): num = 0 channel_name = channels[i].strip() for measurement in measurements: print(line_format.format(channel_name, num, measurement.voltage, measurement.current, str(measurement.in_compliance))) num += 1 def _main(argsv): parser = argparse.ArgumentParser(description='Output ramping voltage to voltage max, then ramping current to current max.', formatter_class=argparse.ArgumentDefaultsHelpFormatter) parser.add_argument('-n', '--resource-name', default='PXI1Slot2/0, PXI1Slot3/0-1', help='Resource names of NI SMUs.') parser.add_argument('-s', '--number-steps', default=256, type=int, help='Number of steps per output function') parser.add_argument('-v', '--voltage-max', default=1.0, type=float, help='Maximum voltage (V)') parser.add_argument('-i', '--current-max', default=0.001, type=float, help='Maximum Current (I)') parser.add_argument('-d', '--delay', default=0.05, type=float, help='Source delay (s)') parser.add_argument('-op', '--option-string', default='', type=str, help='Option String') args = parser.parse_args(argsv) example(args.resource_name, args.option_string, args.voltage_max, args.current_max, args.number_steps, args.delay) def main(): _main(sys.argv[1:]) def test_main(): cmd_line = ['--option-string', 'Simulate=1, DriverSetup=Model:4162; BoardType:PXIe', ] _main(cmd_line) def test_example(): options = {'simulate': True, 'driver_setup': {'Model': '4162', 'BoardType': 'PXIe', }, } example('PXI1Slot2/0, PXI1Slot3/1', options, 1.0, 0.001, 256, 0.05) if __name__ == '__main__': main() ``` -------------------------------- ### NI-Digital Examples Source: https://github.com/ni/nimi-python/blob/master/docs/nidcpower/nidigital.md This section provides links to example Python scripts demonstrating various functionalities of the NI-Digital driver. ```APIDOC ## Example Scripts The following example scripts are available to demonstrate the usage of the NI-Digital driver: - `nidigital_burst_with_start_trigger.py`: Demonstrates burst generation with a start trigger. - `nidigital_configure_time_set_and_voltage_levels.py`: Shows how to configure time sets and voltage levels. - `nidigital_ppmu_source_and_measure.py`: Illustrates sourcing and measuring with the PxPmu module. ``` -------------------------------- ### Install nidcpower Module Source: https://github.com/ni/nimi-python/blob/master/docs/nidcpower/nidcpower.md Install the nidcpower Python module using pip. Ensure the NI-DCPower runtime is installed as a prerequisite. ```bash $ python -m pip install nidcpower ``` -------------------------------- ### niswitch.Session.driver_setup Source: https://github.com/ni/nimi-python/blob/master/docs/niswitch/class.md Indicates the Driver Setup string specified during driver initialization. This property is read-only and returns an empty string if no Driver Setup string is provided. ```APIDOC ## niswitch.Session.driver_setup ### Description This property indicates the Driver Setup string that the user specified when initializing the driver. It is useful for specifying instrument driver options at initialization time, such as selecting a particular instrument model or using simulation. If the user does not specify a Driver Setup string, this property returns an empty string. ### Permissions read only ### Datatype str ``` -------------------------------- ### Synchronize Multiple Digitizers with a Trigger Source: https://github.com/ni/nimi-python/blob/master/docs/nitclk/examples.md This example synchronizes two NI digitizers to a common trigger. It configures vertical and horizontal timing, sets up homogeneous triggers, synchronizes the sessions, and initiates acquisition. A software trigger is then sent to start data capture, and waveforms are fetched from one of the digitizers. ```python import argparse import niscope import nitclk import sys import time def example(resource_name1, resource_name2, options): with niscope.Session(resource_name=resource_name1, options=options) as session1, niscope.Session(resource_name=resource_name2, options=options) as session2: session_list = [session1, session2] for session in session_list: session.configure_vertical(range=1.0, coupling=niscope.VerticalCoupling.DC) session.configure_horizontal_timing(min_sample_rate=50000000, min_num_pts=1000, ref_position=50.0, num_records=1, enforce_realtime=True) session1.trigger_type = niscope.TriggerType.SOFTWARE nitclk.configure_for_homogeneous_triggers(session_list) nitclk.synchronize(session_list, 200e-9) nitclk.initiate(session_list) time.sleep(100) session1.send_software_trigger_edge(niscope.WhichTrigger.START) waveforms = session2.channels[0].fetch(num_samples=1000) for i in range(len(waveforms)): print(f'Waveform {i} information:') print(str(waveforms[i]) + '\n\n') def _main(argsv): parser = argparse.ArgumentParser(description='Synchronizes multiple instruments to one trigger.', formatter_class=argparse.ArgumentDefaultsHelpFormatter) parser.add_argument('-n1', '--resource-name1', default='PXI1Slot2', help='Resource name of a NI Digitizer') parser.add_argument('-n2', '--resource-name2', default='PXI1Slot3', help='Resource name of a NI Digitizer') parser.add_argument('-op', '--option-string', default='', type=str, help='Option string') args = parser.parse_args(argsv) example(args.resource_name1, args.resource_name2, args.option_string) def main(): _main(sys.argv[1:]) def test_example(): options = {'simulate': True, 'driver_setup': {'Model': '5164', 'BoardType': 'PXIe', }, } example('PXI1Slot2', 'PXI1Slot13', options) def test_main(): cmd_line = ['--option-string', 'Simulate=1, DriverSetup=Model:5164; BoardType:PXIe', ] _main(cmd_line) if __name__ == '__main__': main() ``` -------------------------------- ### nimodinst.Session Usage Example Source: https://github.com/ni/nimi-python/blob/master/docs/nifgen/nimodinst.md A basic example demonstrating how to use the nimodinst.Session to retrieve information about High Speed Digitizers in the system. ```APIDOC ## nimodinst.Session Usage Example ### Description This example shows how to instantiate a Session object for a specific instrument driver (e.g., "niscope") and iterate through the detected devices to print their names, models, and serial numbers. ### Method Instantiate `nimodinst.Session` and use it as a context manager. ### Endpoint N/A (Python module usage) ### Parameters #### Path Parameters N/A #### Query Parameters N/A #### Request Body N/A ### Request Example ```python import nimodinst with nimodinst.Session("niscope") as session: for device in session: print("{: >20} {: >15} {: >10}".format(device.device_name, device.device_model, device.serial_number)) ``` ### Response #### Success Response (200) Prints device information to the console. #### Response Example ``` MyDeviceName MyDeviceModel SN12345 ``` ### API Reference Details - **Class**: `nimodinst.Session` - **Properties**: `bus_number`, `chassis_number`, `device_model`, `device_name`, `max_pciexpress_link_width`, `pciexpress_link_width`, `serial_number`, `slot_number`, `socket_number` - **Methods**: `close()` - **Exceptions**: `nimodinst.errors.Error`, `nimodinst.errors.DriverError`, `nimodinst.errors.UnsupportedConfigurationError`, `nimodinst.errors.DriverNotInstalledError`, `nimodinst.errors.DriverTooOldError`, `nimodinst.errors.DriverTooNewError`, `nimodinst.errors.DriverWarning` ``` -------------------------------- ### Install Build Artifacts Source: https://github.com/ni/nimi-python/blob/master/CONTRIBUTING.md Installs locally built PyPI packages after building the nimi-python project. Ensure you have sudo privileges. ```bash find generated | grep ".whl" | xargs sudo python3 -m pip install -U ``` -------------------------------- ### Example of Method Template Configuration Source: https://github.com/ni/nimi-python/wiki/API-Metadata This example shows the structure of the 'method_templates' key, which is an array of dictionaries. Each dictionary specifies filenames for session and documentation templates, and a suffix for the Python method name. ```json { "method_templates": [ { "session_filename": "", "documentation_filename": "", "method_python_name_suffix": "string" } ] } ``` -------------------------------- ### Install NIFGEN Module Source: https://github.com/ni/nimi-python/blob/master/docs/nidcpower/nifgen.md Installs the NIFGEN module using pip. Ensure the NI-FGEN runtime is installed first. ```bash $ python -m pip install nifgen ``` -------------------------------- ### Example: Fetch Forever Source: https://github.com/ni/nimi-python/blob/master/CHANGELOG.md This snippet refers to an example file named `niscope_fetch_forever.py`. ```python niscope_fetch_forever.py ``` -------------------------------- ### niscope.Session.ready_for_start_event_output_terminal Source: https://github.com/ni/nimi-python/blob/master/docs/niscope/class.md Specifies the destination for the Ready for Start Event. When this event is asserted, the digitizer is ready to receive a start trigger. Consult your device documentation for a specific list of valid destinations. ```APIDOC ## niscope.Session.ready_for_start_event_output_terminal ### Description Specifies the destination for the Ready for Start Event. When this event is asserted, the digitizer is ready to receive a start trigger. Consult your device documentation for a specific list of valid destinations. ### Datatype str ### Permissions read-write ``` -------------------------------- ### niscope.Session.ready_for_start_event_output_terminal Source: https://github.com/ni/nimi-python/blob/master/docs/nidmm/niscope.md Configures the output terminal for the 'ready for start event' signal. This signal is used to coordinate acquisition starts. ```APIDOC ## niscope.Session.ready_for_start_event_output_terminal ### Description Configures the output terminal for the 'ready for start event' signal. This signal is used to coordinate acquisition starts. ### Method (Not specified in source, likely a getter/setter) ### Endpoint (Not applicable for SDK methods) ### Parameters (No parameters specified in source) ### Request Example (Not applicable for SDK methods) ### Response #### Success Response - **ready_for_start_event_output_terminal** (string) - The name of the output terminal. ``` -------------------------------- ### Test Example Function Execution Source: https://github.com/ni/nimi-python/blob/master/docs/nidigital/examples.md Executes test cases for the example function with different parameters, including simulating different source and measure modes, and verifying expected exceptions. ```python def test_example(): resource_name = 'PXI1Slot2,PXI1Slot3' options = {'simulate': True, 'driver_setup': {'Model': '6571'}, } channels = 'DUTPin1, SystemPin1' aperture_time = 0.000004 example(resource_name, options, channels, 'voltage', aperture_time) with pytest.raises(Exception): example(resource_name, options, channels, 'current', aperture_time) settling_time = 0.01 current_level_range = 0.000002 current_level = 0.000002 voltage_limit_high = 3.3 voltage_limit_low = 0 example(resource_name, options, channels, 'voltage', aperture_time, 'source-current', settling_time, current_level_range, current_level, voltage_limit_high, voltage_limit_low) example(resource_name, options, channels, 'current', aperture_time, 'source-current', settling_time, current_level_range, current_level, voltage_limit_high, voltage_limit_low) current_limit_range = 0.000002 voltage_level = 3.3 example(resource_name, options, channels, 'voltage', aperture_time, 'source-voltage', settling_time, current_limit_range=current_limit_range, voltage_level=voltage_level) example(resource_name, options, channels, 'current', aperture_time, 'source-voltage', settling_time, current_limit_range=current_limit_range, voltage_level=voltage_level) ``` -------------------------------- ### Started Event Terminal Name Source: https://github.com/ni/nimi-python/blob/master/docs/nirfsg/nirfsg.md Gets the name of the terminal associated with the 'started' event. This is used for synchronizing with other devices when an operation starts. ```APIDOC ## started_event_terminal_name ### Description Gets the name of the terminal associated with the 'started' event. This is used for synchronizing with other devices when an operation starts. ### Method N/A (Property) ### Endpoint N/A (Property) ### Parameters N/A ### Request Example N/A ### Response N/A ``` -------------------------------- ### niscope.Session.ready_for_start_event_terminal_name Source: https://github.com/ni/nimi-python/blob/master/docs/nidmm/niscope.md Gets the name of the terminal that signals 'ready for start event'. This is used in synchronization scenarios for starting acquisitions. ```APIDOC ## niscope.Session.ready_for_start_event_terminal_name ### Description Gets the name of the terminal that signals 'ready for start event'. This is used in synchronization scenarios for starting acquisitions. ### Method (Not specified in source, likely a getter) ### Endpoint (Not applicable for SDK methods) ### Parameters (No parameters specified in source) ### Request Example (Not applicable for SDK methods) ### Response #### Success Response - **ready_for_start_event_terminal_name** (string) - The name of the terminal. ``` -------------------------------- ### Basic Nise Example Source: https://github.com/ni/nimi-python/blob/master/docs/nise/examples.md This script demonstrates how to establish a connection to an NI Switch Executive virtual device using a specified connection specification. It utilizes the nise.Session context manager for managing the connection lifecycle. ```python #!/usr/bin/python import argparse import nise import sys def example(virtual_device_name, connection): with nise.Session(virtual_device_name=virtual_device_name) as session: session.connect(connection) print(connection, ' is now connected.') def _main(argsv): parser = argparse.ArgumentParser(description='Connects the specified connection specification', formatter_class=argparse.ArgumentDefaultsHelpFormatter) parser.add_argument('-n', '--virtual-device', default='SwitchExecutiveExample', help='NI Switch Executive Virtual Device name') parser.add_argument('-c', '--connection', default='DIOToUUT', help='Connection Specification') args = parser.parse_args(argsv) example(args.virtual_device, args.connection) def main(): _main(sys.argv[1:]) def test_example(): example('SwitchExecutiveExample', 'DIOToUUT') def test_main(): cmd_line = [] _main(cmd_line) if __name__ == '__main__': main() ``` -------------------------------- ### nidigital.Session.start_trigger_type Source: https://github.com/ni/nimi-python/blob/master/docs/nidigital/nidigital.md Gets the type of the start trigger. ```APIDOC ## nidigital.Session.start_trigger_type ### Description Gets the type of the start trigger. ### Method Not specified (assumed to be a method call on a Session object) ### Endpoint Not applicable (Python method) ### Parameters None explicitly documented. ### Response * **trigger_type** (string) - The type of the start trigger. ``` -------------------------------- ### Execute Main Function Source: https://github.com/ni/nimi-python/blob/master/docs/nidcpower/examples.md This is the entry point for the script, which calls the main function to execute the example. ```python if __name__ == '__main__': main() ``` -------------------------------- ### Fetch Measurements with Source Delay Source: https://github.com/ni/nimi-python/blob/master/docs/nidcpower/examples.md This example demonstrates how to configure source delay and fetch measurements. It sets up the device to output DC voltage, configures a source delay, and then measures voltage and current after the delay. It also shows how to change voltage levels on the fly and fetch measurements. ```python import argparse import hightime import nidcpower import sys def print_fetched_measurements(measurements): print(f' Voltage : {measurements[0].voltage:f} V') print(f' Current: {measurements[0].current:f} A') print(f' In compliance: {measurements[0].in_compliance}') def example(resource_name, options, voltage1, voltage2, delay): timeout = hightime.timedelta(seconds=(delay + 1.0)) with nidcpower.Session(resource_name=resource_name, options=options) as session: # Configure the session. session.source_mode = nidcpower.SourceMode.SINGLE_POINT session.output_function = nidcpower.OutputFunction.DC_VOLTAGE session.current_limit = .06 session.voltage_level_range = 5.0 session.current_limit_range = .06 session.source_delay = hightime.timedelta(seconds=delay) session.measure_when = nidcpower.MeasureWhen.AUTOMATICALLY_AFTER_SOURCE_COMPLETE session.voltage_level = voltage1 with session.initiate(): channel_indices = f'0-{session.channel_count - 1}' channels = session.get_channel_names(channel_indices) for channel_name in channels: print(f'Channel: {channel_name}') print('---------------------------------') print('Voltage 1:') print_fetched_measurements(session.channels[channel_name].fetch_multiple(count=1, timeout=timeout)) session.voltage_level = voltage2 # on-the-fly set print('Voltage 2:') print_fetched_measurements(session.channels[channel_name].fetch_multiple(count=1, timeout=timeout)) session.output_enabled = False print('') def _main(argsv): parser = argparse.ArgumentParser(description='Outputs voltage 1, waits for source delay, and then takes a measurement. Then orepeat with voltage 2.', formatter_class=argparse.ArgumentDefaultsHelpFormatter) parser.add_argument('-n', '--resource-name', default='PXI1Slot2/0, PXI1Slot3/0-1', help='Resource names of an NI SMUs.') parser.add_argument('-v1', '--voltage1', default=1.0, type=float, help='Voltage level 1 (V)') parser.add_argument('-v2', '--voltage2', default=2.0, type=float, help='Voltage level 2 (V)') parser.add_argument('-d', '--delay', default=0.05, type=float, help='Source delay (s)') parser.add_argument('-op', '--option-string', default='', type=str, help='Option String') args = parser.parse_args(argsv) example(args.resource_name, args.option_string, args.voltage1, args.voltage2, args.delay) def main(): _main(sys.argv[1:]) def test_main(): cmd_line = ['--option-string', 'Simulate=1, DriverSetup=Model:4162; BoardType:PXIe', ] _main(cmd_line) def test_example(): options = {'simulate': True, 'driver_setup': {'Model': '4162', 'BoardType': 'PXIe', }, } example('PXI1Slot2/0, PXI1Slot3/1', options, 1.0, 2.0, 0.05) if __name__ == '__main__': main() ``` -------------------------------- ### niscope.Session.start_trigger_terminal_name Source: https://github.com/ni/nimi-python/blob/master/docs/nidmm/niscope.md Gets or sets the terminal name for the start trigger. This property specifies the physical terminal used for the start trigger. ```APIDOC ## niscope.Session.start_trigger_terminal_name ### Description Gets or sets the terminal name for the start trigger. This property specifies the physical terminal used for the start trigger. ### Method GET/SET ### Endpoint N/A (SDK Method) ### Parameters #### Path Parameters N/A #### Query Parameters N/A #### Request Body N/A ### Request Example N/A ### Response #### Success Response - **start_trigger_terminal_name** (string) - The name of the terminal used for the start trigger. ``` -------------------------------- ### Basic nidigital Module Usage Example Source: https://github.com/ni/nimi-python/blob/master/docs/nidigital/nidigital.md This example demonstrates opening a session, configuring PPMU settings for current sourcing and measurement, sourcing current, measuring voltage and current, and finally disconnecting channels. ```python import nidigital import time with nidigital.Session(resource_name='PXI1Slot2') as session: channels = 'PXI1Slot2/0,PXI1Slot2/1' # Configure PPMU measurements session.channels[channels].ppmu_aperture_time = 0.000004 session.channels[channels].ppmu_aperture_time_units = nidigital.PPMUApertureTimeUnits.SECONDS session.channels[channels].ppmu_output_function = nidigital.PPMUOutputFunction.CURRENT session.channels[channels].ppmu_current_level_range = 0.000002 session.channels[channels].ppmu_current_level = 0.000002 session.channels[channels].ppmu_voltage_limit_high = 3.3 session.channels[channels].ppmu_voltage_limit_low = 0 # Sourcing session.channels[channels].ppmu_source() # Settling time between sourcing and measuring time.sleep(0.01) # Measuring current_measurements = session.channels[channels].ppmu_measure(nidigital.PPMUMeasurementType.CURRENT) voltage_measurements = session.channels[channels].ppmu_measure(nidigital.PPMUMeasurementType.VOLTAGE) print('{:<20} {:<10} {:<10}'.format('Channel Name', 'Current', 'Voltage')) for channel, current, voltage in zip(channels.split(','), current_measurements, voltage_measurements): print('{:<20} {:<10f} {:<10f}'.format(channel, current, voltage)) # Disconnect all channels using programmable onboard switching session.channels[channels].selected_function = nidigital.SelectedFunction.DISCONNECT ``` -------------------------------- ### nidigital.Session.start_trigger_terminal_name Source: https://github.com/ni/nimi-python/blob/master/docs/nidigital/nidigital.md Gets the name of the start trigger terminal. ```APIDOC ## nidigital.Session.start_trigger_terminal_name ### Description Gets the name of the start trigger terminal. ### Method Not specified (assumed to be a method call on a Session object) ### Endpoint Not applicable (Python method) ### Parameters None explicitly documented. ### Response * **terminal_name** (string) - The name of the start trigger terminal. ``` -------------------------------- ### Development Status Logic Source: https://github.com/ni/nimi-python/blob/master/CHANGELOG.md The development status in `setup.py` is now based on the module version according to a defined logic. ```text The development status in `setup.py` will be based on the module version: - version >= 1.0 - .devN or .aN - Alpha - .bN, .cN or .rcN - Beta - \ or .postN - Stable - version < 1.0 and version >= 0.5 - Beta - version < 0.5 - Alpha ``` -------------------------------- ### Start Trigger Terminal Name Source: https://github.com/ni/nimi-python/blob/master/docs/nirfsg/nirfsg.md Gets the name of the terminal used for the start trigger. This allows external signals to initiate operations. ```APIDOC ## start_trigger_terminal_name ### Description Gets the name of the terminal used for the start trigger. This allows external signals to initiate operations. ### Method N/A (Property) ### Endpoint N/A (Property) ### Parameters N/A ### Request Example N/A ### Response N/A ``` -------------------------------- ### Demonstrate Homogenous Triggering with nitclk Source: https://github.com/ni/nimi-python/blob/master/CHANGELOG.md This example demonstrates how to synchronize triggering with nitclk. It is useful for setting up complex triggering scenarios. ```python nitclk_niscope_synchronize_with_trigger.py ``` -------------------------------- ### niscope.Session.start_to_ref_trigger_holdoff Source: https://github.com/ni/nimi-python/blob/master/docs/nidmm/niscope.md Gets or sets the holdoff time from the start trigger to the reference trigger. This property configures the delay between the start trigger and the reference trigger. ```APIDOC ## niscope.Session.start_to_ref_trigger_holdoff ### Description Gets or sets the holdoff time from the start trigger to the reference trigger. This property configures the delay between the start trigger and the reference trigger. ### Method GET/SET ### Endpoint N/A (SDK Method) ### Parameters #### Path Parameters N/A #### Query Parameters N/A #### Request Body N/A ### Request Example N/A ### Response #### Success Response - **start_to_ref_trigger_holdoff** (float) - The holdoff time in seconds. ``` -------------------------------- ### niscope.Session.exported_start_trigger_output_terminal Source: https://github.com/ni/nimi-python/blob/master/docs/nirfsg/niscope.md Gets the name of the exported start trigger output terminal. ```APIDOC ## niscope.Session.exported_start_trigger_output_terminal ### Description Gets the name of the exported start trigger output terminal. ### Method (Method details not provided in source) ### Endpoint (Endpoint details not provided in source) ### Parameters (Parameter details not provided in source) ### Request Example (Request example not provided in source) ### Response (Response details not provided in source) ``` -------------------------------- ### Session Initialization with Dictionary Options Source: https://github.com/ni/nimi-python/blob/master/CHANGELOG.md Demonstrates initializing a session using a Python dictionary for options, which is an alternative to using a string. This was introduced to fix issue #661. ```python session = nidmm.Session('Dev1', False, {'simulate': True, 'driver_setup': {'Model': '4071', 'BoardType': 'PXI'}}) ``` -------------------------------- ### niscope.Session.acquisition_start_time Source: https://github.com/ni/nimi-python/blob/master/docs/nidigital/niscope.md Gets the acquisition start time. This property provides information about when the acquisition began. ```APIDOC ## niscope.Session.acquisition_start_time ### Description Gets the acquisition start time. This property provides information about when the acquisition began. ### Method Not specified (likely a Python property getter) ### Endpoint Not applicable (Python SDK property) ### Parameters None. ### Request Example ```python # Example usage start_time = session.acquisition_start_time ``` ### Response #### Success Response * **start_time** (float or datetime object) - The timestamp indicating when the acquisition started. #### Response Example ```python # Example response value (format may vary) # start_time = 1678886400.0 ``` ``` -------------------------------- ### digital_edge_start_trigger_edge Source: https://github.com/ni/nimi-python/blob/master/docs/nidigital/nidigital.md Gets or sets the digital edge start trigger edge property for the session. ```APIDOC ## digital_edge_start_trigger_edge ### Description Gets or sets the digital edge start trigger edge property. ### Property `nidigital.Session.digital_edge_start_trigger_edge` ``` -------------------------------- ### acquisition_start_time Source: https://github.com/ni/nimi-python/blob/master/docs/nidcpower/niscope.md Gets the acquisition start time. This property provides information about when the acquisition began. ```APIDOC ## acquisition_start_time ### Description Gets the acquisition start time. ### Method (Not specified, likely a property access in an SDK) ### Endpoint (Not applicable for SDK properties) ### Parameters (No parameters specified in the source) ### Request Example (No request example provided in the source) ### Response (No response details provided in the source) ``` -------------------------------- ### Configure Voltage Levels and Time Set Source: https://github.com/ni/nimi-python/blob/master/docs/nidigital/examples.md This example shows how to configure voltage levels (VIH, VIL, VOH, VOL, VTERM) and termination modes (High-Z, Active Load) for channels. It also demonstrates configuring time sets, including period, drive format, and edge timing. This is useful for setting up the digital instrument's electrical characteristics before running patterns. ```python #!/usr/bin/python import argparse import nidigital import os import sys class VoltageLevelsAndTerminationConfig(): def __init__(self, vil, vih, vol, voh, vterm, termination_mode, iol, ioh, vcom): self.vil = vil self.vih = vih self.vol = vol self.voh = voh self.vterm = vterm self.termination_mode = termination_mode self.iol = iol self.ioh = ioh self.vcom = vcom class TimeSetConfig(): def __init__(self, time_set_name, period, drive_format, drive_on, drive_data, drive_return, drive_off, strobe_edge): self.time_set_name = time_set_name self.period = period self.drive_format = drive_format self.drive_on = drive_on self.drive_data = drive_data self.drive_return = drive_return self.drive_off = drive_off self.strobe_edge = strobe_edge def convert_drive_format(drive_format): converter = {'NR': nidigital.DriveFormat.NR, 'RL': nidigital.DriveFormat.RL, 'RH': nidigital.DriveFormat.RH, 'SBC': nidigital.DriveFormat.SBC} return converter.get(drive_format, None) def example(resource_name, options, channels, voltage_config, time_set_config): with nidigital.Session(resource_name=resource_name, options=options) as session: dir = os.path.dirname(__file__) # Load pin map (.pinmap) created using Digital Pattern Editor pin_map_filename = os.path.join(dir, 'PinMap.pinmap') session.load_pin_map(pin_map_filename) # Configure voltage levels and terminal voltage through driver API session.channels[channels].configure_voltage_levels(voltage_config.vil, voltage_config.vih, voltage_config.vol, voltage_config.voh, voltage_config.vterm) if voltage_config.termination_mode == 'High_Z': session.channels[channels].termination_mode = nidigital.TerminationMode.HIGH_Z elif voltage_config.termination_mode == 'Active_Load': session.channels[channels].termination_mode = nidigital.TerminationMode.ACTIVE_LOAD session.channels[channels].configure_active_load_levels(voltage_config.iol, voltage_config.ioh, voltage_config.vcom) else: session.channels[channels].termination_mode = nidigital.TerminationMode.VTERM # Configure time set through driver API session.create_time_set(time_set_config.time_set_name) # Must match time set name in pattern file session.configure_time_set_period(time_set_config.time_set_name, time_set_config.period) session.channels[channels].configure_time_set_drive_edges(time_set_config.time_set_name, convert_drive_format(time_set_config.drive_format), time_set_config.drive_on, time_set_config.drive_data, time_set_config.drive_return, time_set_config.drive_off) session.channels[channels].configure_time_set_compare_edges_strobe(time_set_config.time_set_name, time_set_config.strobe_edge) # Load the pattern file (.digipat) created using Digital Pattern Editor pattern_filename = os.path.join(dir, 'Pattern.digipat') session.load_pattern(pattern_filename) # Burst pattern, blocks until the pattern is done bursting session.burst_pattern(start_label='new_pattern') print('Start bursting pattern') # Disconnect all channels using programmable onboard switching session.selected_function = nidigital.SelectedFunction.DISCONNECT print('Done bursting pattern') def _main(argsv): parser = argparse.ArgumentParser(description='Demonstrates how to create an instrument session, configure time set and voltage levels, and burst a pattern on the digital pattern instrument.', formatter_class=argparse.ArgumentDefaultsHelpFormatter) parser.add_argument('-n', '--resource-name', default='PXI1Slot2,PXI1Slot3', help='Resource name of a NI digital pattern instrument, ensure the resource name matches the instrument name in the pinmap file.') parser.add_argument('-s', '--simulate', default='True', choices=['True', 'False'], help='Whether to run on simulated hardware or on real hardware') parser.add_argument('-c', '--channels', default='PinGroup1', help='Channel(s)/Pin(s) to configure') # Parameters to configure voltage parser.add_argument('--vil', default=0, type=float, help='The voltage that the instrument will apply to the input of the DUT when the pin driver drives a logic low (0)') parser.add_argument('--vih', default=3.3, type=float, help='The voltage that the instrument will apply to the input of the DUT when the test instrument drives a logic high (1)') ``` -------------------------------- ### niscope.Session.advance_trigger_terminal_name Source: https://github.com/ni/nimi-python/blob/master/docs/nidigital/niscope.md Gets or sets the name of the terminal used for the advance trigger. This is relevant for multi-trigger setups. ```APIDOC ## niscope.Session.advance_trigger_terminal_name ### Description Gets or sets the name of the terminal used for the advance trigger. This is relevant for multi-trigger setups. ### Method Not specified (likely a Python property getter/setter) ### Endpoint Not applicable (Python SDK property) ### Parameters * **value** (str) - Optional - The name of the advance trigger terminal (e.g., '/Dev1/PFI0'). ### Request Example ```python # Get value current_terminal = session.advance_trigger_terminal_name # Set value session.advance_trigger_terminal_name = '/Dev1/PFI1' ``` ### Response #### Success Response * **value** (str) - The name of the advance trigger terminal. #### Response Example ```python # Example response value # current_terminal = '/Dev1/PFI1' ``` ``` -------------------------------- ### Example Usage with Test Data Source: https://github.com/ni/nimi-python/blob/master/docs/nidigital/examples.md This snippet demonstrates how to call the example function with predefined test data for resource name, options, channels, voltage configuration, and time set configuration. This is useful for testing and validation. ```python def test_example(): resource_name = 'PXI1Slot2,PXI1Slot3' options = {'simulate': True, 'driver_setup': {'Model': '6571'}, } channels = 'PinGroup1' voltage_config = VoltageLevelsAndTerminationConfig(vil=0, vih=3.3, vol=1.6, voh=1.7, vterm=2, termination_mode='Active_Load', iol=0.002, ioh=-0.002, vcom=0) time_set_config = TimeSetConfig(time_set_name="tset0", period=0.00000002, drive_format='NR', drive_on=0, drive_data=0, drive_return=0.000000015, drive_off=0.00000002, strobe_edge=0.00000001) example(resource_name, options, channels, voltage_config, time_set_config) ``` -------------------------------- ### Open Session and Connect Routegroup Source: https://github.com/ni/nimi-python/blob/master/docs/nidcpower/nise.md A basic example demonstrating how to open a session to a Switch Executive Virtual Device and connect a routegroup using the nise module. ```python import nise with nise.Session('SwitchExecutiveExample') as session: session.connect('DIOToUUT') ``` -------------------------------- ### instrument_firmware_revision Source: https://github.com/ni/nimi-python/blob/master/docs/nidigital/nidmm.md Gets the firmware revision of the instrument. This property provides information about the installed firmware version. ```APIDOC ## instrument_firmware_revision ### Description Gets the firmware revision of the instrument. This property provides information about the installed firmware version. ### Method N/A (Property access in Python SDK) ### Endpoint N/A (Property access in Python SDK) ### Parameters None ### Request Example ```python firmware_rev = session.instrument_firmware_revision ``` ### Response (str) - The firmware revision string. ``` -------------------------------- ### niscope.Session.tv_trigger_event Source: https://github.com/ni/nimi-python/blob/master/docs/nidmm/niscope.md Gets or sets the TV trigger event type. This property configures the specific TV signal event to trigger on (e.g., line start, field). ```APIDOC ## niscope.Session.tv_trigger_event ### Description Gets or sets the TV trigger event type. This property configures the specific TV signal event to trigger on (e.g., line start, field). ### Method GET/SET ### Endpoint N/A (SDK Method) ### Parameters #### Path Parameters N/A #### Query Parameters N/A #### Request Body N/A ### Request Example N/A ### Response #### Success Response - **tv_trigger_event** (string) - The TV trigger event type. ``` -------------------------------- ### ready_for_start_event_output_terminal Source: https://github.com/ni/nimi-python/blob/master/docs/nidigital/niscope.md Configures or retrieves the terminal for the 'Ready for Start' event output. ```APIDOC ## ready_for_start_event_output_terminal ### Description This method is used to configure or retrieve the specific terminal on the instrument that will output the 'Ready for Start' event signal. This event indicates that the instrument is prepared to begin an acquisition or measurement. ### Method This appears to be a property getter/setter based on the source format. ### Endpoint N/A (Python SDK method) ### Parameters This method likely accepts a string representing the terminal name (e.g., 'PFI2'), or no arguments for retrieval. ### Request Example ```python # Example for setting the value my_session.ready_for_start_event_output_terminal = 'PFI2' # Example for getting the value start_terminal = my_session.ready_for_start_event_output_terminal ``` ### Response #### Success Response Returns a string representing the name of the output terminal. #### Response Example ```json "PFI2" ``` ```