optimap.utils¶

General utility functions.

Functions

deprecated(reason)

Function decorator to mark a function as deprecated.

disable_interactive_backend_switching()

Disable automatic switching of the matplotlib backend to Qt when necessary.

download_example_data(name[, known_hash, ...])

Download example data if not already present.

enable_interactive_backend_switching()

Enable automatic switching of the matplotlib backend to Qt when necessary.

interactive_backend(func)

Function decorator to change backend temporarily in Ipython session.

is_verbose()

Returns whether optimap is verbose.

jupyter_render_animation(f[, mp4_filename, ...])

Helper function for our documentation to render animations in Jupyter notebooks.

print_bar([force])

Print a bar to separate sections of output.

print_properties(array)

Print properties of an array.

set_verbose([state])

Set verbosity of optimap.

optimap.utils.set_verbose(state=True)[source]¶

Set verbosity of optimap.

Parameters:

state (bool) – If True, optimap will print more information.

optimap.utils.is_verbose()[source]¶

Returns whether optimap is verbose.

Returns:

Whether optimap is verbose.

Return type:

bool

optimap.utils.print_bar(force=False)[source]¶

Print a bar to separate sections of output.

optimap.utils.print_properties(array: ndarray)[source]¶

Print properties of an array.

optimap.utils.enable_interactive_backend_switching()[source]¶

Enable automatic switching of the matplotlib backend to Qt when necessary.

See also disable_interactive_backend_switching().

optimap.utils.disable_interactive_backend_switching()[source]¶

Disable automatic switching of the matplotlib backend to Qt when necessary.

See also enable_interactive_backend_switching().

optimap.utils.download_example_data(name, known_hash=None, directory='./optimap_example_data', silent=False)[source]¶

Download example data if not already present.

See Example Data Files for list of files. Accepts also an URL to a file to download. See pooch.retrieve() for more information.

If file is a zip file, it will be unzipped after download.

Parameters:
  • name (str) – Name of the file to download.

  • known_hash (str, optional) – Hash of the file to download. If None, lookup if file is known in FILE_HASHES.

  • directory (str) – Directory to download the file to.

  • silent (bool) – If True, set logging level to WARNING.

Returns:

Path to the file.

Return type:

str