DiscoveredInstrument#
- class DiscoveredInstrument(
- resource: str,
- idn: str,
- category: str,
- driver_name: str,
- num_channels: int | None = None,
- transport: str = 'visa',
- backend: str | None = None,
- serial_config: SerialConfig | None = None,
Bases:
objectAn instrument that discovery identified and matched to a registered driver.
The record is enough to construct the driver (
make_driver()) or to emit thedriverblock of an instro JSON config (config_block()), so scripts and fixtures don’t re-derive either from the resource string.- Variables:
resource (str) – Address the driver opens: a VISA resource string, or for other transports whatever the driver’s constructor takes (an NI-DAQmx device name, an MCC serial number, …).
idn (str) – Identity reply the match was made from (the raw
*IDN?string for SCPI instruments).category (str) – Instrument category (
"psu","dmm","daq", …).driver_name (str) – Key of the matched driver in the category’s registry (
driver_registry()), e.g."BK9115".num_channels (int | None) – Programmable channel count where the category tracks it, else
None.transport (str) –
"visa"for SCPI-over-VISA instruments. Discovery providers for vendor SDKs set their own token; only"visa"records can build aVisaConfig.backend (str | None) – pyvisa backend the scan was asked for (
Nonefor the default with fallback), sovisa_config()resolves it the same way the scan did.serial_config (SerialConfig | None) – Serial settings a serial (
ASRL) instrument answered with, elseNone.
Example:
report = scan_visa_resources() psu = next(i for i in report.instruments if i.category == "psu") instro_psu = InstroPSU(name="psu", driver=psu.make_driver(), num_channels=psu.num_channels)
- serial_config: SerialConfig | None = None#
- property driver_class_name: str#
Deprecated alias of
driver_name.
- visa_config() VisaConfig[source]#
The
VisaConfigthat reaches this instrument, carrying the backend and serial settings it answered with.- Raises:
ValueError – the instrument is not on the VISA transport.
- driver_class() type[source]#
The matched driver class, loaded from the category’s driver registry on demand.
- Raises:
KeyError –
driver_nameis not registered forcategory.
- make_driver() Any[source]#
A new, unopened driver for this instrument.
VISA instruments get a
VisaConfig; drivers on other transports receiveresourcedirectly, which is thedevice_idconvention the DAQ vendor drivers use.
- config_block() dict[str, Any][source]#
The
driverblock of an instro JSON config for this instrument.num_channelsis included when discovery knows it, which is exactly the set of categories whose driver config requires it (psu, scope, awg).- Raises:
ValueError – the instrument is not on the VISA transport, which is the only one with a JSON config schema today.