main module

This module brings together the model and view of the devices. It implements the construction of the GUI and controls the sampling.

To ensure continuous sampling, each device is run in a separate QThread. Communication with the main thread is implemented using pyqtSignals that trigger the data acquisition / GUI update.

This module contains the controller-part of multilog. It sets up the communication between device and visualization and manages the sampling loop.

class multilog.main.Controller(config, output_dir)

Main class controlling multilog’s sampling and data visualization.

__init__(config, output_dir) None

Initialize and run multilog.

Parameters:
  • config (str) – File path of configuration file.

  • output_dir (str) – Directory where to put the output.

exit()

This is executed when the exit button is clicked.

init_output_files()

Create directory for sampling and initialize output files.

sample_camera()

Function that triggers sampling & saving of data for cameras. This function is called by a timer and leads to a call of the sample function of the Sampler objects (running in their respective threads).

sample_main()

Function that triggers sampling & saving of data. This function is called by a timer and leads to a call of the sample function of the Sampler objects (running in their respective threads).

signal_Vifcon
signal_sample_camera
signal_sample_main
signal_update_camera
signal_update_main
start()

This is executed when the start button is clicked.

update_camera()

Function that triggers graphics update for cameras (without saving). This function is called by a timer and leads to a call of the update function of the Sampler objects (running in their respective threads).

update_main()

Function that triggers sampling after startup (without saving). This function is called by a timer and leads to a call of the update function of the Sampler objects (running in their respective threads).

update_view(device_sampling)

Update the view for selected devices. This is called by the Sampler class’s update function (using a signal).

Parameters:

device_sampling (dict) – {device-name: sampling}

write_metadata()

Write a csv file with information about multilog version, python version and operating system.

write_nomad_file()

Write main multilog.archive.yaml including an overview of all devices.

class multilog.main.Sampler(devices)

This class is used to sample the devices from separate threads.

__init__(devices)

Create sampler object

Parameters:

devices (dict) – devices to be sampled.

sample(time)

Sampling during recording. Data is visualized and saved.

Parameters:

time (datetime) – Global timestamp of sampling step.

signal
update()

Sampling during initialization. Data is not saved.

class multilog.main.SignalMetaclass(name, bases, dct)

Metaclass used to create new signals on the fly, required to setup Sampler class, see https://stackoverflow.com/questions/50294652/is-it-possible-to-create-pyqtsignals-on-instances-at-runtime-without-using-class

multilog.main.main(config, output_dir)

Execute this function to run multilog.

Parameters:
  • config (str) – File path of configuration file.

  • output_dir (str) – Directory where to put the output.