Settings

This module contains setters and getters for various package-wide settings. These settings are not remembered between Python sessions.

trueq.settings.reset()

Resets all settings to their original values.

trueq.settings.set_cl(cl)

Sets the default confidence level of several output displays.

Parameters

cl (float) – A number between zero and one, usually close to one.

Raises

ValueError – If the argument is not in \((0,1)\).

trueq.settings.get_cl()

Returns the default confidence level of several output displays.

Return type

py:class:float

trueq.settings.get_zl()

Returns the value \(z\) such that the probability mass between \([-z,z]\) of the unit normal distribution is equal to the current confidence level, see get_cl() and set_cl(). This is used by several output displays.

Return type

float

trueq.settings.SMALL_PRIMES = {2, 3, 5, 7}

The subsystem dimensions allowed by methods in True-Q™ that employ Weyls, that is, subclasses of WeylBase. We restrict to prime dimensions because this causes the single-subsystem Clifford group to be a 2-design, making it appropriate for use as a twirling group in various benchmarking protocols [20]. We also restrict to small primes for ease of computation and so that string representations take only one character.

trueq.settings.set_dim(dim)

Sets the default subsystem dimension for several constructors, such as Cycle, Results, Twirl, WeylBase and its children.

Parameters

dim (int) – A small prime integer in SMALL_PRIMES.

Raises

ValueError – If dim is not a small prime integer in SMALL_PRIMES.

trueq.settings.get_dim(dim=None, small_prime=False)

Returns the default subsystem dimension or the provided one if it is valid.

Parameters
  • dim (bool) – If None, return the default subsystem dimension, or the provided integer if it is valid.

  • dim – Whether or not the subsystem dimension must be one of SMALL_PRIMES.

Return type

int

Raises
  • ValueError – If dim is not an integer greater than or equal to two when small_prime=False.

  • ValueError – If dim is not a small prime integer in SMALL_PRIMES when small_prime=True.