pyrpl.software_modules.lockbox package¶
Subpackages¶
Submodules¶
pyrpl.software_modules.lockbox.gainoptimizer module¶
-
class
pyrpl.software_modules.lockbox.gainoptimizer.
GainOptimizer
(parent, name=None)[source]¶ Bases:
pyrpl.software_modules.lockbox.LockboxModule
a module that is used to optimize the lockbox gain by setting the gain_factor of the lockbox to the integral of an error signal derived from the slope of the error signal rms value vs gain_factor
-
amplitude
¶
-
interval
¶
-
measurement_time
¶ Current gain factor of the gain correction mechanism.
-
plot
¶
-
setup
(**kwds)¶ - Sets the module up for acquisition with the current setup attribute values.
-
interval
-
amplitude
-
unity_gain_frequency
¶
-
plot
-
measurement_time
Current gain factor of the gain correction mechanism.
-
-
unity_gain_frequency
-
-
class
pyrpl.software_modules.lockbox.gainoptimizer.
GainOptimizerLoop
(*args, **kwargs)[source]¶ Bases:
pyrpl.software_modules.lockbox.LockboxPlotLoop
-
amplitude
¶ Amplitude of gain modulation for the estimation of the dependency of lock rms
-
current_gain_factor
¶ Current gain factor of the gain correction mechanism.
-
max_length
= 10¶
-
measurement_time
¶ Current gain factor of the gain correction mechanism.
-
pdh
¶
-
phase
¶
-
rms
¶
-
setup
(**kwds)¶ - Sets the module up for acquisition with the current setup attribute values.
-
unity_gain_frequency
¶ Unity gain frequency for the gain integrator.
-
pyrpl.software_modules.lockbox.input module¶
-
class
pyrpl.software_modules.lockbox.input.
CalibrationData
(parent, name=None)[source]¶ Bases:
pyrpl.software_modules.lockbox.LockboxModule
class to hold the calibration data of an input signal
-
amplitude
¶ small helper function for expected signal
-
get_stats_from_curve
(curve)[source]¶ gets the mean, min, max, rms value of curve (into the corresponding self’s attributes).
-
max
¶ max of the signal in V over a lockbox sweep
-
mean
¶ mean of the signal in V over a lockbox sweep
-
min
¶ min of the signal in V over a lockbox sweep
-
offset
¶ small helper function for expected signal
-
peak_to_peak
¶ small helper function for expected signal
-
rms
¶ rms of the signal in V over a lockbox sweep
-
setup
(**kwds)¶ - Sets the module up for acquisition with the current setup attribute values.
-
min
min of the signal in V over a lockbox sweep
-
max
max of the signal in V over a lockbox sweep
-
mean
mean of the signal in V over a lockbox sweep
-
rms
rms of the signal in V over a lockbox sweep
-
_analog_offset
¶ analog offset of the signal
-
_asg_phase
¶ Phase of the asg when error signal is centered in calibration. Not used by all signals.
-
-
-
class
pyrpl.software_modules.lockbox.input.
InputFromOutput
(parent, name=None)[source]¶ Bases:
pyrpl.software_modules.lockbox.input.InputDirect
-
expected_signal
(setpoint)[source]¶ it is assumed that the output has the linear relationship between setpoint change in output_unit per volt from the redpitaya, which is configured in the output parameter ‘dc_gain’. We only need to convert units to get the output voltage bringing about a given setpoint difference.
-
input_signal
¶ lockbox signal used as input
-
-
class
pyrpl.software_modules.lockbox.input.
InputIq
(parent, name=None)[source]¶ Bases:
pyrpl.software_modules.lockbox.input.InputSignal
Base class for demodulated signals. A derived class must implement the method expected_signal (see InputPdh in fabryperot.py for example)
-
acbandwidth
¶
-
bandwidth
¶
-
iq
¶
-
mod_amp
¶
-
mod_freq
¶
-
mod_output
¶ Options – [‘out1’, ‘out2’]
-
mod_phase
¶
-
quadrature_factor
¶
-
-
class
pyrpl.software_modules.lockbox.input.
InputSignal
(parent, name=None)[source]¶ Bases:
pyrpl.software_modules.lockbox.input.Signal
A Signal that corresponds to an inputsignal of the DSPModule inside the RedPitaya. Moreover, the signal should provide a function to convert the measured voltage into the value of the model’s physical variable in unit. The signal can be calibrated by taking a curve while scanning an output.
- input_channel: the redpitaya dsp input representing the signal
- min: min of the signal in V over a lockbox sweep
- max: max of the signal in V over a lockbox sweep
- mean: mean of the signal in V over a lockbox sweep
- rms: rms of the signal in V over a lockbox sweep
- acquire(): returns an experimental curve in V obtained from a sweep of
the lockbox. - calibrate(): acquires a curve and determines all constants needed by expected_signal - expected_signal(variable): to be reimplemented in concrete derived class: Returns the value of the expected signal in V, depending on the variable value. - expected_slope: returns the slope of the expected signal wrt variable at a given value of the variable. - relative_mean(self): returns the ratio between the measured mean value and the expected one. - relative_rms(self): returns the ratio between the measured rms value and the expected mean. - variable(): Estimates the model variable from the current value of the input.
-
calibrate
(autosave=False)[source]¶ This function should be reimplemented to measure whatever property of the curve is needed by expected_signal.
-
expected_signal
(variable)[source]¶ Returns the value of the expected signal in V, depending on the setpoint value “variable”.
-
expected_slope
(variable)[source]¶ Returns the slope of the expected signal wrt variable at a given value of the variable. May be overwritten by a more efficient (analytical) method in a derived class.
-
input_signal
¶ the dsp module or lockbox signal used as input signal
-
plot_range
= <MagicMock name='mock.linspace()' id='140551779791504'>¶
-
setup
(**kwds)¶ - Sets the module up for acquisition with the current setup attribute values.
-
input_signal
the dsp module or lockbox signal used as input signal
-
calibration_data
¶
-
-
class
pyrpl.software_modules.lockbox.input.
IqFilterProperty
(default=None, doc='', ignore_errors=False, call_setup=False)[source]¶
-
class
pyrpl.software_modules.lockbox.input.
IqQuadratureFactorProperty
(min=<MagicMock name='mock.inf.__neg__()' id='140551782582288'>, max=<MagicMock name='mock.inf' id='140551782527568'>, increment=0, log_increment=False, **kwargs)[source]¶ Bases:
pyrpl.attributes.FloatProperty
this is a direct link to quadrature_factor because we want to benefit from its validate_and_normalize function
-
class
pyrpl.software_modules.lockbox.input.
Signal
(parent, name=None)[source]¶ Bases:
pyrpl.software_modules.lockbox.LockboxModule
,pyrpl.modules.SignalModule
represention of a physial signal. Can be either an imput or output signal.
-
calibration_data
¶
-
diagnostics
(duration=1.0)[source]¶ example code for lock diagnostics:
Parameters: duration (duration over which to average) – Returns: Return type: relative rms of the signal, normalized by
-
get_analog_offset
(duration=1.0)[source]¶ function to acquire the analog offset of the signal (with nothing connected). This offset is subtracted from all raw signals
-
max
¶
-
mean
¶
-
min
¶
-
relative_mean
¶ returns the ratio between the measured mean value and the expected one.
-
relative_rms
¶ returns the ratio between the measured rms value and the expected mean.
-
rms
¶
-
sampler_time
¶ specifies the duration over which to sample a signal
-
setup
(**kwds)¶ - Sets the module up for acquisition with the current setup attribute values.
-
calibration_data
-
-
pyrpl.software_modules.lockbox.lockbox module¶
-
class
pyrpl.software_modules.lockbox.lockbox.
AutoLockIntervalProperty
(min=<MagicMock name='mock.inf.__neg__()' id='140551782582288'>, max=<MagicMock name='mock.inf' id='140551782527568'>, increment=0, log_increment=False, **kwargs)[source]¶ Bases:
pyrpl.attributes.FloatProperty
timeout for autolock timer
-
class
pyrpl.software_modules.lockbox.lockbox.
AutoLockProperty
(default=None, doc='', ignore_errors=False, call_setup=False)[source]¶ Bases:
pyrpl.attributes.BoolProperty
true if autolock is enabled
-
class
pyrpl.software_modules.lockbox.lockbox.
ClassnameProperty
(options=[], **kwargs)[source]¶ Bases:
pyrpl.attributes.SelectProperty
Lots of lockbox attributes need to be updated when model is changed
-
class
pyrpl.software_modules.lockbox.lockbox.
Lockbox
(parent, name=None)[source]¶ Bases:
pyrpl.software_modules.lockbox.LockboxModule
A Module that allows to perform feedback on systems that are well described by a physical model.
-
asg
¶ the asg being used for sweeps
-
auto_lock
¶ Turns on the autolock of the module.
-
auto_lock_interval
¶
-
classname
¶
-
current_stage
¶
-
current_state
¶
-
default_sweep_output
¶ Options – [None]
-
final_stage
¶ temporary storage of the final lock stage
-
get_analog_offsets
(duration=1.0)[source]¶ Measures and saves the analog offset for all inputs.
This function is designed to measure the analog offsets of the redpitaya inputs and possibly the sensors connected to these inputs. Only call this function if you are sure about what you are doing and if all signal sources (lasers etc.) are turned off.
The parameter duration specifies the time during which to average the input offsets.
-
inputs
¶
-
is_locked
(input=None, loglevel=20)[source]¶ returns True if locked, else False. Also updates an internal dict that contains information about the current error signals. The state of lock is logged at loglevel
-
is_locked_threshold
¶ Setpoint interval size to consider system in locked state
-
lock
(**kwds)[source]¶ Launches the full lock sequence, stage by stage until the end. optional kwds are stage attributes that are set after iteration through the sequence, e.g. a modified setpoint.
-
lockstatus_interval
¶
-
outputs
¶
-
params
¶ returns a convenient dict with parameters that describe if and with which settings the lockbox was properly.
params from different Pyrpl lockboxes can be merged together without problems if the names of the config files differ
-
relock
(test_auto_lock=False, **kwargs)[source]¶ locks the cavity if it is_locked is false. Returns the value of is_locked
-
sequence
¶
-
setpoint_unit
¶ Options – [‘V’]
-
setup
(**kwds)¶ - Sets the module up for acquisition with the current setup attribute values.
-
classname
-
default_sweep_output
Options: [None]
auto_lock: Turns on the autolock of the module. is_locked_threshold: Setpoint interval size to consider system in locked state setpoint_unit:Options: [‘V’]
auto_lock_interval: lockstatus_interval: _auto_lock_timeout: maximum time that a locking stage is allowed to take before a lock is considered as stalled. sequence: inputs: _auto_lock_loop: outputs: _lockstatus_loop: -
-
signals
¶ a dict of all logical signals of the lockbox
-
-
class
pyrpl.software_modules.lockbox.lockbox.
LockstatusIntervalProperty
(min=<MagicMock name='mock.inf.__neg__()' id='140551782582288'>, max=<MagicMock name='mock.inf' id='140551782527568'>, increment=0, log_increment=False, **kwargs)[source]¶ Bases:
pyrpl.attributes.FloatProperty
timeout for lockstatus timer
-
class
pyrpl.software_modules.lockbox.lockbox.
SignalLauncherLockbox
(module)[source]¶ Bases:
pyrpl.modules.SignalLauncher
A SignalLauncher for the lockbox
-
add_input
= <MagicMock name='mock.QtCore.Signal()' id='140551782370384'>¶
-
delete_widget
= <MagicMock name='mock.QtCore.Signal()' id='140551782370384'>¶
-
input_calibrated
= <MagicMock name='mock.QtCore.Signal()' id='140551782370384'>¶
-
output_created
= <MagicMock name='mock.QtCore.Signal()' id='140551782370384'>¶
-
output_deleted
= <MagicMock name='mock.QtCore.Signal()' id='140551782370384'>¶
-
output_renamed
= <MagicMock name='mock.QtCore.Signal()' id='140551782370384'>¶
-
remove_input
= <MagicMock name='mock.QtCore.Signal()' id='140551782370384'>¶
-
stage_created
= <MagicMock name='mock.QtCore.Signal()' id='140551782370384'>¶
-
stage_deleted
= <MagicMock name='mock.QtCore.Signal()' id='140551782370384'>¶
-
stage_renamed
= <MagicMock name='mock.QtCore.Signal()' id='140551782370384'>¶
-
state_changed
= <MagicMock name='mock.QtCore.Signal()' id='140551782370384'>¶
-
update_lockstatus
= <MagicMock name='mock.QtCore.Signal()' id='140551782370384'>¶
-
update_transfer_function
= <MagicMock name='mock.QtCore.Signal()' id='140551782370384'>¶
-
pyrpl.software_modules.lockbox.output module¶
-
class
pyrpl.software_modules.lockbox.output.
AdditionalFilterAttribute
(default=None, doc='', ignore_errors=False, call_setup=False)[source]¶
-
class
pyrpl.software_modules.lockbox.output.
OutputSignal
(parent, name=None)[source]¶ Bases:
pyrpl.software_modules.lockbox.input.Signal
As many output signals as desired can be added to the lockbox. Each output defines:
- name: the name of the output.
- dc_gain: how much the model’s variable is expected to change for 1 V on the output (in unit)
- unit: see above, should be one of the units available in the model.
- sweep_amplitude/offset/frequency/waveform: what properties to use when sweeping the output
- output_channel: what physical output is used.
- p/i: the gains to use in a loop: those values are to be understood as full loop gains (p in [1], i in [Hz])
- additional_filter: a filter (4 cut-off frequencies) to add to the loop (in sweep and lock mode)
- extra_module: extra module to add just before the output (usually iir).
- extra_module_state: name of the state to use for the extra_module.
- tf_curve: the index of the curve describing the analog transfer function behind the output.
- tf_filter: alternatively, the analog transfer function can be specified by a filter (4 cut-off frequencies).
- desired_unity_gain_frequency: desired value for unity gain frequency.
- tf_type: [“flat”, “curve”, “filter”], how is the analog transfer function specified.
-
additional_filter
¶
-
analog_filter_cutoff
¶
-
assisted_design
¶
-
current_state
¶ Options – [‘lock’, ‘unlock’, ‘sweep’]
-
dc_gain
¶
-
desired_unity_gain_frequency
¶
-
extra_module
¶ Options – [‘None’, ‘iir’, ‘pid’, ‘iq’]
-
extra_module_state
¶ Options – [‘None’]
-
i
¶
-
is_saturated
¶ returns: * True (if the output has saturated) * False (otherwise)
-
lock
(input=None, setpoint=None, offset=None, gain_factor=None)[source]¶ Closes the lock loop, using the required p and i parameters.
-
max_voltage
¶ positive saturation voltage
-
min_voltage
¶ negative saturation voltage
-
output_channel
¶ Options – [‘out1’, ‘out2’, ‘pwm0’, ‘pwm1’]
-
p
¶
-
pid
¶
-
setup
(**kwds)¶ -
unit
¶
Options: [None]
sweep_amplitude: sweep_offset: sweep_frequency: sweep_waveform:Options: [‘sin’, ‘cos’, ‘ramp’, ‘halframp’, ‘square’, ‘dc’, ‘noise’]
dc_gain: output_channel:Options: [‘out1’, ‘out2’, ‘pwm0’, ‘pwm1’]
p: i: additional_filter: analog_filter_cutoff: extra_module:Options: [‘None’, ‘iir’, ‘pid’, ‘iq’]
extra_module_state:Options: [‘None’]
desired_unity_gain_frequency: max_voltage: positive saturation voltage min_voltage: negative saturation voltage assisted_design: tf_curve: tf_type:Options: [‘flat’, ‘filter’, ‘curve’]
calibration_data:-
-
sweep_amplitude
¶
-
sweep_frequency
¶
-
sweep_offset
¶
-
sweep_waveform
¶ Options – [‘sin’, ‘cos’, ‘ramp’, ‘halframp’, ‘square’, ‘dc’, ‘noise’]
-
tf_curve
¶
-
tf_freqs
()[source]¶ Frequency values to plot the transfer function. Frequency (abcissa) of the tf_curve if tf_type==”curve”, else: logspace(0, 6, 20000)
-
tf_type
¶ Options – [‘flat’, ‘filter’, ‘curve’]
-
unit
Options – [None]
-
class
pyrpl.software_modules.lockbox.output.
PiezoOutput
(parent, name=None)[source]¶ Bases:
pyrpl.software_modules.lockbox.output.OutputSignal
-
setup
(**kwds)¶ -
unit
¶
Options: [None]
sweep_amplitude: sweep_offset: sweep_frequency: sweep_waveform:Options: [‘sin’, ‘cos’, ‘ramp’, ‘halframp’, ‘square’, ‘dc’, ‘noise’]
dc_gain: output_channel:Options: [‘out1’, ‘out2’, ‘pwm0’, ‘pwm1’]
p: i: additional_filter: analog_filter_cutoff: extra_module:Options: [‘None’, ‘iir’, ‘pid’, ‘iq’]
extra_module_state:Options: [‘None’]
desired_unity_gain_frequency: max_voltage: positive saturation voltage min_voltage: negative saturation voltage assisted_design: tf_curve: tf_type:Options: [‘flat’, ‘filter’, ‘curve’]
calibration_data:-
-
unit
Options – [None]
-
pyrpl.software_modules.lockbox.stage module¶
-
class
pyrpl.software_modules.lockbox.stage.
Stage
(parent, name=None)[source]¶ Bases:
pyrpl.software_modules.lockbox.LockboxModule
A stage is a single step in the lock acquisition process
-
duration
¶
-
function_call
¶
-
gain_factor
¶
-
input
¶
-
outputs
¶
-
setpoint
¶
-
setup
(**kwds)¶ -
input
-
setpoint
-
duration
-
gain_factor
-
function_call
-
outputs
-
-
-
class
pyrpl.software_modules.lockbox.stage.
StageInputSelectProperty
(options=<function all_inputs_keys>, **kwargs)[source]¶
-
class
pyrpl.software_modules.lockbox.stage.
StageOutput
(parent, name=None)[source]¶ Bases:
pyrpl.software_modules.lockbox.LockboxModule
-
lock_on
¶
-
offset
¶
-
reset_offset
¶
-
setup
(**kwds)¶ -
lock_on
-
reset_offset
-
offset
-
-
-
class
pyrpl.software_modules.lockbox.stage.
StageSignalLauncher
(module)[source]¶ Bases:
pyrpl.modules.SignalLauncher
-
stage_created
= <MagicMock name='mock.QtCore.Signal()' id='140551782370384'>¶
-
stage_deleted
= <MagicMock name='mock.QtCore.Signal()' id='140551782370384'>¶
-
Module contents¶
-
class
pyrpl.software_modules.lockbox.
LockboxLoop
(parent, name='loop', interval=1.0, autostart=True, loop_function=None, setup_function=None, teardown_function=None, **kwargs)[source]¶ Bases:
pyrpl.software_modules.loop.Loop
,pyrpl.software_modules.lockbox.LockboxModule
A Loop with a property ‘lockbox’ referring to the lockbox
-
setup
(**kwds)¶ - Sets the module up for acquisition with the current setup attribute values.
-
-
class
pyrpl.software_modules.lockbox.
LockboxModule
(parent, name=None)[source]¶ Bases:
pyrpl.modules.Module
-
lockbox
¶
-
setup
(**kwds)¶ - Sets the module up for acquisition with the current setup attribute values.
-
-
class
pyrpl.software_modules.lockbox.
LockboxModuleDictProperty
(module_cls=None, default=None, doc='', ignore_errors=False, **kwargs)[source]¶ Bases:
pyrpl.module_attributes.ModuleDictProperty
-
default_module_cls
¶ alias of
LockboxModule
-
-
class
pyrpl.software_modules.lockbox.
LockboxPlotLoop
(*args, **kwargs)[source]¶ Bases:
pyrpl.software_modules.loop.PlotLoop
,pyrpl.software_modules.lockbox.LockboxLoop
A PlotLoop with a property ‘lockbox’ referring to the lockbox
-
setup
(**kwds)¶ - Sets the module up for acquisition with the current setup attribute values.
-