sda.misc.basics#

Original Spy package functions, moved into SDA to avoid Spy dependency.

Functions#

autoturn(data[, key])

Transpose an array if necessary.

key_max_val(d)

Return the dictionary key with max value.

Module Contents#

sda.misc.basics.autoturn(data, key=-1)#

Transpose an array if necessary.

Parameters:
  • data (np.ndarray) – Array to transpose.

  • key (int, optional) – Key value: - 0: don’t transpose. - 1: transpose. - -1: auto: make sure the vectors are along the longest dimension, by default -1.

Returns:

Transposed array.

Return type:

np.ndarray

Raises:

ValueError – If key is not 0, 1 or -1.

sda.misc.basics.key_max_val(d)#

Return the dictionary key with max value.

Parameters:

d (dict) – Dictionary to check.

Returns:

Key with max value.

Return type:

Any