fixate package

class fixate.VirtualMux(update_pins: Callable[[PinUpdate, bool], None] | None = None)
multiplex(signal: str, trigger_update: bool = True) None

Update the multiplexer state to signal.

The update is a two-step processes. By default, the change happens on the second step. This can be modified by subclassing and overriding the _calculate_pins method.

If trigger_update is true, the output will update immediately. If false, multiple mux changes can be set and then when trigger_update is finally set to True all changes will happen at once.

In general, subclasses should not override. (VirtualSwitch does, but then delegates the real work to this method to ensure consistent behaviour.)

pins() frozenset[str]

Return the set off all pins used by this mux

wait_at_least(duration: float) None

Ensure at least duration seconds have elapsed since the signal was switched.

This can be used to ensure a minimum settling time has passed since a particular signal was enabled.

class fixate.VirtualSwitch(update_pins: Callable[[PinUpdate, bool], None] | None = None)

A VirtualMux that controls a single pin.

A virtual switch is a multiplexer with a single pin. The multiplex function can accept either boolean values or the strings ‘TRUE’ and ‘FALSE’. The virtual address used to switch can be defined as a list with the single element (as if it were a multiplexer) or by using the shorthand which is to define the pin_name attribute as a string.

multiplex(signal: str | bool, trigger_update: bool = True) None

Update the multiplexer state to signal.

The update is a two-step processes. By default, the change happens on the second step. This can be modified by subclassing and overriding the _calculate_pins method.

If trigger_update is true, the output will update immediately. If false, multiple mux changes can be set and then when trigger_update is finally set to True all changes will happen at once.

In general, subclasses should not override. (VirtualSwitch does, but then delegates the real work to this method to ensure consistent behaviour.)

class fixate.RelayMatrixMux(update_pins: Callable[[PinUpdate, bool], None] | None = None)
class fixate.AddressHandler(pins: Sequence[str])

Controls the IO for a set of pins.

For output, it is assumed that all the pins under the of a given AddressHandler are updated in one operation.

An AddressHandler should lazily open any required hardware resource. Ideally, it should be possible to instantiate and inspect the AddressHandler without requiring hardware to be connected. When set_pins is called, the implementation should check for the required hardware connection and open that driver when first called.

Further, calling close() may “uninitialize” the driver. The next time set_pins is called, the handler will re-open hardware.

close() None

Optional close method to clean-up resources.

This will be called automatically by the JigDriver for any address handlers passed into the JigDriver when it as created.

set_pins(pins: Collection[str]) None

Called by the VirtualAddressMap to write out pin changes.

If the underlying hardware required for the IO isn’t open, open it.

Parameters:

pins – is a collection of pins that should be made active. All other pins defined by the AddressHandler should be cleared.

class fixate.PinValueAddressHandler(pins: Sequence[str])

Maps pins to bit values then combines the bit values for an update

set_pins(pins: Collection[str]) None

Called by the VirtualAddressMap to write out pin changes.

If the underlying hardware required for the IO isn’t open, open it.

Parameters:

pins – is a collection of pins that should be made active. All other pins defined by the AddressHandler should be cleared.

class fixate.MuxGroup

Group multiple VirtualMux’s, for use in a single Jig Driver.

If a test script, it is expected that MuxGroup will be subclassed, with attributes being each required VirtualMux subclass. This can be done using a dataclass:

@dataclass
class JigMuxGroup(MuxGroup):
    mux_one: MuxOne = field(default_factory=MuxOne)
    mux_two: MuxTwo = field(default_factory=MuxTwo)
class fixate.JigDriver(mux_group_factory: Callable[[], JigSpecificMuxGroup], handlers: Sequence[AddressHandler])

Combine multiple VirtualMux’s and multiple AddressHandler’s.

The jig driver joins muxes to handlers by matching up pin definitions.

reset() None

Reset all VirtualMux’s to the default signal “” (all pins off)

fixate.generate_pin_group(group_designator: int, *, pin_count: int = 16, prefix: str = '', sep: str = '') tuple[str, ...]

A helper to create pin names groups of pins, especially relay matrices.

By default, returns 16 pin names, suitable for a 16 relay matrix. Changing the default values for pin_count and prefix can be used to generate alternate naming schemes.

generate_pin_group(1) -> (“1K1”, “1K2”, “1K3”, …, “1K16”) generate_pin_group(3, prefix=”RM”) -> (“RM1K1”, “RM1K2”, “RM1K3”, …, “RM1K16”) generate_pin_group(5, pin_count=8, prefix=”U”) -> (“U3K1”, “U3K2, “U3K3”, …, “U3K8”)

fixate.generate_relay_matrix_pin_list(designators: Iterable[int], *, prefix: str = '', sep: str = '') tuple[str, ...]

Create a pin list for multiple relay matrix modules.

Each module is allocated 16 pins. For example:

generate_relay_matrix_pin_list([1,2,3]) ->
    ("1K1", "1K2", ..., "1K16", "2K1", ..., "2K16", "3K1", ..., "3K16")

You can add a prefix. For example, we ofter use ‘RM’ for Relay Matrix:

generate_relay_matrix_pin_list([2,3,1], prefix="RM") ->
    ("RM2K1", "RM2K2", ..., "RM2K16", "RM3K1", ..., "RM3K16", "RM1K1", ..., "RM1K16")

Combination generate_relay_matrix_pin_list and generate_pin_group to create pins as needed for a specific jig configuration.

Subpackages