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()andset_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,WeylBaseand its children.- Parameters:
dim (
int) – A small prime integer inSMALL_PRIMES.- Raises:
ValueError – If
dimis not a small prime integer inSMALL_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 (
int|NoneType) – IfNone, return the default subsystem dimension, or the provided integer if it is valid.small_prime (
bool) – Whether or not the subsystem dimension must be one ofSMALL_PRIMES.
- Return type:
int- Raises:
ValueError – If
dimis not an integer greater than or equal to two whensmall_prime=False.ValueError – If
dimis not a small prime integer inSMALL_PRIMESwhensmall_prime=True.
- trueq.settings.set_rng(rng_or_seed)
Sets the NumPy generator for producing random values.
- Parameters:
rng_or_seed (
int|numpy.random.Generator()) – Anumpy.random.Generator()object, or a seed to create one using :py:func`numpy.random.default_rng`.
- trueq.settings.get_rng()
Returns the default NumPy generator for producing random values.
- Return type:
numpy.random.Generator
- trueq.settings.reset_cl()
Resets this setting to its original value.
- trueq.settings.reset_dim()
Resets this setting to its original value.
- trueq.settings.reset_rng()
Resets this setting to its original value.