Skip to content

Improve Session constructor API by replacing option_string with something more Pythonic #661

@marcoskirsch

Description

@marcoskirsch

Proposed by Michael Auchter:

re: InitWithOptions option string
See page 83, http://www.ivifoundation.org/downloads/Architecture%20Specifications/IVI-3.2_Inherent_Capabilities_2017-02-07.pdf

There are a limited number of valid option string attributes:
RangeCheck (bool)
QueryInstrStatus (bool)
Cache (bool)
Simulate (bool)
RecordCoercions (bool)
InterchangeCheck (bool)
DriverSetup (string)

and these are expected to be specified as comma-separated "Name=Value" pairs. DriverSetup is special: it needs to be the last thing in the option string, and everything after the equals sign is passed to the driver. In practice, most (all?) MI drivers treat the DriverSetup as a semi-colon separated list of "Name:Value" pairs.

That's kind of a mess, and it's something I frequently get wrong.

I'd prefer to see these (well, specifically "Simulate" and "DriverSetup"; I doubt the others see much use) handled explicitly.
So. instead of:

niscope.Session(rsrc, option_string='Simulate=1,DriverSetup=Model:5162 (4CH);Bitfile:CustomProcessing')

Something like:

niscope.Session(rsrc, simulate=True, driver_setup={'Model': '5162 (4CH)', 'Bitfile': 'CustomProcessing'})

and have init take care of building up the correctly formatted option string for the driver's consumption.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions