skneuromsi.utils.readout_tools module
Tools to read the output of scikit-neuromsi models.
- skneuromsi.utils.readout_tools.calculate_multiple_peaks_probability(peaks_values)[source]
Computes the probability of reading out multiple stimuli from the ouput.
The probability of perceiving two stimuli is defined as the product of the two peak values. When more than two peak values are provided, the average product of all possible combinations of peak values is computed.
- Parameters:
peak_values (np.array) – Array containing the peak values detected in the model output. Values are expected to be scaled from 0 to 1.
- Returns:
Probability of reading out multiple peaks (stimuli).
- Return type:
numpy.float64
- skneuromsi.utils.readout_tools.calculate_single_peak_probability(peaks_values)[source]
Computes the probability of reading a unique stimulus from the model ouput.
The probability of perceiving one stimulus is defined as the single peak value. When two or more peak values are provided, the complementary probability of perceiving multiple stimuli is computed.
- Parameters:
peak_values (numpy.array) – Array containing the peak values detected in the model output. Values are expected to be scaled from 0 to 1.
- Returns:
Probability of reading out a single peak (stimulus).
- Return type:
numpy.float64
- skneuromsi.utils.readout_tools.calculate_causes_from_peaks(mode_activity_data, causes_kind='count', peak_threshold=0.15, peak_distance=None)[source]
Computes the number of causes from peaks found in modal activity.
The peaks are identified using the peakdetect method. The algorithm requires to set the lookahead parameter, which is the distance to look ahead from a peak candidate to determine if it is the actual peak.
- Parameters:
mode_activity_data (numpy.array) – Array containing the activity of a mode in space or time.
causes_kind (str) –
The name of the causes readout method.
’count’ : counts the number of peaks (default)
’prob’ : takes the height of the peaks as probability values.
peak_threshold (float) – The minimum peak height to detect peaks.
- Returns:
Causes identified from modal activity.
- Return type:
numpy.float64
- skneuromsi.utils.readout_tools.calculate_spatiotemporal_causes_from_peaks(mode_spatiotemporal_activity_data, causes_kind='count', causes_dim='space', time_point=-1, spatial_point=0, peak_threshold=0.15, peak_distance=None)[source]
Computes the number of causes from peaks found in modal activity.
The peaks are identified using the peakdetect method. The algorithm requires to set the lookahead parameter, which is the distance to look ahead from a peak candidate to determine if it is the actual peak.
- Parameters:
mode_spatiotemporal_activity_data (2D numpy.array) – Array containing the activity of a mode in space and time. Assumes that temporal dimension is organised in rows and spatial dimension in columns.
causes_kind (str) – The name of the causes readout method to employ.
causes_dim (str) –
The name of the dimension to readout from.
’space’ : reads causes from spatial dimension (default).
’time’ : reads causes from temporal dimension.
time_point (int) – The temporal point where spatial readout is computed.
position_point (int) – The spatial point where temporal readout is computed.
peak_threshold (float) – The minimum persistence score to detect peaks.
lookahead (int) – The distance to look ahead from a peak candidate.
- Returns:
Causes identified from modal activity in the desired dimension.
- Return type:
numpy.float64