hardware module

Hardware configuration common to all modes of operation.

Detailed information is provided in the documentation for each class:

Hardware

Interface to the Vivace/Presto hardware.

MultibandMode

Configuration options for multiband operation on a tile

TriggerSource

Select trigger source for starting a pulsed measurement

AdcMode

Configuration for analog-to-digital converters (ADC), i.e. input channels.

DacMode

Configuration for digital-to-analog converters (DAC), i.e. output channels.

AdcFSample

Sampling rate setting for analog-to-digital converters (ADC), i.e. input channels.

DacFSample

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.Direct
adc_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)

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 of Lockin and Pulsed 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

get_errors()

blank_output(ports, state)

Disable the output port(s). Has no effect on the DC bias.

The new setting is applied immediately.

Parameters:
  • ports (int or list of int) – Output ports to enable/disable

  • state (bool) – When True, disable the RF output.

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 Hz

  • 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 the in_zoneth Nyquist band. If None (default), choose appropriate zone automatically

  • out_zone (Optional[int]) – optimize upconversion mixer for operation in the out_zoneth Nyquist band. If None (default), choose appropriate zone automatically

  • in_phase (float) – phase of the numerically-controlled oscillator (NCO) in radians for each input port

  • out_phase (float) – phase of the numerically-controlled oscillator (NCO) in radians for each output port

  • sync (bool) – deprecated since version 2.12.0, see Notes section below.

  • tune (bool) – if True (default), avoid long-term drifts between ports by rounding freq so that it is representable exactly by the NCOs in all input and output ports. If False, 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 to configure_mixer are handled simultaneously at the next call to Lockin.apply_settings() or Pulsed.run(). See Synchronize multiple mixers

On versions prior to 2.12.0, or when not using the autoconfiguration feature, the behavior of the sync parameter is as follows: if True (default), issue a sync() event to align the phase of the NCO for in_ports and out_ports. When using multiple calls to configure different NCO frequencies on different ports, set sync=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 Hz

  • in_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 the in_zoneth Nyquist band. If None (default), choose appropriate zone automatically

  • out_zone (Optional[int]) – optimize upconversion mixer for operation in the out_zoneth Nyquist band. If None (default), choose appropriate zone automatically

  • in_phase (float) – phase of the numerically-controlled oscillator (NCO) in radians for each input port

  • out_phase (float) – phase of the numerically-controlled oscillator (NCO) in radians for each output port

  • sync (bool) – deprecated since version 2.12.0, see Notes section below.

  • tune (bool) – if True (default), avoid long-term drifts between ports by rounding freq so that it is representable exactly by the NCOs in all input and output ports. If False, 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().

format_errors()

Format error messages from the hardware, ready for printing.

Return type:

str

Returns:

a formatted string containing the errors, or an empty string.

get_dc_bias(port, get_range=False)

Get the DC bias programmed on the output ports.

Parameters:
  • port (int) – Output port. See Notes in set_dc_bias() for valid ports.

  • get_range (bool) – If True, return also the current range range_i.

Return type:

Union[float, Tuple[float, int]]

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 above

    • range_i: The range currently set, only present if get_range=True.

      See set_dc_bias() for available ranges.

Raises:

ValueError – If port is outside valid range.

get_errors()

Get error messages, if any, from the hardware.

Return type:

List[str]

Returns:

a list of error messages. If there’s no error, returns an empty list.

See also

assert_errors()

get_input_delay(port)

Retrieve the digital delay programmed on an input port.

Parameters:

port (int) – input port number

Return type:

int

Returns:

delay in units of ADC sampling clock

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:

MultibandMode

get_output_delay(port)

Retrieve the digital delay programmed on an output port.

Parameters:

port (int) – output port number

Return type:

int

Returns:

delay in units of DAC sampling clock

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:

MultibandMode

Note

Output multiband is currently not supported on Presto-8 hardware.

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 in set_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 or port are outside valid range; if rate is zero; if

  • current 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
>>>     )
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().

save_cal_coeff()

Save the current coefficients for the background calibration of the input ports (ADC).

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.

Parameters:
  • ports (int or list of int) – input port number

  • attenuation (float) – attenuation in dB, valid values are between 0.0 and 27.0 in steps of 1.0

set_cal_freeze(freeze)

Deprecated since version 2.13.0: Use save_cal_coeff() and restore_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:
  • ports (int or list of int) – output port number

  • current_ua (int) – full-scale current in μA, see Notes for valid values

Notes

On Vivace hardware, valid values for current_ua are 20_000 (20 mA) and 32_000 (32 mA). On Presto hardware, valid values range from 2_250 (2.25 mA) to 40_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.

Parameters:
  • ports (int or list of int) – output port number

  • low_noise (bool) – if True, optimize the DAC for low noise (high SNR); if False, optimize for high linearity.

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 of bias. See Notes for other available options.

Raises:

ValueError – If bias or port 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 for port 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 that bias 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
>>>     )
set_input_delay(port, delay)

Program a digital delay on an input port.

The new setting is applied after a call to sync()

Parameters:
  • port (int) – input port number

  • delay (int) – delay in units of ADC sampling clock, see Notes

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. Setting delay=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
set_input_multiband(tile, mode)

Configure multiband operation on an input tile.

Parameters:
set_inv_sinc(ports, mode)

Enable/disable the inverse-sinc FIR filter on the output ports (DAC)

The new setting is applied immediately.

Parameters:
  • ports (int or list of int) – output port number

  • mode (int) – which FIR filter to use: 0 disables correction; 1 for operation in 1st Nyquist zone; 2 for operation in 2nd Nyquist zone (only on Presto hardware)

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 when mode=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.

Parameters:
  • freq (float) – frequency in Hz between <~ 10 MHz and 15 GHz

  • pwr (int) – power setting in [0, 47]

  • ports (int or list of int) – valid values are 1 and 2. If None (default), use both.

set_output_delay(port, delay)

Program a digital delay on an output port.

The new setting is applied after a call to sync()

Parameters:
  • port (int) – output port number

  • delay (int) – delay in units of DAC sampling clock, see Notes

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. Setting delay=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
set_output_multiband(tile, mode)

Configure multiband operation on an output tile.

Parameters:

Note

Output multiband is currently not supported on Presto-8 hardware.

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.

Parameters:
  • secs (float) – duration of sleep in seconds

  • wait (bool) – if False, tell the hardware to sleep without waiting for completion. If True (default), block the calling thread on the local computer until the hardware is done sleeping.

sync()

Manually issue a command to synchronize the NCO phases.

Can be used after a call to configure_mixer() with sync=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!
>>>     )

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, or Mixed 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, or Mixed for digital IQ upconversion.

Other settings are mainly for internal use, or to override the default configuration. For most applications, use either Direct or Mixed.

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 and Mixed42 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 to None) 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 to None) 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