interface

Displays the results of the analysis to the user, using images and plots.

class hummingbird.interface.GUI(restore)[source]

Bases: QMainWindow, object

Main Window Class.

Contains only menus and toolbars. The plots will be in their own windows.

add_backend(data_source)[source]

Add backend to menu if it’s not there yet and append to _data_sources

clear()[source]

Closes all DataWindows and remove all DataSources

closeEvent(event)[source]

Save settings and exit nicely

property data_sources

Provide access to the GUI data sources

property data_windows

Provide access to the GUI data widows

instance = None
resizeEvent(event)[source]
restore_settings(do_restore, filename=None)[source]
save_data_windows()[source]

Save data windows state and data sources to the settings file

save_settings(filename=None)[source]
class hummingbird.interface.DataSource(parent, hostname, port, ssh_tunnel=None, conf={})[source]

Bases: QObject

Manages a connection with one backend

add_item_to_group_structure(title, group)[source]
property group_structure
property hostname

Give access to the data source hostname

name()[source]

Return a string representation of the data source

property plotdata

Returns the data source dictionary of plotdata

plotdata_added = None
property port

Give access to the data source port

query_configuration()[source]

Ask to the backend for the configuration

query_reloading()[source]

Ask the backend to reload its configuration

restore_state(state)[source]

Restores any plotdata that are saved in the state

property ssh_tunnel

Give access to the data source ssh_tunnel

subscribe(title, plot)[source]

Subscribe to the broadcast named title, and associate it with the given plot

subscribe_for_recording(title)[source]

Subscribe to the broadcast named title, and associate it with recorder

subscribed = None
property subscribed_titles

Returns the currently subscribed titles

unsubscribe(title, plot)[source]

Dissociate the given plot with the broadcast named title. If no one else is associated with it unsubscribe

unsubscribe_for_recording(title)[source]

Dissociate the recorder with the broadcast named title. If no one else is associated with it unsubscrine

unsubscribed = None
class hummingbird.interface.PlotData(parent, title, maxlen=1000, group=None)[source]

Bases: object

Stores the data associated with a given broadcast

append(y, x, l)[source]

Append the new data to the ringbuffers

clear()[source]

Clear the buffers

property group

Returns the plot group

property maxlen

Gives access to maximum size of the buffers

property nbytes

Returns the number of bytes taken by the three buffers

resize(new_maxlen)[source]

Change the capacity of the buffers

restore_state(state, parent)[source]

Restore a previous stored state

save_state(save_data=False)[source]

Return a serialized representation of the PlotData for saving to disk

snapshot()[source]

Returns a copy of the x,y and l ringbuffers

sum_over(y, x, l, op='sum')[source]
property title

Returns the plot data title

class hummingbird.interface.H5Recorder(outpath, maxFileSizeMB=1)[source]

Bases: object

Recording event variables to an HDF5 file.

Note

When reading from the recorder file, it might be necesssary to sort them using the timestamp before comparing different datasets.

append(title, data, data_x)[source]

Append a tuple of time and event variable to dataset with the name of the variable.

closefile()[source]

Close existing file.

openfile()[source]

Open new file using a unique filename.

class hummingbird.interface.RingBuffer(maxlen, data=None, index=0, length=0)[source]

Bases: object

Provides a ring buffer for scalar and numpy data. It’s always possible to retrieve the buffer data as a numpy array in O(1) This is achieve by always inserting two copies of any appended data, so it’s a bit slower to add data, and it takes twice as much memory as a regular buffer.

append(x)[source]

Append a value to the end of the buffer

clear()[source]

Empty the buffer

property max

Returns the maximum value in the buffer, like a numpy array

property min

Returns the minimum value in the buffer, like a numpy array

property nbytes

Returns the number of bytes taken by the buffer

property number_of_added_elements
resize(new_maxlen)[source]

Change the capacity of the buffers

static restore_state(state)[source]
save_state()[source]

Return a serialized representation of the RingBuffer for saving to disk

property shape

Returns the shape of the buffer, like a numpy array

class hummingbird.interface.ZmqContext(iothreads)[source]

Bases: object

Provides a singleton wrapper for a ZeroMQ context

static instance(iothreads=4)[source]

Returns the singleton instance of the ZeroMQ context

self_ = None
socket(socket_type)[source]

Creates and returns a socket of the given type

class hummingbird.interface.ZmqSocket(_type, parent=None, **kwargs)[source]

Bases: QObject

Wrapper around a zmq socket. Provides Qt signal handling

activity()[source]

Callback run when there’s activity on the socket

bind(addr)[source]

Bind socket to address

close()[source]

Close socket

closed = None
connect_socket(addr, tunnel=None)[source]

Connect socket to endpoint, possibly using an ssh tunnel The tunnel argument specifies the hostname of the ssh server to tunnel through. Note that this still succeeds even if there’s no ZMQ server on the other end as the connection is asynchronous. For more details check the zmq_connect(3) documentation.

identity()[source]

Return the zmq socket identity

init_socket()[source]
ready_read = None
ready_write = None
recv(flags=0)[source]

Receive a message on the socket

recv_array(flags=0, copy=True, track=False)[source]

Receive a numpy array

recv_json(flags=0)[source]

Receive and json decode a message on the socket

recv_multipart()[source]

Receive a multipart message on the socket

send(_msg)[source]

Send a message on the socket

send_multipart(_msg)[source]

Send a list of messages as a multipart message on the socket

set_identity(name)[source]

Set zmq socket identity

subscribe(title)[source]

Subscribe to a broadcast with the given title

unsubscribe(title)[source]

Unsubscribe to a broadcast with the given title

hummingbird.interface.start_interface(restore)[source]

Initialize and show the Interface