ScopeViewApi Commands

Documentation Home Page HYPERSIM Home Page
Pour la documentation en FRANÇAIS, utilisez l'outil de traduction de votre navigateur Chrome, Edge ou Safari. Voir un exemple.

ScopeViewApi Commands

General

close():

ScopeViewApiGRPC.close()

Close ScopeView

Returns:

error value

Return type:

int

Raises:

Exception – raises exception on error

connectToScopeViewRemote(id=None, timeout=__privateUtil.DEFAULT_TIMEOUT_MS):

ScopeViewApiGRPC.connectToScopeViewRemote(id=None, timeout=__privateUtil.DEFAULT_TIMEOUT_MS)

Connect to the first instance of ScopeView

Parameters:

  • id (str or int or None) – The unique identifier for the remote ScopeView

  • timeout (int) – Timeout in milliseconds.

Returns:

Result of the connection to the selected service.

Raises:

Exception – If connection fails.

disableScopeViewApiExceptions():

ScopeViewApiGRPC.disableScopeViewApiExceptions()

Disable ScopeViewApi from returning ScopeView exceptions through Python

openScopeView(timeout=2500, starting_timeout=__privateUtil.DEFAULT_TIMEOUT_MS, force_new=False):

ScopeViewApiGRPC.openScopeView(timeout=2500, starting_timeout=__privateUtil.DEFAULT_TIMEOUT_MS, force_new=False)

Opens ScopeView and connects to it. If no instance is running, launches a new one.

Parameters:

timeout (int) – Timeout in milliseconds

Returns:

PID of the connected or newly launched ScopeView instance.

Return type:

int

When using HYPERSIM, or when forceUseHypersimDir is set to True with setEnv(), the ScopeView location is relative to the HYPERSIM_DIR variable. Otherwise, the ScopeView location is relative to the Scopeview API location.

Acquisition

evalAllExpressions():

ScopeViewApiGRPC.evalAllExpressions()

Evaluate all ScopeView expressions from template

Returns:

error value

Return type:

int

Raises:

AssertionError – raises exception on error

exportToFile(file_name, parameters=None):

ScopeViewApiGRPC.exportToFile(file_name, parameters=None)

Export ScopeView data source to desired format at provided file location

Parameters:

  • file_name (str) – path to export file

  • parameters (dict[str, str], optional) – optional dictionary of encoder-specific parameters.

Returns:

error value

Return type:

int

Raises:

AssertionError – raises exception on error

Supported options:

  • COMTRADE (.cfg):

    • "version": COMTRADE standard version — "1991", "1997", "1999", "2001", "2013" (default: "2013")

    • "dataType": data type for values — "ascii", "binary", "binary32", "float32" (default: "float32")

    • "lineFrequency": line frequency in Hz (default: "60")

  • PNG (.png):

    • "dpi": image resolution in dots per inch (default: "72")

  • JPEG (.jpg / .jpeg):

    • "dpi": image resolution in dots per inch

    • "width": image width in inches

    • "height": image height in inches

exportToPDF(file_name):

ScopeViewApiGRPC.exportToPDF(file_name)

Export ScopeView graphs to PDF at provided file location

Parameters:

file_name (str) – path to export PDF

Returns:

error value

Return type:

int

Raises:

AssertionError – raises exception on error

getCont():

ScopeViewApiGRPC.getCont()

Get ScopeView cont state

Returns:

cont state

Return type:

str

getExpressions():

ScopeViewApiGRPC.getExpressions()

Gets all ScopeView expressions from template

Returns:

a list of ScopeView expressions

Return type:

list[str]

getNumAcq():

ScopeViewApiGRPC.getNumAcq()

Get number of ScopeView acquisitions

Returns:

number of acquisitions

Return type:

str

getNumData():

ScopeViewApiGRPC.getNumData()

Get number of ScopeView data

Returns:

number of data

Return type:

str

getSamplingRate():

ScopeViewApiGRPC.getSamplingRate()

Get ScopeView acquisition sample rate

Returns:

sample rate

Return type:

str

getStartTime():

ScopeViewApiGRPC.getStartTime()

Get ScopeView acquisition start time

Returns:

start time

Return type:

str

getTimeLength():

ScopeViewApiGRPC.getTimeLength()

Get ScopeView acquisition duration

Returns:

time length

Return type:

str

pauseAcquisition():

ScopeViewApiGRPC.pauseAcquisition()

Pause ScopeView acquisition

Returns:

error value

Return type:

int

Raises:

AssertionError – raises exception on error

setCont(value):

ScopeViewApiGRPC.setCont(value)

Set ScopeView cont option

Parameters:

value (bool) – cont state

Returns:

error value

Return type:

int

Raises:

AssertionError – raises exception on error

setNumAcq(value):

ScopeViewApiGRPC.setNumAcq(value)

Set number of ScopeView acquisitions

Parameters:

value (int) – number of acquisition

Returns:

error value

Return type:

int

Raises:

AssertionError – raises exception on error

setSamplingRate(value):

ScopeViewApiGRPC.setSamplingRate(value)

Set ScopeView acquisition sample rate

Parameters:

value (float) – acquisition sample rate (seconds)

Returns:

error value

Return type:

int

Raises:

AssertionError – raises exception on error

setStartTime(value):

ScopeViewApiGRPC.setStartTime(value)

Set ScopeView acquisition start time

Parameters:

value (float) – time to start acquisition (seconds)

Returns:

error value

Return type:

int

Raises:

AssertionError – raises exception on error

setSync(value):

ScopeViewApiGRPC.setSync(value)

Set ScopeView sync option

Parameters:

value (bool) – sync state

Returns:

error value

Return type:

int

Raises:

AssertionError – raises exception on error

setTimeLength(value):

ScopeViewApiGRPC.setTimeLength(value)

Set ScopeView acquisition duration

Parameters:

value (float) – acquisition duration (seconds)

Returns:

error value

Return type:

int

Raises:

AssertionError – raises exception on error

setTrig(value):

ScopeViewApiGRPC.setTrig(value)

Set ScopeView trig option

Parameters:

value (bool) – trig state

Returns:

error value

Return type:

int

Raises:

AssertionError – raises exception on error

startAcquisition():

ScopeViewApiGRPC.startAcquisition()

Start ScopeView acquisition

Returns:

error value

Return type:

int

Raises:

AssertionError – raises exception on error

stopAcquisition():

ScopeViewApiGRPC.stopAcquisition()

Stop ScopeView acquisition

Returns:

error value

Return type:

int

Raises:

AssertionError – raises exception on error

Comtrade

calculateComtradeSignalDelay(files, signal_pairs=None):

ScopeViewApiGRPC.calculateComtradeSignalDelay(files, signal_pairs=None)

calculateComtradeSignalDelay method returns a map of the comtrade file names with a delay calculated in seconds. The delay is calculated by having a default file (the first value in the files array), compared to the other files. To calculate a delay, a match needs to be made between a signal from the default file, and a signal from the rest of the list. The method tries to make a match by checking which signal names have words in common, but if no similarities are made, an error will be given.