gemseo.utils.comparisons module#

Data comparison tools.

compare_dict_of_arrays(dict_of_arrays, other_dict_of_arrays, tolerance=0.0, nan_are_equal=False)[source]#

Check if two dictionaries of NumPy and/or SciPy sparse arrays are equal.

The dictionaries can be nested, in which case they are flattened. If the tolerance is set, then arrays are considered equal if norm(dict_of_arrays[name] - other_dict_of_arrays[name]) /(1 + norm(other_dict_of_arrays[name])) <= tolerance.

Parameters:
Returns:

Whether the dictionaries are equal.

Return type:

bool