|
Qudi
|
We call predefined generate methods a method that programmatically arranges PulseBlockElement instances in order to generate a PulseBlockEnsemble or PulseSequence instance without using the (graphical) pulse editors. In addition these methods also define the actual pulsed measurement they are designed for by adding all necessary measurement parameters to the created object instance dict attribute measurement_information.
For each predefined method properly included into qudi the GUI can automatically create an easy interface to create a pulsed measurement sequence with a custom parameter set.
Each generate method is a bound method of a child class of PredefinedGeneratorBase. This base class provides read-only access to important attributes of SequenceGeneratorLogic via properties. (see ./logic/pulsed/pulse_objects.py) For the generation you can therefore access all the information contained in SequenceGeneratorLogic, namely:
pulse_generator_settings (dict containing the current settings for the pulse generator hardware)generation_parameters (dict containing commonly used generation parameters, e.g. rabi_period, laser_channel etc.)channel_set (set of currently active analog and digital channels)analog_channels (set of currently active analog channels)digital_channels (set of currently active digital channels)laser_channel (string descriptor of the currently selected laser trigger channel)sync_channel (string descriptor of the currently selected counter sync trigger channel)gate_channel (string descriptor of the currently selected counter gate trigger channel)analog_trigger_voltage (logical high voltage in case an analog channel is used as trigger)laser_delay (the delay in seconds between the laser trigger and the actual laser exposure)microwave_channel (the pulse generator channel used for microwave generation)microwave_frequency (the microwave frequency to be used)microwave_amplitude (the microwave amplitude to be used)laser_length (dict containing the current settings for the fast counter hardware)wait_time (the wait time after a laser pulse before any microwave irradiation takes place)rabi_period (the rabi period of the spin to manipulate in seconds)sample_rate (the sampling rate of the hardware device)If you need access to another attribute of the logic module simply add it as property to PredefinedGeneratorBase but make sure to protect it properly against changes to the logic module.
The base class also provides commonly used helper methods to reduce code duplication in the actual generate methods. If you think a helper method of general interest is missing feel free to add it to the base class.
In addition the base class provides access to the qudi logger which can be used just like in any other qudi module, e.g. `self.log.warning('I am a warning!')`
All parameters needed for the generation that can not be provided by the logic module need to be handed over to the generation method directly as keyword arguments with default value.
When activating the SequenceGeneratorLogic, an instance of PulseObjectGenerator will be created. This class finds and imports all child classes of PredefinedGeneratorBase from the default directory ./logic/pulsed/predefined_generate_methods/. It will also inspect the generate methods and create two dictionaries. One is holding references to the method itself and the other contains the keyword arguments together with the currently set values for each generation method. In both cases the dictionary keys are the method names excluding the "generate_" naming prefix. Those two dictionaries can be accessed via properties of PulseObjectGenerator. The property holding the generation parameters is masked in order to only return or set the parameter set for the currently selected generation method.
Each generation method must meet the following requirements:
PredefinedGeneratorBase child classgenerate_name to give the instance to created a nameint, float, str, bool or Enum subclass. Depending on the default argument type the GUI will automatically create the proper input widget.PredefinedGeneratorBase as the ONLY parent class../logic/pulsed/predefined_generate_methods/) or put it in a custom directory and specify the path in your config for the SequenceGeneratorLogic as ConfigOption "additional_predefined_methods_path".You can also simply add your analysis method to an already existing PredefinedGeneratorBase child class. In that case you just need to follow step 3.
By default qudi ships with the default methods defined in ./logic/pulsed/predefined_generate_methods/basic_predefined_methods.py. This module should not be altered unless you intend to contribute your methods to the qudi repository.
A template for a new PredefinedGenerator class could look like:
If you have used an Enum subclass as a parameter type of a sampling function then you might want to wish to use the same Enum subclass in the predefined functions.
To do so, you will have to access the sampling function and grab the Enum subclass from there.
Attention: Be aware however that this requires the sampling function to be loaded and you have to make sure, that the Enum subclass you are wanting to access really exists. If you access an Enum subclass that does not exist without checking, the loading of qudi will fail!
The following example is requiring the template from the sampling functions:
Notice that the whole class definition is encapsulated in an if-clause and only is loaded, if the Enum-subclass-parameter can be found int the sampling functions.
1.8.13