aerosandbox.visualization.carpet_plot_utils#

Utilities for making better carpet plots

Module Contents#

Functions#

time_limit(seconds)

Allows you to run a block of code with a timeout. This way, you can sweep through points to make a carpet plot

remove_nans(array)

Removes NaN values in a 1D array.

patch_nans(array)

Patches NaN values in a 2D array. Can patch holes or entire regions. Uses Laplacian smoothing.

complicated_function()

aerosandbox.visualization.carpet_plot_utils.time_limit(seconds)[source]#
Allows you to run a block of code with a timeout. This way, you can sweep through points to make a carpet plot

without getting stuck on a particular point that may not terminate in a reasonable amount of time.

Only runs on Linux!

Usage:

Attempt to set x equal to the value of a complicated function. If it takes longer than 5 seconds, skip it. >>> try: >>> with time_limit(5): >>> x = complicated_function() >>> except TimeoutException: >>> x = np.nan

Parameters:

seconds – Duration of timeout [seconds]

Returns:

aerosandbox.visualization.carpet_plot_utils.remove_nans(array)[source]#

Removes NaN values in a 1D array. :param array: a 1D array of data.

Returns: The array with all NaN values stripped.

aerosandbox.visualization.carpet_plot_utils.patch_nans(array)[source]#

Patches NaN values in a 2D array. Can patch holes or entire regions. Uses Laplacian smoothing. :param array: :return:

aerosandbox.visualization.carpet_plot_utils.complicated_function()[source]#