larray.compare

larray.compare(*args, depth=0, **kwargs)[source]

Open a new comparator window, comparing arrays or sessions.

Parameters
*argsArrays, Sessions, str or Path.

Arrays or sessions to compare. Strings or Path will be loaded as Sessions from the corresponding files.

titlestr, optional

Title for the window. Defaults to ‘’.

nameslist of str, optional

Names for arrays or sessions being compared. Defaults to the name of the first objects found in the caller namespace which correspond to the passed objects.

rtolfloat or int, optional

The relative tolerance parameter (see Notes). Defaults to 0.

atolfloat or int, optional

The absolute tolerance parameter (see Notes). Defaults to 0.

nans_equalboolean, optional

Whether to consider NaN values at the same positions in the two arrays as equal. By default, an array containing NaN values is never equal to another array, even if that other array also contains NaN values at the same positions. The reason is that a NaN value is different from anything, including itself. Defaults to True.

depthint, optional

Stack depth where to look for variables. Defaults to 0 (where this function was called).

Notes

For finite values, the following equation is used to test whether two values are equal:

absolute(array1 - array2) <= (atol + rtol * absolute(array2))

Examples

>>> a1 = ndtest(3)                                                                                 
>>> a2 = ndtest(3) + 1                                                                             
>>> compare(a1, a2, title='first comparison')                                                      
>>> compare(a1 + 1, a2, title='second comparison', names=['a1+1', 'a2'])