pe43711

class rfblocks.pe43711(le: str | None = None)[source]

Encapsulates control of the PE43711 step attenuator.

Documentation for the PE43711 step attenuator rfblocks module can be found here: A PE43711 Step Attenuator

Parameters:

le (str) – The PE43711 latch enable (LE) controller pin

atten_word(attn_db: float) str[source]

Calculate the attenuation word for a specified attenuation level.

Parameters:

attn_db (float) – The desired attenuation level in dB. This should be in the range 0 to 31.75 dB.

Returns:

An 8-bit integer containing the attenuation ‘word’.

Raises:

AttenuationRangeException If the specified attenuation is out of range.

chip_reset() str[source]

Reset the chip internal logic to default states.

Returns:

A string containing the controller commands required to reset the chip.

config_atten_word(attn_word: int) str[source]

Update the current attenuation word.

Parameters:

attn_word (8-bit integer) – The attenuator word for the desired attenuation. Note that only the lower 7 bits of the value are used.

Returns:

The command string required to update the current device attentuation value.

classmethod default_insertion_loss(freq: float) float[source]

Calculates attenuator default insertion loss.

By default the attenuator insertion loss is modelled as a linear function. The slope and intercept of the function are derived from VNA measurements of the attenuator S21 with an attenuation setting of 0 dB.

Parameters:

freq (float) – Frequency (in MHz) for computing the insertion loss.

Returns:

The attenuator insertion loss (in dB) for an attenuation setting of 0 dB at the specified frequency.

insertion_loss(freq: float) float[source]

Calculate the attenuator insertion loss. Insertion loss is computed using a 0 dB attenator setting.

Parameters:

freq (float) – Frequency, in MHz, at which to compute the insertion loss.

Returns:

The insertion loss (in dB) at the specified frequency.

pin_config() str[source]

Initialize controller pin configuration.

Returns:

A string specifying the commands required to initialize the connected controller pins.

set_insertion_loss_fn(fn: Callable[[float], float] | None) None[source]
Set a callable to use when calculating the attenuator insertion

loss.

Parameters:

fn – A callable which takes a single float parameter specifying the frequency in MHz and returning the insertion loss in dB.