Code reference

shapelink.util

Utility functions

These functions replicate QDataStreams behavior in C++. In PySide2 QDataStream does not accept array type data.

In C++ an array is serialized by writing: 1) Uint32 number of elements 2) type array elements

more significant bytes are written first. (big-endian)

if numpy “to_bytes” is used the native little-endian format appears

shapelink.util.qstream_read_array(stream: PySide2.QtCore.QDataStream, datatype: numpy.dtype) numpy.array[source]

Read array data from a stream with a specified type

shapelink.util.qstream_write_array(stream: PySide2.QtCore.QDataStream, array: numpy.array) int[source]

Write array data to a stream with a specified type :param stream: :param array: :return:

shapelink.shapein_simulator

Simulate a Shape-In instance

The communication is based on a simple REQ REP pattern all methods return when the transmission was acknowledged by the peer.

class shapelink.shapein_simulator.ShapeInSimulator(destination='tcp://localhost:6666', verbose=False)[source]
register_parameters(scalar_reg_features=None, vector_reg_features=None, image_reg_features=None, image_shape=None, settings_names=None, settings_values=None)[source]

Register parameters that are sent to other processes

send_end_of_transmission()[source]

Send end of transmission packet

send_event(event_id: int, scalar_values: numpy.array, vector_values: List[numpy.array], image_values: List[numpy.array]) bool[source]

Send a single event to the other process

send_request_for_features()[source]
shapelink.shapein_simulator.start_simulator(path, features=None, destination='tcp://localhost:6666', verbose=1)[source]

Run a Shape-In simulator using data from an RT-DC dataset

Parameters
  • path (str) – File path to a .rtdc file

  • features (list, default None) – A list of RT-DC features e.g., [“image”, “circ”, “deform”]

  • destination (str) – The socket to which the ShapeInSimulator will connect. By default it is set to “tcp://localhost:6666”. These are the protocol, host and port in the form “protocol://host:port”.

  • verbose (int) – Prints extra information during the transfer process, such as simulator speed. Increment to increase verbosity.

See also

shapelink.cli.run_simulator

shapelink.msg_def

Definitions for message ids (numeric)