API Reference

This reference provides detailed documentation for all the features in pyMedoc

pymedoc.devices: pyMedoc Devices

class Pathway(ip, port_number, timeout=5.0, verbose=True, buffer_size=1024)[source]

Pathway is a class to communicate with the Medoc Pathway thermal stimulation machine.

Parameters:
  • ip (str) – device ip address
  • port_number (int) – port the device is listening on
  • timeout (float) – seconds until connection timeouts; default 5s
  • verbose (bool) – flag whether to print responses; default True
  • buffer_size (int) – size of connection buffer; default 1024
call(command, protocol=None, reuse_socket=False, verbose=False)[source]

Send command to device.

Parameters:
  • command (str/int) – command name or command_id number to send to device
  • protocol (str/int) – protocol number on device to issue command to (only needed for command TEST_PROGRAM)
  • reuse_socket (bool) – try to reuse the last created socket connection; NOT CURRENTLY FUNCTIONAL
  • verbose (bool) – whether to print out the device callback
Returns:

response from Medoc system

Return type:

response (dict)

poll_for_change(to_watch, desired_value, poll_interval=0.5, poll_max=-1, verbose=False, server_lag=1.0, reuse_socket=False)[source]

Poll system for a value change. Useful for waiting until the Medoc system has transitioned to a specific state in order to issue another command, but the transition length is unknowable.

Parameters:
  • to_watch (str) – the response field we should be monitoring; most often ‘test_state’ or ‘pathway_state’
  • desired_value (str) – the desired value of the field to wait on, i.e. keep checking until response_field has this value
  • poll_interval (float) – how often to poll; default .5s
  • poll_max (int) – upper limit on polling attempts; default -1 (unlimited)
  • verbose (bool) – print poll attempt number and current state
  • server_lag (float) – sometimes if the socket connection is pinged too quickly after a value change the subsequent command after this method is called can get missed. This adds an additional layer of timing delay before returning from this method to prevent this; default 1s
  • reuse_socket (bool) – try to reuse the last created socket connection; NOT CURRENTLY FUNCTIONAL
Returns:

whether desired_value was achieved

Return type:

status (bool)

status()[source]

Convenience method.

program(protocol)[source]

Convenience method.

start()[source]

Convenience method.

pause()[source]

Convenience method.

trigger()[source]

Convenience method.

stop()[source]

Convenience method.

abort()[source]

Convenience method.

yes()[source]

Convenience method.

no()[source]

Convenience method.