The algorithm module

Search algorighms for mode detections.

netsalt.algorithm.clean_duplicate_modes(all_modes, k_size, alpha_size)[source]

Remave duplicate modes from a list of modes with a threshold in real/imag(k).

Parameters
  • all_modes (list) – list of modes

  • k_size (float) – minimal distance in real(k)

  • alpha_size (float) – minimal distance in imag(k)

netsalt.algorithm.find_rough_modes_from_scan(ks, alphas, qualities, min_distance=2, threshold_abs=10)[source]

Use scipy.ndimage algorithms to detect minima in the scan.

Parameters
  • ks (list) – list of real part of wavenumbers from the scan

  • alphas (list) – list of imaginary part of wavenumbers from the scan

  • qualities (array) – matrix with mode qualities for each pair of k/alpha

  • min_distance (int) – smallest distance between peaks (for skimage.feature.peak_local_max)

  • threshold_abs (float) – minimal intensity between peaks (for skimage.feature.peak_local_max)

netsalt.algorithm.refine_mode_brownian_ratchet(initial_mode, graph, params, disp=False, save_mode_trajectories=False, seed=42)[source]

Accurately find a mode from an initial guess, using brownian ratchet algorithm.

This algorithm is quite complex, but generally randomly propose a move to a new mode location, and accept if the quality decreases.

TODO: get rid of params, or better handling of them, and complete the doc on the small details

Parameters
  • initial_mode (complex) – initial gues for a mode

  • graph (graph) – quantum graph

  • params (dict) – includes search_stepsize, max_steps, quality_threhsold, max_tries_reduction reduction_factor

  • disp (bool) – to print some state of the search for debuing

  • save_mode_trajectories (bool) – true to save intermediate modes

  • seed (int) – seed for rng