Oxford Instruments Base Instrument

class pymeasure.instruments.oxfordinstruments.base.OxfordInstrumentsBase(adapter, name='OxfordInstruments Base', max_attempts=5, **kwargs)

Bases: Instrument

Base instrument for devices from Oxford Instruments.

Checks the replies from instruments for validity.

Parameters
  • adapter – A string, integer, or Adapter subclass object

  • name (string) – The name of the instrument. Often the model designation by default.

  • max_attempts – Integer that sets how many attempts at getting a valid response to a query can be made

  • **kwargs – In case adapter is a string or integer, additional arguments passed on to VISAAdapter (check there for details). Discarded otherwise.

ask(command)

Write the command to the instrument and return the resulting ASCII response. Also check the validity of the response before returning it; if the response is not valid, another attempt is made at getting a valid response, until the maximum amount of attempts is reached.

Parameters

command – ASCII command string to be sent to the instrument

Returns

String ASCII response of the instrument

Raises

OxfordVISAError if the maximum number of attempts is surpassed without getting a valid response

is_valid_response(response, command)

Check if the response received from the instrument after a command is valid and understood by the instrument.

Parameters
  • response – String ASCII response of the device

  • command – command used in the initial query

Returns

True if the response is valid and the response indicates the instrument recognised the command

write(command)

Write command to instrument and check whether the reply indicates that the given command was not understood. The devices from Oxford Instruments reply with ‘?xxx’ to a command ‘xxx’ if this command is not known, and replies with ‘x’ if the command is understood. If the command starts with an “$” the instrument will not reply at all; hence in that case there will be done no checking for a reply.

Raises

OxfordVISAError if the instrument does not recognise the supplied command or if the response of the instrument is not understood

class pymeasure.instruments.oxfordinstruments.base.OxfordVISAError

Bases: Exception