pyrpl.software_modules package¶
Subpackages¶
- pyrpl.software_modules.lockbox package
- Subpackages
- Submodules
- pyrpl.software_modules.lockbox.gainoptimizer module
- pyrpl.software_modules.lockbox.input module
- pyrpl.software_modules.lockbox.lockbox module
- pyrpl.software_modules.lockbox.output module
- pyrpl.software_modules.lockbox.stage module
- Module contents
Submodules¶
pyrpl.software_modules.curve_viewer module¶
pyrpl.software_modules.loop module¶
Defines a number of Loop modules to be used to perform periodically a task
-
class
pyrpl.software_modules.loop.
Loop
(parent, name='loop', interval=1.0, autostart=True, loop_function=None, setup_function=None, teardown_function=None, **kwargs)[source]¶ Bases:
pyrpl.modules.Module
-
fpga_time
¶ current FPGA time in s since startup
-
interval
¶
-
setup
(**kwds)¶ - Sets the module up for acquisition with the current setup attribute values.
-
time
¶ time since start of the loop
-
trigger_time
¶ FPGA time in s when trigger even occured (same frame of reference as self.time())
-
-
class
pyrpl.software_modules.loop.
PlotLoop
(*args, **kwargs)[source]¶ Bases:
pyrpl.software_modules.loop.Loop
-
setup
(**kwds)¶ - Sets the module up for acquisition with the current setup attribute values.
-
-
class
pyrpl.software_modules.loop.
PlotWindow
(title='plotwindow')[source]¶ Bases:
object
makes a plot window where the x-axis is time since startup.
append(color=value) adds new data to the plot for color in (red, green).
close() closes the plot
pyrpl.software_modules.module_managers module¶
-
class
pyrpl.software_modules.module_managers.
Asgs
(parent, name=None)[source]¶ Bases:
pyrpl.software_modules.module_managers.ModuleManager
-
setup
(**kwds)¶ - Sets the module up for acquisition with the current setup attribute values.
-
-
class
pyrpl.software_modules.module_managers.
Iirs
(parent, name=None)[source]¶ Bases:
pyrpl.software_modules.module_managers.ModuleManager
Only one iir, but it should be protected by the slave/owner mechanism.
-
setup
(**kwds)¶ - Sets the module up for acquisition with the current setup attribute values.
-
-
exception
pyrpl.software_modules.module_managers.
InsufficientResourceError
[source]¶ Bases:
exceptions.ValueError
This exception is raised when trying to pop a module while there is none left.
-
class
pyrpl.software_modules.module_managers.
Iqs
(parent, name=None)[source]¶ Bases:
pyrpl.software_modules.module_managers.ModuleManager
-
setup
(**kwds)¶ - Sets the module up for acquisition with the current setup attribute values.
-
-
class
pyrpl.software_modules.module_managers.
ModuleManager
(parent, name=None)[source]¶ Bases:
pyrpl.modules.Module
Manages access to hardware modules. It is created from a list of hardware_modules to manage. For HardwareModules, ti is the manager module that is actually displayed in the gui.
- provides the following functions:
- pop(owner): gives the last module in the list that is currently
available, and locks it with the string “user” as owner of the hardware module - free(module): frees the module by reseting its user to None. (and enabling back its gui if any).
-
c
¶
-
hardware_module_names
¶ Looks in RedPitaya.modules to find how many modules are present. :return: list of all module names in redpitaya instance with a name looking like:
- some_module
- or some_module1, some_module2, some_module3 ...
-
pop
(owner=None)[source]¶ returns the first available module (starting from the end of the list) :param owner: (string): name of the module that is reserving the resource leave None if the gui shouldn’t be disabled. If no available module left, returns None.
To make sure the module will be freed afterwards, use the context manager construct: with pyrpl.mod_mag.pop(‘owner’) as mod:
mod.do_something()# module automatically freed at this point
-
setup
(**kwds)¶ - Sets the module up for acquisition with the current setup attribute values.
-
class
pyrpl.software_modules.module_managers.
Pids
(parent, name=None)[source]¶ Bases:
pyrpl.software_modules.module_managers.ModuleManager
-
setup
(**kwds)¶ - Sets the module up for acquisition with the current setup attribute values.
-
-
class
pyrpl.software_modules.module_managers.
Scopes
(parent, name=None)[source]¶ Bases:
pyrpl.software_modules.module_managers.ModuleManager
Only one scope, but it should be protected by the slave/owner mechanism.
-
setup
(**kwds)¶ - Sets the module up for acquisition with the current setup attribute values.
-
-
class
pyrpl.software_modules.module_managers.
Trigs
(parent, name=None)[source]¶ Bases:
pyrpl.software_modules.module_managers.ModuleManager
Only one trig, but it should be protected by the slave/owner mechanism.
-
setup
(**kwds)¶ - Sets the module up for acquisition with the current setup attribute values.
-
pyrpl.software_modules.network_analyzer module¶
-
class
pyrpl.software_modules.network_analyzer.
LogScaleProperty
(default=None, doc='', ignore_errors=False, call_setup=False)[source]¶
-
class
pyrpl.software_modules.network_analyzer.
NaAcBandwidth
(default=None, doc='', ignore_errors=False, call_setup=False)[source]¶
-
class
pyrpl.software_modules.network_analyzer.
NaAmplitudeProperty
(min=<MagicMock name='mock.inf.__neg__()' id='140551782582288'>, max=<MagicMock name='mock.inf' id='140551782527568'>, increment=0, log_increment=False, **kwargs)[source]¶
-
class
pyrpl.software_modules.network_analyzer.
NaCurveFuture
(module, min_delay_ms, autostart=True)[source]¶ Bases:
pyrpl.async_utils.PyrplFuture
-
N_POINT_BENCHMARK
= 100¶
-
-
class
pyrpl.software_modules.network_analyzer.
NaPointFuture
(module, point_index, min_delay_ms=0)[source]¶ Bases:
pyrpl.async_utils.PyrplFuture
Future object for a NetworkAnalyzer point.
-
class
pyrpl.software_modules.network_analyzer.
NaRunFuture
(module, min_delay_ms)[source]¶ Bases:
pyrpl.software_modules.network_analyzer.NaCurveFuture
-
class
pyrpl.software_modules.network_analyzer.
NetworkAnalyzer
(parent, name=None)[source]¶ Bases:
pyrpl.acquisition_module.AcquisitionModule
,pyrpl.modules.SignalModule
Using an IQ module, the network analyzer can measure the complex coherent response between an output and any signal in the redpitaya.
Three example ways on how to use the NetworkAnalyzer:
Example 1:
r = RedPitaya("1.1.1.1") na = NetworkAnalyzer(r) curve = na.curve(start=100, stop=1000, rbw=10...)
Example 2:
na.start = 100 na.stop = 1000 curve = na.curve(rbw=10)
Example 3:
na.setup(start=100, stop=1000, ...) for freq, response, amplitude in na.values(): print response
-
MIN_DELAY_CONTINUOUS_MS
= 0¶
-
MIN_DELAY_SINGLE_MS
= 0¶
-
acbandwidth
¶ Bandwidth of the input high-pass filter of the na.
-
amplitude
¶
-
avg_per_point
¶
-
current_freq
¶ current frequency during the scan
-
current_point
¶
-
data_avg
¶
-
data_x
¶ x-data for the network analyzer are computed during setup() and cached in the variable _data_x.
-
frequencies
¶ alias for data_x
Returns: frequency array
-
infer_open_loop_tf
¶
-
input
¶
-
inputs
¶
-
iq
¶ underlying iq module.
-
last_valid_point
¶
-
logscale
¶
-
measured_time_per_point
¶
-
output_direct
¶ Options – [‘off’, ‘out1’, ‘out2’, ‘both’]
-
output_directs
¶
-
points
¶
-
rbw
¶
-
setup
(**kwds)¶ -
trace_average
¶ number of curves to average in single mode. In continuous mode, a decaying average with a characteristic memory of ‘trace_average’ curves is performed.
-
curve_name
¶ name of the curve to save.
-
input
-
output_direct
Options: [‘off’, ‘out1’, ‘out2’, ‘both’]
acbandwidth: Bandwidth of the input high-pass filter of the na. start_freq: stop_freq: rbw: avg_per_point: points: amplitude: logscale: infer_open_loop_tf: running_state: Indicates whether the instrument is running acquisitions or not. SeeRunningStateProperty
for available options.-
-
start_freq
¶
-
stop_freq
¶
-
threshold_hook
(current_val)[source]¶ A convenience function to stop the run upon some condition (such as reaching of a threshold. current_val is the complex amplitude of the last data point).
To be overwritten in derived class... :param current_val:
-
trace_average
number of curves to average in single mode. In continuous mode, a decaying average with a characteristic memory of ‘trace_average’ curves is performed.
-
transfer_function
(frequencies, extradelay=0)[source]¶ Returns a complex np.array containing the transfer function of the current IQ module setting for the given frequency array. The given transfer function is only relevant if the module is used as a bandpass filter, i.e. with the setting (gain != 0). If extradelay = 0, only the default delay is taken into account, i.e. the propagation delay from input to output_signal.
Parameters: - frequencies (np.array or float) – Frequencies to compute the transfer function for
- extradelay (float) – External delay to add to the transfer function (in s). If zero, only the delay for internal propagation from input to output_signal is used. If the module is fed to analog inputs and outputs, an extra delay of the order of 200 ns must be passed as an argument for the correct delay modelisation.
Returns: tf – The complex open loop transfer function of the module.
Return type: np.array(.., dtype=np.complex)
pyrpl.software_modules.pyrpl_config module¶
-
class
pyrpl.software_modules.pyrpl_config.
PyrplConfig
(parent, name=None)[source]¶ Bases:
pyrpl.modules.Module
This Module allows the Gui to configure the global settins, such as redpitaya and pyrpl
-
configfile
¶
-
current_branch
¶
-
module
¶ this selector allows to choose which module is configured Options: [None]
-
setup
(**kwds)¶
-
text
¶
-
pyrpl.software_modules.software_pid module¶
-
class
pyrpl.software_modules.software_pid.
RunningProperty
(true_function=None, false_function=None, **kwargs)[source]¶ Bases:
pyrpl.attributes.LedProperty
-
false_function
(obj)¶ stops the running loop
-
true_function
(obj)¶ starts a new loop
-
-
class
pyrpl.software_modules.software_pid.
SoftwarePidController
(parent, name=None)[source]¶ Bases:
pyrpl.modules.Module
-
d
¶
-
i
¶
-
input
¶
-
interval
¶
-
output
¶
-
output_max
¶
-
output_min
¶
-
p
¶
-
plot
¶
-
plotter
¶
-
reset_ival_on_restart
¶
-
running
¶
-
setpoint
¶
-
setup
(**kwds)¶ - Sets the module up for acquisition with the current setup attribute values.
-
input
-
output
-
p
-
i
-
d
-
setpoint
-
reset_ival_on_restart
-
interval
-
plot
-
running
-
-
pyrpl.software_modules.spectrum_analyzer module¶
-
class
pyrpl.software_modules.spectrum_analyzer.
DecimationProperty
(options=[], **kwargs)[source]¶ Bases:
pyrpl.attributes.SelectProperty
Since the only integer number in [rbw, span, duration, decimation] is decimation, it is better to take it as the master property to avoid rounding problems. We don’t want to use the scope property because when the scope is not slaved, the value could be anything.
-
class
pyrpl.software_modules.spectrum_analyzer.
RbwProperty
(default=None, doc='', ignore_errors=False, call_setup=False)[source]¶
-
class
pyrpl.software_modules.spectrum_analyzer.
SpanFilterProperty
(default=None, doc='', ignore_errors=False, call_setup=False)[source]¶
-
class
pyrpl.software_modules.spectrum_analyzer.
SpecAnAcBandwidth
(default=None, doc='', ignore_errors=False, call_setup=False)[source]¶
-
class
pyrpl.software_modules.spectrum_analyzer.
SpectrumAnalyzer
(parent, name=None)[source]¶ Bases:
pyrpl.acquisition_module.AcquisitionModule
A spectrum analyzer is composed of an IQ demodulator, followed by a scope. The spectrum analyzer connections are made upon calling the function setup.
-
PADDING_FACTOR
= 16¶
-
acbandwidth
¶
-
baseband
¶
-
center
¶
-
curve_unit
¶ Options – [‘Vpk^2’]
-
data_length
¶
-
data_to_display_unit
(data, rbw)[source]¶ Converts the array ‘data’, assumed to be in ‘Vpk^2’, into display units. Since some units require a rbw for the conversion, it is an explicit argument of the function.
-
data_to_unit
(data, unit, rbw)[source]¶ Converts the array ‘data’, assumed to be in ‘Vpk^2’, into the specified unit. Unit can be anything in [‘Vpk^2’, ‘dB(Vpk^2)’, ‘Vrms^2’, ‘dB(Vrms^2)’, ‘Vrms’, ‘Vrms^2/Hz’]. Since some units require a rbw for the conversion, it is an explicit argument of the function.
-
data_x
¶
-
decimation
¶ Decimation setting for the scope.
-
display_cross_amplitude
¶ should cross-spectrum amplitude be displayed in baseband-mode?
-
display_cross_phase
¶ should cross-spectrum amplitude be displayed in baseband-mode?
-
display_input1_baseband
¶ should input1 spectrum be displayed in baseband-mode?
-
display_input2_baseband
¶ should input2 spectrum be displayed in baseband-mode?
-
display_unit
¶
-
duration
¶
-
equivalent_noise_bandwidth
()[source]¶ Returns the equivalent noise bandwidth of the current window. To get the residual bandwidth, this number has to be multiplied by the sample rate.
-
frequencies
¶ return – frequency array
-
if_filter_bandwidth_per_span
= 1.0¶
-
input
¶
-
input1_baseband
¶ input1 for baseband mode
-
input2_baseband
¶ input2 for baseband mode
-
inputs
¶
-
iq
¶
-
iq_quadraturesignal
= 'iq2_2'¶
-
nyquist_margin
= 1.0¶
-
quadrature_factor
= 1.0¶
-
rbw
¶ Residual Bandwidth, this is a readonly attribute, only span can be changed.
-
sampling_time
¶
-
save_curve
()[source]¶ Saves the curve(s) that is (are) currently displayed in the gui in the db_system. Also, returns the list [curve_ch1, curve_ch2]...
-
scope
¶
-
setup
(**kwds)¶ -
running_state
¶ Indicates whether the instrument is running acquisitions or not. See
RunningStateProperty
for available options.
-
trace_average
¶ number of curves to average in single mode. In continuous mode, a moving window average is performed.
-
curve_name
¶ name of the curve to save.
-
input
-
center
-
baseband
-
span
¶ Span can only be given by 1./sampling_time where sampling time is a valid scope sampling time.
-
window
¶
-
acbandwidth
-
display_unit
-
curve_unit
Options: [‘Vpk^2’]
display_input1_baseband: should input1 spectrum be displayed in baseband-mode? display_input2_baseband: should input2 spectrum be displayed in baseband-mode? input1_baseband: input1 for baseband mode input2_baseband: input2 for baseband mode display_cross_amplitude: should cross-spectrum amplitude be displayed in baseband-mode?-
-
span
Span can only be given by 1./sampling_time where sampling time is a valid scope sampling time.
-
spans
= [124999999.99999999, 62499999.99999999, 31249999.999999996, 15624999.999999998, 7812499.999999999, 3906249.9999999995, 1953124.9999999998, 976562.4999999999, 488281.24999999994, 244140.62499999997, 122070.31249999999, 61035.15624999999, 30517.578124999996, 15258.789062499998, 7629.394531249999, 3814.6972656249995, 1907.3486328124998]¶
-
transfer_function
(frequencies)[source]¶ Transfer function from the generation of quadratures to their sampling, including scope decimation. At the moment, delays are not taken into account (and the phase response is not guaranteed to be exact.
-
useful_index_obsolete
()[source]¶ Returns: a slice containing the portion of the spectrum between start and stop
-
window
-
windows
= ['blackman', 'flattop', 'boxcar', 'hamming']¶
-
-
class
pyrpl.software_modules.spectrum_analyzer.
WindowProperty
(options=[], **kwargs)[source]¶ Bases:
pyrpl.attributes.SelectProperty
Changing the filter window requires to recalculate the bandwidth