hardware module¶
Hardware configuration common to all modes of operation.
Detailed information is provided in the documentation for each class:
Interface to the Vivace/Presto hardware. |
|
Configuration options for multiband operation on a tile |
|
Select trigger source for starting a pulsed measurement |
|
Configuration for analog-to-digital converters (ADC), i.e. input channels. |
|
Configuration for digital-to-analog converters (DAC), i.e. output channels. |
|
Sampling rate setting for analog-to-digital converters (ADC), i.e. input channels. |
|
Sampling rate setting for digital-to-analog converters (DAC), i.e. output channels. |
Advanced tile configuration¶
It is possible to specify different converter modes and converter rates on groups (tiles) of different input/output ports, depending on the available hardware. The tiles configurations are as follows:
Tile |
8-channels Vivace |
8-channel Presto |
16-channel Presto |
---|---|---|---|
ADC0 |
input ports 1-2 |
input ports 1-2 |
input ports 1-4 |
ADC1 |
input ports 3-4 |
input ports 3-4 |
input ports 5-8 |
ADC2 |
input ports 5-6 |
input ports 5-6 |
input ports 9-12 |
ADC3 |
input ports 7-8 |
input ports 7-8 |
input ports 13-16 |
DAC0 |
output ports 1-4 |
output ports 1-2 |
output ports 1-4 |
DAC1 |
output ports 5-8 |
output ports 3-4 |
output ports 5-8 |
DAC2 |
output ports 5-6 |
output ports 9-12 |
|
DAC3 |
output ports 7-8 |
output ports 13-16 |
- For example, on an 8-channel Presto hardware setting the parameters:
- adc_mode=AdcMode.Directadc_fsample=[AdcFSample.G4, AdcFSample.G2, AdcFSample.G2, AdcFSample.G2]dac_mode=[DacMode.Mixed42, DacMode.Mixed42, DacMode.Mixed02, DacMode.Mixed02]dac_fsample=DacFSample.G6
- will configure:
- all the input ports in direct mode;input ports 1-2 to sample at 4 GS/s and ports 3-8 at 2 GS/s;output ports 1-4 to use the Mixed42 mode and ports 5-8 the Mixed02 mode;all output ports to synthesize at 6 GS/s.
Hardware class¶
- class presto.hardware.Hardware(address=None, port=None, dry_run=False, adc_bus_width=4, dac_bus_width=4, adc_fab_rate=500.0, dac_fab_rate=500.0)¶
Interface to the Vivace/Presto hardware.
This class does not need to be instantiated by the user. It is available as the
hardware
attribute of instances ofLockin
andPulsed
classes.Examples
Configure digital IQ mixers:
>>> from presto.hardware import AdcMode, DacMode >>> from presto import lockin >>> with lockin.Lockin(adc_mode=AdcMode.Mixed, dac_mode=DacMixed02) as lck: >>> lck.hardware.configure_mixer( >>> freq=3.5e+9, # 3.5 GHz >>> in_ports=1, >>> out_ports=[1, 2], >>> )
- assert_errors()¶
Print errors from the hardware and raise an exception if there were any.
- Raises:
RuntimeError – if any error has occurred
See also
- blank_output(ports, state)¶
Disable the output port(s). Has no effect on the DC bias.
The new setting is applied immediately.
- close()¶
Close the connection to the hardware
This method is called automatically upon exit from a with block
- configure_mixer(freq, *, in_ports=None, out_ports=None, in_zone=None, out_zone=None, in_phase=0.0, out_phase=0.0, sync=True, tune=True)¶
Configure the NCO for the digital IQ mixers.
- Parameters:
freq (
float
) – frequency of the numerically-controlled oscillator (NCO) in Hzin_ports (int or list of int) – configure downconversion for ports in
in_ports
out_ports (int or list of int) – configure upconversion for ports in
out_ports
in_zone (
Optional
[int
]) – optimize downconversion mixer for operation in thein_zone
th Nyquist band. IfNone
(default), choose appropriate zone automaticallyout_zone (
Optional
[int
]) – optimize upconversion mixer for operation in theout_zone
th Nyquist band. IfNone
(default), choose appropriate zone automaticallyin_phase (
float
) – phase of the numerically-controlled oscillator (NCO) in radians for each input portout_phase (
float
) – phase of the numerically-controlled oscillator (NCO) in radians for each output portsync (
bool
) – deprecated since version 2.12.0, see Notes section below.tune (
bool
) – ifTrue
(default), avoid long-term drifts between ports by roundingfreq
so that it is representable exactly by the NCOs in all input and output ports. IfFalse
,freq
is programmed as-is into the different NCOs and a small frequency mismatch (at most 40 μHz) can occur between different channels, leading to a slow phase drift (at most 0.8 deg/min).
Examples
>>> from presto.hardware import AdcMode, DacMode >>> from presto import lockin >>> with lockin.Lockin(adc_mode=AdcMode.Mixed, dac_mode=DacMixed02) as lck: >>> lck.hardware.configure_mixer( >>> freq=3.5e+9, # 3.5 GHz >>> in_ports=1, >>> out_ports=1, >>> ) >>> lck.hardware.configure_mixer( >>> freq=3.6e+9, # 3.6 GHz >>> out_ports=2, >>> ) >>> lck.hardware.configure_mixer( >>> freq=3.7e+9, # 3.7 GHz >>> out_ports=3, >>> )
Notes
The
sync
parameter is deprecated since version 2.12.0. Starting from that version, when using the autoconfiguration feature all calls toconfigure_mixer
are handled simultaneously at the next call toLockin.apply_settings()
orPulsed.run()
. See Synchronize multiple mixersOn versions prior to 2.12.0, or when not using the autoconfiguration feature, the behavior of the
sync
parameter is as follows: ifTrue
(default), issue async()
event to align the phase of the NCO forin_ports
andout_ports
. When using multiple calls to configure different NCO frequencies on different ports, setsync=True
only on the last call to ensure that all NCO phases align.See also
configure_mixer_base_n()
: require strict rational relation between different frequencies on different ports.
- configure_mixer_base_n(base_freq, *, in_n=None, out_n=None, in_ports=None, out_ports=None, in_zone=None, out_zone=None, in_phase=0.0, out_phase=0.0, sync=True, tune=True)¶
Configure the NCO for the digital IQ mixers with strict integer requirements.
This method is a variant of
configure_mixer()
that allows the user to express the desired frequencies on multiple ports as integer multiples of a common base frequency. It is useful to ensure that, even after small rounding errors in the digital domain, the final frequencies programmed in the NCOs maintain the desired rational relation to each other.- Parameters:
base_freq (
float
) – base frequency of the numerically-controlled oscillator (NCO) in Hzin_n (int or list of int) – input frequencies as multiples of
base_freq
out_n (int or list of int) – output frequencies as multiples of
base_freq
in_ports (int or list of int) – configure downconversion for ports in
in_ports
out_ports (int or list of int) – configure upconversion for ports in
out_ports
in_zone (
Optional
[int
]) – optimize downconversion mixer for operation in thein_zone
th Nyquist band. IfNone
(default), choose appropriate zone automaticallyout_zone (
Optional
[int
]) – optimize upconversion mixer for operation in theout_zone
th Nyquist band. IfNone
(default), choose appropriate zone automaticallyin_phase (
float
) – phase of the numerically-controlled oscillator (NCO) in radians for each input portout_phase (
float
) – phase of the numerically-controlled oscillator (NCO) in radians for each output portsync (
bool
) – deprecated since version 2.12.0, see Notes section below.tune (
bool
) – ifTrue
(default), avoid long-term drifts between ports by roundingfreq
so that it is representable exactly by the NCOs in all input and output ports. IfFalse
,freq
is programmed as-is into the different NCOs and a small frequency mismatch (at most 40 μHz) can occur between different channels, leading to a slow phase drift (at most 0.8 deg/min).
Examples
Configure 240 MHz on port 1 and 720 MHz on port 2, ensuring that the frequency on port 2 is exactly three times the frequency on port 1:
>>> from presto.hardware import AdcMode, DacMode >>> from presto import lockin >>> with lockin.Lockin(adc_mode=AdcMode.Mixed, dac_mode=DacMixed) as lck: >>> lck.hardware.configure_mixer_base_n( >>> base_freq=2.4e8, # 240 MHz base frequency >>> in_n=1, # 240 MHz carrier... >>> in_ports=1, # ...on input port 1 >>> out_n=[1, 3], # 240 MHz and 720 MHz carriers... >>> out_ports=[1, 2], # ...on output ports 1 and 2 >>> )
Notes
See
configure_mixer()
for additional notes.
- disable_coeff_override()¶
Disable the override on ADC calibration coefficients.
Note
This will re-enable the background calibration, in case it was disabled by
restore_cal_coeff()
.See also
- format_errors()¶
Format error messages from the hardware, ready for printing.
- Return type:
- Returns:
a formatted string containing the errors, or an empty string.
See also
- get_dc_bias(port, get_range=False)¶
Get the DC bias programmed on the output ports.
- Parameters:
port (
int
) – Output port. See Notes inset_dc_bias()
for valid ports.get_range (
bool
) – IfTrue
, return also the current rangerange_i
.
- Return type:
- Returns:
The return value depends on the optional
get_range
parameter.if
get_range=False
(default), returns:bias
: The DC bias currently set in units of volts (V) on Presto hardware,or in full-scale units (FS) on Vivace hardware.
if
get_range=True
, return a tuple containing:bias
: like aboverange_i
: The range currently set, only present ifget_range=True
.See
set_dc_bias()
for available ranges.
- Raises:
ValueError – If
port
is outside valid range.
See also
- get_errors()¶
Get error messages, if any, from the hardware.
- Return type:
- Returns:
a list of error messages. If there’s no error, returns an empty list.
See also
- get_input_delay(port)¶
Retrieve the digital delay programmed on an input port.
- Parameters:
port (
int
) – input port number- Return type:
- Returns:
delay in units of ADC sampling clock
See also
- get_input_multiband(tile)¶
Return current multiband configuration on an input tile.
- Parameters:
tile (
int
) – group of ports affected by multiband, valid values are in[0, 3]
. See Advanced tile configuration for port grouping.- Return type:
See also
- get_output_delay(port)¶
Retrieve the digital delay programmed on an output port.
- Parameters:
port (
int
) – output port number- Return type:
- Returns:
delay in units of DAC sampling clock
See also
- get_output_multiband(tile)¶
Return current multiband configuration on an output tile.
- Parameters:
tile (
int
) – group of ports affected by multiband, valid values are in[0, 3]
. See Advanced tile configuration for port grouping.- Return type:
Note
Output multiband is currently not supported on Presto-8 hardware.
See also
- get_rpu_param(index)¶
Read a parameter from the real-time processor (RPU).
The available indexes and the meaning of the parameter values are dependent on the user-defined algorithm running on the RPU.
Warning
This method is experimental and the exposed API might change in future releases.
- Parameters:
index (
int
) – which parameter to read, starting from index 0.- Return type:
- Returns:
the value of the parameter at index, as a 64-bit integer.
See also
- ramp_dc_bias(bias, port, rate)¶
Ramp the output DC bias from the current voltage to a new voltage with a specified rate of change.
- Parameters:
bias (
float
) – Target DC bias value. Must be within the previously selected range.port (int or array_like) – Output port, if
None
set DC bias for all ports. See Notes inset_dc_bias()
for valid ports.rate (
float
) – The rate in V/s at which the bias should change from the current value to the new one.
- Raises:
ValueError – If
bias
orport
are outside valid range; ifrate
is zero; ifcurrent range is not equal on all ports in port. –
Notes
When ramping multiple ports from different initial DC bias, all ports will reach the final
bias
at the same time. This means that the ports will ramp at different rates. In this case,rate
sets the fastest rate, i.e. the rate for the port with the largest requested change in DC bias.Examples
>>> from presto import lockin >>> with lockin.Lockin() as lck: >>> # set a bias of -2 V with range ±10.0 V >>> # active immediately >>> lck.hardware.set_dc_bias( >>> bias=-2.0, # -2 V >>> port=1, >>> range_i=4, # ±10.0V >>> ) >>> # slowly ramp bias voltage from -2 V to +2 V in 8 seconds >>> lck.hardware.ramp_dc_bias( >>> bias=+2.0, # +2 V >>> port=1, >>> rate=0.5, # 0.5 V/s >>> )
See also
- restore_cal_coeff()¶
Restore previously-saved coefficients for the background calibration of the input ports (ADC).
Note
This will disable the background calibration. To re-enable, see
disable_coeff_override()
.See also
- save_cal_coeff()¶
Save the current coefficients for the background calibration of the input ports (ADC).
See also
- set_adc_attenuation(ports, attenuation)¶
Set the attenuation of the input ports (ADC)
Results in changing the analog range of the input. Only on Presto hardware.
The new setting is applied immediately.
- set_cal_freeze(freeze)¶
Deprecated since version 2.13.0: Use
save_cal_coeff()
andrestore_cal_coeff()
instead.
- set_dac_current(ports, current_ua)¶
Set the full-scale current of the output ports (DAC)
Results in changing the analog range of the output.
The new setting is applied immediately.
- Parameters:
Notes
On Vivace hardware, valid values for
current_ua
are20_000
(20 mA) and32_000
(32 mA). On Presto hardware, valid values range from2_250
(2.25 mA) to40_500
(40.5 mA) in steps of 43.75 μA.
- set_dac_lownoise(ports, low_noise)¶
Optimize DAC output for low-noise or high-linearity operation.
The new setting is applied immediately.
- set_dc_bias(bias, port, range_i=None)¶
Set a DC bias on the output ports.
The new setting is applied immediately.
- Parameters:
bias (
float
) – DC bias value. Must be within the selected range.port (int or array_like) – Output port, if
None
set DC bias for all ports. See Notes for valid ports.range_i (
Optional
[int
]) – Range setting for DC bias DAC. On Vivace hardware this setting is ignored and the selected range is always ±1.0 FS. On Presto hardware, the default behavior is to auto-select an appropriate range based on the value ofbias
. See Notes for other available options.
- Raises:
ValueError – If
bias
orport
are outside valid range.
Notes
On Vivace hardware, the DC bias is applied to the RF output ports by means of a internal bias tees; as such, valid values for
port
are in the interval[1,8]
. On Presto hardware, DC bias is provided from the dedicated DC output ports on the front panel; valid values forport
are then in the interval[1,16]
regardless of the available number of RF outputs.On Presto hardware, there are 5 available range settings:
range_i
Analog range
0
0V — 3.33V
1
0V — 6.67V
2
±3.33V
3
±6.67V
4
±10.0V
When selecting
range_i=None
(default), the API will choose the smallest bipolar range (2, 3 or 4) such thatbias
is at most 90% of the range.When changing range, voltage transients of about 0.5 V can appear at the output for about 1 us.
Examples
>>> from presto import lockin >>> with lockin.Lockin() as lck: >>> lck.hardware.set_dc_bias( >>> bias=5.0, # 5V >>> port=[5, 6, 7, 8], # update 4 ports simultaneously >>> range_i=None, # auto-select range_i=3, i.e. ±6.67V >>> ) >>> lck.hardware.set_dc_bias( >>> bias=-2.0, # -2V >>> port=1, >>> range_i=4, # manually select range_i=4, i.e. ±10.0V >>> )
See also
- set_input_delay(port, delay)¶
Program a digital delay on an input port.
The new setting is applied after a call to
sync()
- Parameters:
Notes
The digital delay is expressed in units of the period Ts of the ADC sampling clock. For example, when using
adc_fsample=AdcFSample.G4
the sampling clock is at 4 GS/s and has a period of 250 ps. Settingdelay=7
then corresponds to a delay of 1.75 ns.Examples
With the input ADC running at 4 GS/s, the input delay is set in multiples of 1/4 ns:
>>> with pulsed.Pulsed(adc_fsample=AdcFSample.G4) as pls: # 4 GS/s sampling rate >>> pls.hardware.set_input_delay(port=1, delay=0) # no delay >>> pls.hardware.set_input_delay(port=2, delay=3) # 0.75 ns >>> pls.hardware.set_input_delay(port=3, delay=6) # 1.50 ns >>> pls.hardware.set_input_delay(port=4, delay=7) # 1.75 ns >>> pls.hardware.sync() # <-- apply the delay settings
See also
- set_input_multiband(tile, mode)¶
Configure multiband operation on an input tile.
- Parameters:
tile (
int
) – group of ports affected by multiband, valid values are in [0, 3]. See Advanced tile configuration for port grouping.mode (
MultibandMode
) – multiband configuration to enable
See also
- set_inv_sinc(ports, mode)¶
Enable/disable the inverse-sinc FIR filter on the output ports (DAC)
The new setting is applied immediately.
- Parameters:
Notes
Using the inverse-sinc correction can improve gain flatness over frequency, but can cause clipping of the output when used at full-scale amplitude. To avoid clipping, it is recommended to not drive above -3.5 dBFS when
mode=1
, and -1.0 dBFS whenmode=2
.
- set_lmx(freq, pwr, ports=None)¶
Configure the clock chip on Presto hardware to use as RF source.
The new setting is applied immediately.
- set_output_delay(port, delay)¶
Program a digital delay on an output port.
The new setting is applied after a call to
sync()
- Parameters:
Notes
The digital delay is expressed in units of the period Ts of the DAC sampling clock. For example, when using
dac_fsample=DacFSample.G10
the sampling clock is at 10 GS/s and has a period of 100 ps. Settingdelay=7
then corresponds to a delay of 700 ps.Examples
With the output DAC running at 6 GS/s, the output delay is set in multiples of 1/6 ns:
>>> with pulsed.Pulsed(dac_fsample=DacFSample.G6) as pls: # 6 GS/s sampling rate >>> pls.hardware.set_output_delay(port=1, delay=0) # no delay >>> pls.hardware.set_output_delay(port=2, delay=3) # 0.5 ns >>> pls.hardware.set_output_delay(port=3, delay=6) # 1.0 ns >>> pls.hardware.set_output_delay(port=4, delay=7) # 7/6 ns >>> pls.hardware.sync() # <-- apply the delay settings
See also
- set_output_multiband(tile, mode)¶
Configure multiband operation on an output tile.
- Parameters:
tile (
int
) – group of ports affected by multiband, valid values are in[0, 3]
. See Advanced tile configuration for port grouping.mode (
MultibandMode
) – multiband configuration to enable
Note
Output multiband is currently not supported on Presto-8 hardware.
See also
- set_rpu_param(index, value)¶
Write a parameter to the real-time processor (RPU).
The available indexes and the meaning of the parameter values are dependent on the user-defined algorithm running on the RPU.
Warning
This method is experimental and the exposed API might change in future releases.
- Parameters:
See also
- sleep(secs, wait=True)¶
Tell the hardware to sleep for
secs
seconds.Like
time.sleep()
, except the sleep is done on the hardware rather than on the local computer.
- sync()¶
Manually issue a command to synchronize the NCO phases.
Can be used after a call to
configure_mixer()
withsync=False
.Examples
This code:
>>> with lockin.Lockin(adc_mode=AdcMode.Mixed, dac_mode=DacMixed02) as lck: >>> lck.hardware.configure_mixer( >>> freq=3.5e+9, # 3.5 GHz >>> in_ports=1, >>> out_ports=1, >>> sync=False, # don't sync here... >>> ) >>> lck.hardware.sync() # <-- sync here!
is equivalent to this code:
>>> with lockin.Lockin(adc_mode=AdcMode.Mixed, dac_mode=DacMixed02) as lck: >>> lck.hardware.configure_mixer( >>> freq=3.5e+9, # 3.5 GHz >>> in_ports=1, >>> out_ports=1, >>> sync=True, # <-- sync here! >>> )
- upload_rpu_firmware(binary_path, filename=None)¶
Upload a custom firmware for the real-time processor (RPU).
Warning
This method is experimental and the exposed API might change in future releases.
TriggerSource class¶
- class presto.hardware.TriggerSource(value, names=<not given>, *values, module=None, qualname=None, type=None, start=1, boundary=None)¶
Select trigger source for starting a pulsed measurement
- DigitalIn1¶
Wait for high on digital input 1
- DigitalIn2¶
Wait for high on digital input 2
- DigitalIn3¶
Wait for high on digital input 3
- DigitalIn4¶
Wait for high on digital input 4
- Internal¶
Run immediately
- Sysref¶
Wait for multi-presto synchronization
MultibandMode class¶
- class presto.hardware.MultibandMode(value, names=<not given>, *values, module=None, qualname=None, type=None, start=1, boundary=None)¶
Configuration options for multiband operation on a tile
- DualBand12¶
Combine ports 1 and 2 into port 1, leave ports 3 and 4 unaffected
- DualBand34¶
Combine ports 3 and 4 into port 3, leave ports 1 and 2 unaffected
- DualBandAll¶
Combine ports 1 and 2 into port 1 and ports 3 and 4 into port 3
- QuadBand¶
Combine ports 1, 2, 3 and 4 into port 1
- SingleBand¶
Each port in tile works independently
Converter modes¶
See Direct and Mixed mode for an introduction to converter modes.
- class presto.hardware.AdcMode(value, names=<not given>, *values, module=None, qualname=None, type=None, start=1, boundary=None)¶
Configuration for analog-to-digital converters (ADC), i.e. input channels
Note
Use
Direct
for baseband input, orMixed
for digital IQ downconversion.- Direct¶
direct mode, i.e. no digital downconversion
- Mixed¶
IQ mixed mode, i.e. with digital downconversion
- class presto.hardware.DacMode(value, names=<not given>, *values, module=None, qualname=None, type=None, start=1, boundary=None)¶
Configuration for digital-to-analog converters (DAC), i.e. output channels.
Note
Use
Direct
for baseband output, orMixed
for digital IQ upconversion.Other settings are mainly for internal use, or to override the default configuration. For most applications, use either
Direct
orMixed
.- Direct¶
direct mode, i.e. no digital upconversion
- Mixed¶
preferred IQ mixed mode, i.e. with digital upconversion. Automatically choose appriate setting among
Mixed02
,Mixed04
andMixed42
depending on sampling rate and signal frequency.
- Mixed02¶
standard IQ mixed mode, i.e. with digital upconversion. Only valid for sampling rates \(f_\mathrm{S} \le 7 \mathrm{GS/s}\). This is a low-level setting, it is recommeded to use
Mixed
instead.
- Mixed04¶
IQ mixed mode with \(f_\mathrm{out} \in [0;f_\mathrm{S}/4] \cup [3f_\mathrm{S}/4;f_\mathrm{S}]\). Only valid on Presto hardware. This is a low-level setting, it is recommeded to use
Mixed
instead.
- Mixed42¶
IQ mixed mode with \(f_\mathrm{out} \in [f_\mathrm{S}/4; 3f_\mathrm{S}/4]\). Only valid on Presto hardware. This is a low-level setting, it is recommeded to use
Mixed
instead.
Converter rates¶
- class presto.hardware.AdcFSample(value, names=<not given>, *values, module=None, qualname=None, type=None, start=1, boundary=None)¶
Sampling rate setting for analog-to-digital converters (ADC), i.e. input channels.
Note
These settings are mainly for internal use, or to override the default configuration. For most applications, leave the argument
adc_fsample
unspecified (or set it toNone
) to let the API select the optimal value.- G2¶
\(f_\mathrm{S} = 2 \mathrm{GS/s}\)
- G3_2¶
\(f_\mathrm{S} = 3.2 \mathrm{GS/s}\). Only valid on Vivace hardware
- G4¶
\(f_\mathrm{S} = 4 \mathrm{GS/s}\). Not valid on 16-channel Presto hardware
- class presto.hardware.DacFSample(value, names=<not given>, *values, module=None, qualname=None, type=None, start=1, boundary=None)¶
Sampling rate setting for digital-to-analog converters (DAC), i.e. output channels.
Note
These settings are mainly for internal use, or to override the default configuration. For most applications, leave the argument
dac_fsample
unspecified (or set it toNone
) to let the API select the optimal value.- G10¶
\(f_\mathrm{S} = 10 \mathrm{GS/s}\). Only valid on Presto hardware
- G2¶
\(f_\mathrm{S} = 2 \mathrm{GS/s}\)
- G4¶
\(f_\mathrm{S} = 4 \mathrm{GS/s}\)
- G6¶
\(f_\mathrm{S} = 6 \mathrm{GS/s}\). Only valid on Presto hardware
- G6_4¶
\(f_\mathrm{S} = 6.4 \mathrm{GS/s}\). Only valid on Vivace hardware
- G8¶
\(f_\mathrm{S} = 8 \mathrm{GS/s}\). Only valid on Presto hardware