xdas.processing.ZMQPublisher#
- class xdas.processing.ZMQPublisher(address, encoding=None)[source]#
A class for publishing DataArray chunks over ZeroMQ.
- Parameters:
Examples
>>> import xdas as xd >>> from xdas.processing import ZMQPublisher, ZMQSubscriber
First we generate some data and split it into packets
>>> packets = xd.split(xd.synthetics.dummy(), 10)
We initialize the publisher at a given address
>>> address = f"tcp://localhost:{xd.io.get_free_port()}" >>> publisher = ZMQPublisher(address)
We can then publish the packets
>>> for da in packets: ... publisher.submit(da)
To reduce the size of the packets, we can also specify an encoding
>>> import hdf5plugin
>>> address = f"tcp://localhost:{xd.io.get_free_port()}" >>> encoding = {"chunks": (10, 10), **hdf5plugin.Zfp(accuracy=1e-6)} >>> publisher = ZMQPublisher(address, encoding) >>> for da in packets: ... publisher.submit(da)
Methods