pygsti.forwardsims.termforwardsim_calc_generic.traverse_paths_upto_threshold

pygsti.forwardsims.termforwardsim_calc_generic.traverse_paths_upto_threshold#

traverse_paths_upto_threshold(oprep_lists, pathmag_threshold, num_elabels, foat_indices_per_op, fn_visitpath, debug=False)#

Traverse all the paths up to some path-magnitude threshold, calling fn_visitpath for each one.

Parameters:
  • oprep_lists (list of lists) – representations for the terms of each layer of the circuit whose outcome probability we’re computing, including prep and POVM layers. oprep_lists[i] is a list of the terms available to choose from for the i-th circuit layer, ordered by increasing term-magnitude.

  • pathmag_threshold (float) – the path-magnitude threshold to use.

  • num_elabels (int) – The number of effect labels corresponding whose terms are all amassed in the in final oprep_lists[-1] list (knowing which elements of oprep_lists[-1] correspond to which effect isn’t necessary for this function).

  • foat_indices_per_op (list) – A list of lists of integers, such that foat_indices_per_op[i] is a list of indices into oprep_lists[-1] that marks out which terms are first-order (Taylor) terms that should therefore always be traversed regardless of their term-magnitude (foat = first-order- always-traverse).

  • fn_visitpath (function) – A function called for each path that is traversed. Arguments are (term_indices, magnitude, incd) where term_indices is an array of integers giving the index into each oprep_lists[i] list, magnitude is the path magnitude, and incd is the index of the circuit layer that was just incremented (all elements of term_indices less than this index are guaranteed to be the same as they were in the last call to fn_visitpath, and this can be used for faster path evaluation.

  • max_npaths (int, optional) – The maximum number of paths to traverse. If this is 0, then there is no limit. Otherwise this function will return as soon as max_npaths paths are traversed.

  • debug (bool, optional) – Whether to print additional debug info.

Return type:

None