pygsti.tools.opttools
This module defines tools for optimization and profiling
Module Contents
Functions
|
Decorator for caching a function values |
|
Context manager that times a block of code |
Get string-version of current time |
- pygsti.tools.opttools.cache_by_hashed_args(obj)
Decorator for caching a function values
Deprecated since version v0.9.8.3:
cache_by_hashed_args()
will be removed in pyGSTi v0.9.9. Usefunctools.lru_cache()
instead.Parameters
- objfunction
function to decorate
Returns
function
- pygsti.tools.opttools.timed_block(label, time_dict=None, printer=None, verbosity=2, round_places=6, pre_message=None, format_str=None)
Context manager that times a block of code
Parameters
- labelstr
An identifying label for this timed block.
- time_dictdict, optional
A dictionary to store the final time in, under the key label.
- printerVerbosityPrinter, optional
A printer object to log the timer’s message. If None, this message will be printed directly.
- verbosityint, optional
The verbosity level at which to print the time message (if printer is given).
- round_placesint, opitonal
How many decimal places of precision to print time with (in seconds).
- pre_messagestr, optional
A format string to print out before the timer’s message, which formats the label arguent, e.g. “My label is {}”.
- format_strstr, optional
A format string used to format the label before the resulting “rendered label” is used as the first argument in the final formatting string “{} took {} seconds”.