transplant_error_mahot#

pypillometry.signal.transplant_error_mahot(transplants, smooth_winsize, rate_onset, rate_offset, margin, blinkwindow, interp_type='cubic', max_duration=None, per_blink=False)[source]#

Error of the Mahot interpolation of transplanted blinks.

The transplanted blinks are interpolated with interpolate_blinks_mahot() and compared to the signal without them (see transplant_error()). The error is the mean over the blinks of their root mean squared errors, which depends less on a few blinks with a large error than the root mean squared error over all of them.

As in the interpolation of a recording, the other runs of missing samples of the signal (e.g., its own blinks; not the ones longer than max_duration, which are not blinks) are interpolated together with the transplanted blinks, so that a blink whose anchor points fall into them is merged with them instead of being skipped. Only the error at the transplanted blinks counts.

Parameters:
  • transplants (BlinkTransplant or list of BlinkTransplant) – signal(s) with transplanted blinks (e.g., one per eye), see transplant_blinks()

  • smooth_winsize – parameters of the interpolation (in samples, and units per sample); a transplanted blink that is skipped (e.g., longer than max_duration after merging) is not replaced and has a large error

  • rate_onset – parameters of the interpolation (in samples, and units per sample); a transplanted blink that is skipped (e.g., longer than max_duration after merging) is not replaced and has a large error

  • rate_offset – parameters of the interpolation (in samples, and units per sample); a transplanted blink that is skipped (e.g., longer than max_duration after merging) is not replaced and has a large error

  • margin – parameters of the interpolation (in samples, and units per sample); a transplanted blink that is skipped (e.g., longer than max_duration after merging) is not replaced and has a large error

  • blinkwindow – parameters of the interpolation (in samples, and units per sample); a transplanted blink that is skipped (e.g., longer than max_duration after merging) is not replaced and has a large error

  • interp_type – parameters of the interpolation (in samples, and units per sample); a transplanted blink that is skipped (e.g., longer than max_duration after merging) is not replaced and has a large error

  • max_duration – parameters of the interpolation (in samples, and units per sample); a transplanted blink that is skipped (e.g., longer than max_duration after merging) is not replaced and has a large error

  • per_blink (bool) – return the errors of all blinks instead of their mean

Return type:

float | ndarray

Returns:

the mean error per blink, or the error of each blink