# Resource Manager¶

class pyvisa.highlevel.ResourceInfo(interface_type, interface_board_number, resource_class, resource_name, alias)

Resource extended information

Named tuple with information about a resource. Returned by some ResourceManager methods.

Interface_type: Interface_board_number: Interface type of the given resource string. pyvisa.constants.InterfaceType Board number of the interface of the given resource string. Specifies the resource class (for example, “INSTR”) of the given resource string. This is the expanded version of the given resource string. The format should be similar to the VISA-defined canonical resource name. Specifies the user-defined alias for the given resource string.
class pyvisa.highlevel.ResourceManager[source]

VISA Resource Manager

Parameters: visa_library – VisaLibrary Instance, path of the VISA library or VisaLibrary spec string. (if not given, the default for the platform will be used).
close()[source]

Close the resource manager session.

last_status

Last status code returned for an operation with this Resource Manager

Return type: pyvisa.constants.StatusCode
list_resources(query='?*::INSTR')[source]

Returns a tuple of all connected devices matching query.

note: The query uses the VISA Resource Regular Expression syntax - which is not the same
as the Python regular expression syntax. (see below)

The VISA Resource Regular Expression syntax is defined in the VISA Library specification: http://www.ivifoundation.org/docs/vpp43.pdf

Symbol Meaning ———- ———-

? Matches any one character.

Makes the character that follows it an ordinary character
instead of special character. For example, when a question mark follows a backslash (?), it matches the ? character instead of any one character.
[list] Matches any one character from the enclosed list. You can
use a hyphen to match a range of characters.
[^list] Matches any character not in the enclosed list. You can use
a hyphen to match a range of characters.
• Matches 0 or more occurrences of the preceding character or expression.
• Matches 1 or more occurrences of the preceding character or expression.
Exp|exp Matches either the preceding or following expression. The or
operator | matches the entire expression that precedes or follows it and not just the character that precedes or follows it. For example, VXI|GPIB means (VXI)|(GPIB), not VX(I|G)PIB.

(exp) Grouping characters or expressions.

Thus the default query, ‘?*::INSTR’, matches any sequences of characters ending ending with ‘::INSTR’.

Parameters: query – a VISA Resource Regular Expression used to match devices.
list_resources_info(query='?*::INSTR')[source]

Returns a dictionary mapping resource names to resource extended information of all connected devices matching query.

For details of the VISA Resource Regular Expression syntax used in query, refer to list_resources().

Parameters: query – a VISA Resource Regular Expression used to match devices. Mapping of resource name to ResourceInfo dict[str, pyvisa.highlevel.ResourceInfo]
open_bare_resource(resource_name, access_mode=<AccessModes.no_lock: 0>, open_timeout=0)[source]

Open the specified resource without wrapping into a class

Parameters: resource_name – name or alias of the resource to open. access_mode (pyvisa.constants.AccessModes) – access mode. open_timeout – time out to open. Unique logical identifier reference to a session.
open_resource(resource_name, access_mode=<AccessModes.no_lock: 0>, open_timeout=0, resource_pyclass=None, **kwargs)[source]

Return an instrument for the resource name.

Parameters: resource_name – name or alias of the resource to open. access_mode (pyvisa.constants.AccessModes) – access mode. open_timeout – time out to open. resource_pyclass – resource python class to use to instantiate the Resource. Defaults to None: select based on the resource name. kwargs – keyword arguments to be used to change instrument attributes after construction. pyvisa.resources.Resource
resource_info(resource_name, extended=True)[source]

Get the (extended) information of a particular resource.

Parameters: resource_name – Unique symbolic name of a resource. pyvisa.highlevel.ResourceInfo
session

Resource Manager session handle.

Raises: pyvisa.errors.InvalidSession if session is closed.