nibcq.switch.SwitchConfiguration ================================ .. py:class:: nibcq.switch.SwitchConfiguration Represents the configuration for the switch system. .. attribute:: topology The switch topology being used (can be SwitchTopology enum or string). Only set to string if you know it is a supported topology type for your switch! .. attribute:: cells A list of channel connections for the DUTs. Can be either a list of SMUCellData objects or a list of strings, which are DUT channel names, when the device family is DMM. .. py:method:: get_topology_string() -> str Get the topology as a string value. Converts the topology setting to its string representation, handling both SwitchTopology enum values and raw string values. This is used internally to build the full topology string for switch initialization. :returns: The topology string value suitable for switch configuration :rtype: str .. rubric:: Examples >>> config = SwitchConfiguration(SwitchTopology.SWITCH_2_WIRE_QUAD_16X1_MUX, ["ch0"]) >>> topology_str = config.get_topology_string() >>> print(topology_str) # "2-Wire Quad 16x1 Mux" .. py:method:: from_file(config_path: str | pathlib.Path) -> SwitchConfiguration :classmethod: Load switch configuration from a JSON file. Reads a JSON configuration file and creates a SwitchConfiguration object with the appropriate settings for the switch topology and DUT channel mappings. Supports both DMM and SMU configuration formats. :param config_path: The path to the JSON configuration file. Must be a valid file path pointing to a properly formatted switch configuration JSON file. :type config_path: str or Path :returns: A new SwitchConfiguration object populated with the configuration data from the file. :rtype: SwitchConfiguration :raises FileNotFoundError: If the configuration file doesn't exist :raises json.JSONDecodeError: If the file contains invalid JSON :raises ValueError: If the file format is not compatible .. rubric:: Examples >>> config = SwitchConfiguration.from_file("switch_config.json") >>> print(f"Loaded {len(config.cells)} DUT channels") >>> config = SwitchConfiguration.from_file(Path("config/dmm_switch.json")) .. py:method:: from_json(data: dict) -> SwitchConfiguration :classmethod: Load switch configuration from a JSON dictionary. Creates a SwitchConfiguration object from a dictionary containing switch configuration data. Automatically detects whether the configuration is for DMM (simple channel list) or SMU (detailed cell data) based on the structure of the cells data. :param data: The JSON dictionary data containing configuration. Must include "Switches Topology" and "Cells" keys with appropriate values for the target device family. :type data: dict :returns: A new SwitchConfiguration object with: - List[str] cells for DMM configurations - List[SMUCellData] cells for SMU configurations - Topology as SwitchTopology enum if recognized, string otherwise :rtype: SwitchConfiguration :raises KeyError: If required keys are missing from the data dictionary :raises ValueError: If the data format is invalid or incompatible .. rubric:: Examples >>> data = { ... "Switches Topology": "2-Wire Quad 16x1 Mux", ... "Cells": ["ch0", "ch1", "ch2"] ... } >>> config = SwitchConfiguration.from_json(data) # DMM format >>> >>> smu_data = { ... "Switches Topology": "2-Wire Quad 16x1 Mux", ... "Cells": [{"Cell Serial Number": "123", ...}] ... } >>> config = SwitchConfiguration.from_json(smu_data) # SMU format