4.1.1.3.1.3. lib.simulation.experiment#

Main module for Multiflux simulation. Takes arbitrary number of molecules. Contains different classes in order to simulate a realistic experiment.

Construct Experiment, run experiment and perform an analysis (Study)

4.1.1.3.1.3.1. Module Contents#

4.1.1.3.1.3.1.1. Classes#

Experiment

Class to simulate an experiment. It can either perform an experiment from a Setup or create an experiment from a Record (e.g. experimental data)

ExperimentGenerator

Protocol

Describe the different measurements. Used as a recipe during an experiment on what kind of measurement to perform next.

Record

Class for measurement records. Inherits from Pattern-class and Trace-class Its attributes hold all information on the measurement sites, e.g. positions, incident brightness, PSF orientation etc.

Log

Class that provides logging capabilities to document steps in the program.

4.1.1.3.1.3.1.2. Data#

4.1.1.3.1.3.1.3. API#

lib.simulation.experiment.script_name = 'basename(...)'#
class lib.simulation.experiment.Experiment(**kwargs)#

Class to simulate an experiment. It can either perform an experiment from a Setup or create an experiment from a Record (e.g. experimental data)

Initialization

Initializes an instance of the Experiment class.

Parameters:

kwargs (dict) – Optional keyword arguments.

Returns:

None

Return type:

None

perform(mode='real')#

Method that performs an experiment. Do a Measurement with Setup according to Protocol. For each prompt in the protocol, apply settings to instrument and measurement. Then generate a pattern and retrieve photons. Lastly, combine them to the measurement record and go on to the next prompt.

Parameters:

mode (str) – The mode of the experiment.

Returns:

None

Return type:

None

interpret_prompt(prompt={})#

Method to interpret the measurement protocol. If the prompt is ‘estimate’, the machine updates certain parameters, e.g. center position and scan range for Minflux sequence. Otherwise, it tries to update the setup and measurement mode according to the prompt.

save(filename='experiment', folder=None)#

Save an experiment to a yaml file

load(path)#

Load an experiment from a yaml. :param path: path to yaml file :return: experiment object

save_as_tif()#
update(param_dict)#

Method to update an experiment.

class lib.simulation.experiment.ExperimentGenerator(**kwargs)#

Initialization

get_default(**kwargs)#

Create a default experiment. If a distance is provided, a random nanoruler with d is created. Otherwise, the same molecule position is used every time.

get_CRB_scan(mol_pos=np.array([[-10.0, -10.0], [10.0, 10.0]]), meas_pos=np.array([[-10.0, -10.0], [10.0, 10.0]]))#
class lib.simulation.experiment.Protocol(param_dict={})#

Describe the different measurements. Used as a recipe during an experiment on what kind of measurement to perform next.

Initialization

class lib.simulation.experiment.Record#

Bases: lib.simulation.setup.Trace, lib.simulation.measurement.Pattern

Class for measurement records. Inherits from Pattern-class and Trace-class Its attributes hold all information on the measurement sites, e.g. positions, incident brightness, PSF orientation etc.

Initialization

Initialization :param config: configuration object

truncate_record(record, n1, n2)#

Method to truncate the pattern of a record up to the n-th element (n-th element is not contained!) :param record: measurement record object :param n1: start idx :param n2: stop idx :return: modified MeasurementRecord object

pick_lines_from_record(record, n1, n2)#

Method to pick lines n1 through n2 from record. Used to construct a measurement record for a trace segment with a certain number of lines. line #n2 is not contained!

class lib.simulation.experiment.Log#

Class that provides logging capabilities to document steps in the program.

Initialization

register_entity()#

Method to register an object that has to be watched. Serves to document on-change behaviour of object.

unregister_entity()#
write_to_log()#
save_log()#