UL Function Measures Documentation#

measures.py contains functions and classes for implementing different measures for quantifying upper-limb functioning.


monalysa.ulfunc.measures.Hq(aua: array, q: float) float#

Computes the overall upper-limb activity using the average upper-limb activity time series.

Parameters:
  • aua (np.array) – 1D numpy array of the average upper-limb activity.

  • q (float) – Percentile to be used for computing the overall upper-limb activity. This value must be between 0 and 100.

Returns:

Hq computed from the given average upper-limb activity time series.

Return type:

float

monalysa.ulfunc.measures.Rq(domnaff: array, ndomaff: array, q: float) tuple[float, float]#

Computes the relative upper-limb use from the data given for the two upper-limbs.

Parameters:
  • domnaff (np.array) – 1D numpy array of data from the dominant or non-affected upper limb.

  • ndomaff (np.array) – 1D numpy array of data from the non-dominant or affected upper limb.

  • q (float) – Percentile to be used for computing the relative upper-limb use. This value must be between 0 and 100.

Returns:

The first value of the tuple is Rq which takes a value between 0 and 1, and the second value is -1, 0, or +1, depending which upper-limb is used more than the other.

Return type:

tuple[float, float]

monalysa.ulfunc.measures.average_latindex(latinx_inst: array, windur: float, winshift: float, fs: float) tuple[numpy.array, numpy.array]#

Compute the average of the instantaneous laterality index signal.

Parameters:
  • latinx_inst (np.array) – The instantaneous laterality index signal.

  • windur (float) – Duration in seconds over which the UL use signal is to be averaged.

  • winshift (float) – Time shift between two consecutive averaging windows.

  • sample_t (float) – Sampling frequency of the usesig signal.

Returns:

A tuple of 1D numpy arrays. The first 1D array is the list of time indices of the computed average laterality index signal. The second 1D array is the average laterality index signal.

Return type:

tuple[np.array, np.array]

monalysa.ulfunc.measures.instantaneous_latindex(domnaff: array, ndomaff: array) tuple[numpy.array, numpy.array]#

Computes the instantaneous laterality index using the two given signals corresponding to the two arms. This can be computed with either instantaneous use or intensity signals. Both signals must be of the same type, i.e. both must be use signals or both must be intensity signals. Mixing signals will produce results that are not interpretable.

Parameters:
  • domnaff (np.array) – Instantaneous use or intensity signal for the dominant or the unaffected upper-limb.

  • ndomaff (np.array) – Instantaneous use or intensity signal for the non-dominant or the affected upper-limb.

Returns:

A tuple of 1D numpy arrays. The first 1D array is the list of time indices of the computed instantaneous laterality index signal. The second 1D array is the instantaneous laterality index signal.

Return type:

tuple[np.array, np.array]