dispel.providers.generic.tasks.cps.steps module#

Cognitive Processing Speed test related functionality.

This module contains functionality to extract measures for the Cognitive Processing Speed test.

class dispel.providers.generic.tasks.cps.steps.AggregateFixedSubstitutionTime[source]#

Bases: AggregateMeasures

Extract the substitution time for the fixed keys.

static aggregation_method(values)#

Compute the substitution time.

The substitution time is defined as the difference between the symbol to digit reaction time (the time required to associate a symbol with a number) and the digit to digit reaction time (the time required to associate a number with a number).

Parameters:

values (List[float]) – A list of expected size 2 containing in first position, the symbol to digit reaction time and in second position the digit to digit reaction time.

Returns:

The substitution time.

Return type:

float

definition: ValueDefinition | ValueDefinitionPrototype | None = <dispel.data.measures.MeasureValueDefinitionPrototype object>#

The specification of the measure definition

fail_if_missing = False#
measure_ids: List[DefinitionIdType] = ['cps-dtd_rand-rt-mean', 'cps-std_rand_key1-rt-mean', 'cps-std_rand_key2-rt-mean']#
class dispel.providers.generic.tasks.cps.steps.AggregateRandomSubstitutionTime[source]#

Bases: AggregateMeasures

Extract the substitution time for the random keys.

static aggregation_method(values)#

Compute the substitution time.

The substitution time is defined as the difference between the symbol to digit reaction time (the time required to associate a symbol with a number) and the digit to digit reaction time (the time required to associate a number with a number).

Parameters:

values (List[float]) – A list of expected size 2 containing in first position, the symbol to digit reaction time and in second position the digit to digit reaction time.

Returns:

The substitution time.

Return type:

float

definition: ValueDefinition | ValueDefinitionPrototype | None = <dispel.data.measures.MeasureValueDefinitionPrototype object>#

The specification of the measure definition

fail_if_missing = False#
measure_ids: List[DefinitionIdType] = ['cps-dtd_rand-rt-mean', 'cps-std_rand_keyr-rt-mean']#
class dispel.providers.generic.tasks.cps.steps.CPSProcessingStepGroup[source]#

Bases: ProcessingStepGroup

A group of all cps processing steps for measures extraction.

__init__()[source]#
class dispel.providers.generic.tasks.cps.steps.ConfusionBase[source]#

Bases: SequenceModeKeyModalityDefinitionMixIn, ExtractCPSSteps

Confusion extract multiple steps Base.

confusion_pair#

List of the most likely to be confused pair.

Type:

List[dispel.providers.generic.tasks.cps.modalities.DigitConfusionPairModality | dispel.providers.generic.tasks.cps.modalities.SymbolConfusionPairModality | dispel.providers.generic.tasks.cps.modalities.ThirdsPairModality]

abstract apply_pair(data, pair)[source]#

Get the measure value definition.

Parameters:
Return type:

float

confusion_pair: List[DigitConfusionPairModality | SymbolConfusionPairModality | ThirdsPairModality]#
data_set_ids: str | Iterable[str] = 'confusion-matrix'#

An iterable of data sets to be being processed

data_type: str | None = 'float64'#
function_factory(pair)[source]#

Get function factory.

Parameters:

pair (DigitConfusionPairModality | SymbolConfusionPairModality | ThirdsPairModality) –

Return type:

dict

get_function()[source]#

Get iterable of transform function.

Return type:

List[Dict[str, Any]]

class dispel.providers.generic.tasks.cps.steps.ExtractAllReactionTime[source]#

Bases: ExtractSubsetReactionTimesBase

A reaction time extraction processing step for all keys.

lower: int | None = 0#
subset: AV | ResponsesModality = all keys (all)#
class dispel.providers.generic.tasks.cps.steps.ExtractCPSMeasures[source]#

Bases: ProcessingStepGroup

Extract all measures for a given mode, sequence and key set.

Parameters:
  • mode – The desired mode to compute the transformation (digit-to-symbol, digit-to-digit).

  • key_set – The specific key set filter on which you desire to extract measures.

  • sequence – The sequence type

__init__(mode, sequence, key_set=None)[source]#
Parameters:
class dispel.providers.generic.tasks.cps.steps.ExtractCPSMeasuresDTD[source]#

Bases: ProcessingStepGroup

Extract all measures for DTD mode, sequence and key set.

Parameters:

sequence – The sequence type

__init__(sequence)[source]#
Parameters:

sequence (CPSSequence) –

class dispel.providers.generic.tasks.cps.steps.ExtractCPSMeasuresSTD[source]#

Bases: ProcessingStepGroup

Extract all measures for STD mode, sequence and key set.

Parameters:
  • key_set – The specific key set filter on which you desire to extract measures.

  • sequence – The sequence type

__init__(sequence, key_set)[source]#
Parameters:
class dispel.providers.generic.tasks.cps.steps.ExtractCPSSteps[source]#

Bases: ExtractStep

CPS multiple steps extraction.

transform_functions#

An optional list of dictionaries containing at least the processing function under the key func

Type:

Iterable[Dict[str, Any]]

get_transform_functions()[source]#

Get the transform functions applied to the data sets.

Return type:

Generator[Tuple[Callable, Dict[str, Any]], None, None]

transform_functions: Iterable[Dict[str, Any]]#
class dispel.providers.generic.tasks.cps.steps.ExtractConfusionBase[source]#

Bases: ConfusionBase

Confusion measures extraction mix in.

apply_pair(data, pair)[source]#

Get apply function for ExtractSteps.

Parameters:

pair (DigitConfusionPairModality | SymbolConfusionPairModality | ThirdsPairModality) –

description: str = 'The total number of time {subset[0]} was provided instead of {subset[1]} '#
measure_name: AV = confusion (conf)#
validator: Callable[[Any], None] | None = <RangeValidator: [0, ∞]>#
Parameters:

value (Any) –

class dispel.providers.generic.tasks.cps.steps.ExtractConfusionDTD[source]#

Bases: ExtractConfusionBase

Confusion measures extraction.

confusion_pair: List[PairType] = [DigitConfusionPairModality.DIGIT_6_9, DigitConfusionPairModality.DIGIT_9_6]#
class dispel.providers.generic.tasks.cps.steps.ExtractConfusionDTS[source]#

Bases: ExtractConfusionBase

Confusion measures extraction.

confusion_pair: List[PairType] = [SymbolConfusionPairModality.SYMBOL_2_7, SymbolConfusionPairModality.SYMBOL_7_2, SymbolConfusionPairModality.SYMBOL_4_6, SymbolConfusionPairModality.SYMBOL_6_4, SymbolConfusionPairModality.SYMBOL_3_8, SymbolConfusionPairModality.SYMBOL_8_3]#
class dispel.providers.generic.tasks.cps.steps.ExtractConfusionRateBase[source]#

Bases: ConfusionBase

Confusion rate measures extraction mix in.

apply_pair(data, pair)[source]#

Get apply function for ExtractSteps.

Parameters:

pair (DigitConfusionPairModality | SymbolConfusionPairModality | ThirdsPairModality) –

description: str = 'The confusion rate between {subset} '#
measure_name: AV = confusion rate (confr)#
validator: Callable[[Any], None] | None = <RangeValidator: [0, ∞]>#
Parameters:

value (Any) –

class dispel.providers.generic.tasks.cps.steps.ExtractConfusionRateDTD[source]#

Bases: ExtractConfusionRateBase

Confusion measures extraction for digit.

confusion_pair: List[PairType] = [DigitConfusionPairModality.DIGIT_6_9, DigitConfusionPairModality.DIGIT_9_6]#
class dispel.providers.generic.tasks.cps.steps.ExtractConfusionRateDTS[source]#

Bases: ExtractConfusionRateBase

Confusion measures extraction for digit.

confusion_pair: List[PairType] = [SymbolConfusionPairModality.SYMBOL_2_7, SymbolConfusionPairModality.SYMBOL_7_2, SymbolConfusionPairModality.SYMBOL_4_6, SymbolConfusionPairModality.SYMBOL_6_4, SymbolConfusionPairModality.SYMBOL_3_8, SymbolConfusionPairModality.SYMBOL_8_3]#
class dispel.providers.generic.tasks.cps.steps.ExtractCorrectByThird[source]#

Bases: ExtractTotalAnswersBase

Number of errors in a specific subset ExtractStep.

static apply(data, subset, level)[source]#

Compute the number of errors in the selected third.

Parameters:
description: str = 'The number of correct answer within the {subset} subset.'#
get_function()[source]#

Get iterable of transform function.

Return type:

List[Dict[str, Any]]

measure_name: AV = number of correct answers (corr)#
subset_list = [ThirdsModality.FIRST_THIRD, ThirdsModality.SECOND_THIRD, ThirdsModality.THIRD_THIRD, ThirdsModality.SECOND_LAST_THIRD]#
class dispel.providers.generic.tasks.cps.steps.ExtractCorrectDiffBetweenThird[source]#

Bases: ExtractTotalAnswersBase

Compute the difference of correct answers between two thirds.

data_type: str | None = 'float64'#
description: str = 'The difference between the number of correct responses of the {left} of keys and the number of correct responses of the {right} of keys.'#
function_factory(subset)[source]#

Get function dictionary.

Parameters:

subset (ThirdsPairModality) –

Return type:

dict

get_function()[source]#

Get iterable of transform function.

Return type:

Iterable[Dict[str, Any]]

measure_name: AV = correct responses difference (corr_diff)#
third_list: List[ThirdsPairModality] = [ThirdsPairModality.THIRD_2_1, ThirdsPairModality.THIRD_3_1, ThirdsPairModality.THIRD_3_2]#
validator: Callable[[Any], None] | None = <RangeValidator: [-30, 30]>#
Parameters:

value (Any) –

class dispel.providers.generic.tasks.cps.steps.ExtractDifferencesKeyReactionTimeBase[source]#

Bases: KeyAnalysisBase

Difference Reaction Time ExtractStep mix in.

apply_key(data, key, agg)[source]#

Get apply function for ExtractSteps.

Parameters:
Return type:

WrappedResult[float]

description: str = 'The {aggregation} absolute reaction time difference between {key} '#
measure_name: AV = reaction time difference (rt_diff)#
class dispel.providers.generic.tasks.cps.steps.ExtractDifferencesReactionTimesBase[source]#

Bases: ExtractReactionTimesBase

A reaction time extraction processing step for five last keys.

aggregation: List[Tuple[str, str]] = [('mean', 'mean'), ('std', 'standard deviation'), ('median', 'median'), ('min', 'minimum'), ('max', 'maximum')]#
data_set_ids: str | Iterable[str] = 'keys-analysis'#

An iterable of data sets to be being processed

data_type: str | None = 'float64'#
description: str = 'The difference between the mean reaction time of the {left} keys and the mean reaction time of the {right} keys answered by user '#
measure_name: AV = reaction time difference (rt_diff)#
unit: str | None = 's'#
validator: Callable[[Any], None] | None = <RangeValidator: [-10, 10]>#
Parameters:

value (Any) –

class dispel.providers.generic.tasks.cps.steps.ExtractDigit1Error[source]#

Bases: SequenceTransformMixin, ExtractStep

Extract how many times an incorrect response was given for digit one.

data_set_ids: str | Iterable[str] = 'keys-analysis'#

An iterable of data sets to be being processed

get_level_filter()[source]#

Get the level filter based on the bubble size.

Return type:

LevelFilter

get_prototype_definition()[source]#

Get the measure value definition.

Return type:

MeasureValueDefinitionPrototype

class dispel.providers.generic.tasks.cps.steps.ExtractDigitSpecificReactionTimesDTD[source]#

Bases: KeyReactionTimeBase

Digit to Digit Reaction Time ExtractStep.

The digits 1, 6 and 9 are the most likely to be confused, and they will be used to compute reaction time measures.

key_list: List[KeyType] = [DigitEnum.DIGIT_1, DigitEnum.DIGIT_6, DigitEnum.DIGIT_9]#
class dispel.providers.generic.tasks.cps.steps.ExtractDigitSpecificReactionTimesSTD[source]#

Bases: KeyReactionTimeBase

Symbol to Digit Reaction Time ExtractStep.

aggregation_list: List[Tuple[str, str]] = [('mean', 'mean'), ('std', 'standard deviation'), ('median', 'median'), ('min', 'minimum'), ('max', 'maximum')]#
key_list: List[KeyType] = [SymbolEnum.SYMBOL_1, SymbolEnum.SYMBOL_2, SymbolEnum.SYMBOL_3, SymbolEnum.SYMBOL_4, SymbolEnum.SYMBOL_5, SymbolEnum.SYMBOL_6, SymbolEnum.SYMBOL_7, SymbolEnum.SYMBOL_8, SymbolEnum.SYMBOL_9]#
class dispel.providers.generic.tasks.cps.steps.ExtractDigitSymmetryPairedReactionTimes[source]#

Bases: KeyReactionTimeBase

Pair symmetry Reaction Time ExtractStep.

apply_key(data, key, agg)[source]#

Get apply function for ExtractSteps.

Parameters:
Return type:

WrappedResult[float]

key_list: List[KeyType] = [SymmetryModality.PAIRED]#
class dispel.providers.generic.tasks.cps.steps.ExtractDigitSymmetryUniqueReactionTimes[source]#

Bases: KeyReactionTimeBase

Unique symmetry Reaction Time ExtractStep.

apply_key(data, key, agg)[source]#

Get apply function for ExtractSteps.

Parameters:
Return type:

WrappedResult[float]

key_list: List[KeyType] = [SymmetryModality.UNIQUE]#
class dispel.providers.generic.tasks.cps.steps.ExtractErrorInThird[source]#

Bases: ExtractTotalAnswersBase

Number of errors in a specific subset ExtractStep.

static apply(data, subset, level)[source]#

Compute the number of errors in the selected third.

Parameters:
description: str = 'The number of errors within the {subset} '#
get_function()[source]#

Get iterable of transform function.

Return type:

List[Dict[str, Any]]

measure_name: AV = number of errors (err)#
subset_list = [ThirdsModality.FIRST_THIRD, ThirdsModality.SECOND_THIRD, ThirdsModality.THIRD_THIRD, ThirdsModality.SECOND_LAST_THIRD]#
class dispel.providers.generic.tasks.cps.steps.ExtractFatigabilityMixin[source]#

Bases: SequenceModeKeyModalityDefinitionMixIn, ExtractCPSSteps

Extract slope coefficients for capturing fatigability.

feat#

AV to define the slope coefficient or the r2 score of the model.

Type:

dispel.data.values.AbbreviatedValue

apply_fatigability(data, reg_mod)[source]#

Get fatigability apply function.

Parameters:
Return type:

float

data_set_ids: str | Iterable[str] = 'keys-analysis'#

An iterable of data sets to be being processed

data_type: str | None = 'float64'#
description: str = 'The {feat} of the linear regression on correctresponse times with {regression_modality} capturing the fatigability of the user '#
feat: AbbreviatedValue#
function_factory(reg_mod)[source]#

Get function dictionary.

Parameters:

reg_mod (RegressionMode) –

Return type:

dict

get_function()[source]#

Get iterable of transform function.

Return type:

Iterable[Dict[str, Any]]

measure_name: AV = fatigability (fat)#
regression_results: str#
validator: Callable[[Any], None] | None = None#
class dispel.providers.generic.tasks.cps.steps.ExtractKeySpecificReactionTimeDifferencesDTD[source]#

Bases: ExtractDifferencesKeyReactionTimeBase

Key specific difference Reaction Time ExtractStep.

key_list: List[KeyType] = [DigitConfusionPairModality.DIGIT_6_9]#
class dispel.providers.generic.tasks.cps.steps.ExtractKeySpecificReactionTimeDifferencesSTD[source]#

Bases: ExtractDifferencesKeyReactionTimeBase

Key specific difference Reaction Time ExtractStep.

aggregation_list: List[Tuple[str, str]] = [('mean', 'mean'), ('std', 'standard deviation'), ('median', 'median'), ('min', 'minimum'), ('max', 'maximum')]#
key_list: List[KeyType] = [SymbolConfusionPairModality.SYMBOL_2_7, SymbolConfusionPairModality.SYMBOL_3_8, SymbolConfusionPairModality.SYMBOL_4_6]#
class dispel.providers.generic.tasks.cps.steps.ExtractMaxStreaksBase[source]#

Bases: NotEmptyDataSetAssertionMixin, SequenceModeKeyModalityDefinitionMixIn, ExtractCPSSteps

A measure extraction processing step.

abstract apply_streak(data)[source]#

Get the measure value definition.

Parameters:

data (DataFrame) –

Return type:

int

data_set_ids: str | Iterable[str] = 'streak-data'#

An iterable of data sets to be being processed

data_type: str | None = 'int64'#
get_function()[source]#

Get iterable of transform function.

Return type:

Iterable[Dict[str, Any]]

validator: Callable[[Any], None] | None = <RangeValidator: [0, ∞]>#
Parameters:

value (Any) –

class dispel.providers.generic.tasks.cps.steps.ExtractMaxStreaksCorrectAnswers[source]#

Bases: ExtractMaxStreaksBase

A measure extraction processing step.

apply_streak(data)[source]#

Get iterable of transform function.

description: str = 'The maximum streak of correct responses of the user '#
measure_name: AV = maximum streak of correct responses (stk_corr)#
class dispel.providers.generic.tasks.cps.steps.ExtractMaxStreaksIncorrectAnswers[source]#

Bases: ExtractMaxStreaksBase

A measure extraction processing step.

apply_streak(data)[source]#

Get iterable of transform function.

description: str = 'The maximum streak of incorrect responses of the user '#
measure_name: AV = maximum streak of incorrect responses (stk_incorr)#
class dispel.providers.generic.tasks.cps.steps.ExtractNBacks[source]#

Bases: SequenceModeKeyModalityDefinitionMixIn, ExtractCPSSteps

Extract multiple strike pattern measures.

data_set_ids: str | Iterable[str] = 'n-backs'#

An iterable of data sets to be being processed

data_type: str | None = 'float64'#
description: str = 'The {aggregation} reaction time difference between {n_back}-backs occurrences (e.g. the {aggregation} reaction time difference between identical keys encountered in an interval of {n_back} keys) of the user '#
static function_factory(agg, agg_label, nback)[source]#

Get function dictionary.

Parameters:
  • agg (str) –

  • agg_label (str) –

  • nback (int) –

Return type:

dict

get_function()[source]#

Get iterable of transform function.

Return type:

Iterable[Dict[str, Any]]

measure_name: AV = reaction time difference over {n_back}-backs occurrences ({n_back}back)#
unit: str | None = 's'#
class dispel.providers.generic.tasks.cps.steps.ExtractPressures[source]#

Bases: SequenceModeKeyModalityDefinitionMixIn, AggregateRawDataSetColumn

Extract descriptive statistics of applied pressure.

aggregations: AggregationsDefinitionType = [('mean', 'mean'), ('std', 'standard deviation'), ('median', 'median'), ('min', 'minimum'), ('max', 'maximum'), ('skew', 'skewness'), ('kurtosis', 'kurtosis')]#
column_id: str = 'pressure'#
data_set_ids: str | Iterable[str] = 'screen'#

An iterable of data sets to be being processed

data_type: str | None = 'float64'#
description: str = 'The {aggregation} pressure exerted on the screen '#
measure_name: AV = pressure (press)#
class dispel.providers.generic.tasks.cps.steps.ExtractR2ScoreFatigability[source]#

Bases: ExtractFatigabilityMixin

Extract r2 scores to assess the quality of the slope coefficients.

feat: AV = r2 score (r2)#
regression_results: str = 'R2'#
validator: Callable[[Any], None] | None = <RangeValidator: [0.0, 1.0]>#
Parameters:

value (Any) –

class dispel.providers.generic.tasks.cps.steps.ExtractReactionThirdFactory[source]#

Bases: ExtractReactionTimesBase

Extract reaction time related measures.

aggregation: List[Tuple[str, str]] = [('mean', 'mean'), ('std', 'standard deviation'), ('median', 'median'), ('min', 'minimum'), ('max', 'maximum'), ('q95', '95th percentile'), ('q05', '5th percentile'), ('iqr', 'iqr'), ('cv', 'coefficient of variation of')]#
apply_third(data, subset, agg, level)[source]#

Get Apply function.

Parameters:
Return type:

WrappedResult[float]

function_factory(subset, agg, agg_label)[source]#

Get apply function for ExtractSteps.

Parameters:
Return type:

Dict

get_function()[source]#

Get iterable of transform function.

Return type:

Iterable[Dict[str, Any]]

subset_list = [ThirdsModality.FIRST_THIRD, ThirdsModality.SECOND_THIRD, ThirdsModality.THIRD_THIRD, ThirdsModality.SECOND_LAST_THIRD]#
class dispel.providers.generic.tasks.cps.steps.ExtractReactionTimeDifferencesLastFirst[source]#

Bases: ExtractDifferencesReactionTimesBase

Extract reaction time difference related measures.

static apply_last_first_reaction_time(data, agg)[source]#

Difference of reaction time between set beginning and end.

Parameters:
Return type:

WrappedResult[float]

function_factory(agg, agg_label)[source]#

Get function dictionary.

Parameters:
  • agg (str) –

  • agg_label (str) –

Return type:

Dict

get_function()[source]#

Get iterable of transform function.

Return type:

Iterable[Dict[str, Any]]

class dispel.providers.generic.tasks.cps.steps.ExtractReactionTimeDifferencesThirdDiff[source]#

Bases: ExtractDifferencesReactionTimesBase

Extract reaction time difference related measures.

apply_last_first_diff_reaction_time(data, subset, level, agg)[source]#

Difference of reaction time between set beginning and end.

Parameters:
Return type:

WrappedResult[float]

function_factory(subset, agg)[source]#

Get function dictionary.

Parameters:
Return type:

dict

get_function()[source]#

Get iterable of transform function.

Return type:

Iterable[Dict[str, Any]]

third_list: List[ThirdsPairModality] = [ThirdsPairModality.THIRD_2_1, ThirdsPairModality.THIRD_3_1, ThirdsPairModality.THIRD_3_2]#
class dispel.providers.generic.tasks.cps.steps.ExtractReactionTimeFiveFirst[source]#

Bases: ExtractSubsetReactionTimesBase

A reaction time extraction processing step for five first keys.

aggregation: List[Tuple[str, str]] = [('mean', 'mean'), ('std', 'standard deviation'), ('median', 'median'), ('min', 'minimum'), ('max', 'maximum'), ('q95', '95th percentile'), ('q05', '5th percentile'), ('iqr', 'iqr'), ('skew', 'skewness'), ('kurtosis', 'kurtosis')]#
lower: int | None = 0#
subset: AV | ResponsesModality = 1#
upper: int | None = 5#
class dispel.providers.generic.tasks.cps.steps.ExtractReactionTimeFiveLast[source]#

Bases: ExtractSubsetReactionTimesBase

A reaction time extraction processing step for five last keys.

aggregation: List[Tuple[str, str]] = [('mean', 'mean'), ('std', 'standard deviation'), ('median', 'median'), ('min', 'minimum'), ('max', 'maximum'), ('q95', '95th percentile'), ('q05', '5th percentile'), ('iqr', 'iqr'), ('skew', 'skewness'), ('kurtosis', 'kurtosis')]#
lower: int | None = -5#
subset: AV | ResponsesModality = 2#
class dispel.providers.generic.tasks.cps.steps.ExtractReactionTimesBase[source]#

Bases: SequenceModeKeyModalityDefinitionMixIn, ExtractCPSSteps, NotEmptyDataSetAssertionMixin

An extraction processing step mix in for reaction time.

aggregation: List[Tuple[str, str]]#
data_set_ids: str | Iterable[str] = 'keys-analysis'#

An iterable of data sets to be being processed

data_type: str | None = 'float64'#
description: str = 'The {aggregation} reaction time for {subset} of the user '#
measure_name: AV = reaction time (rt)#
unit: str | None = 's'#
class dispel.providers.generic.tasks.cps.steps.ExtractSlopeFatigability[source]#

Bases: ExtractFatigabilityMixin

Extract slope coefficients for capturing fatigability.

feat: AV = slope coefficient (slope)#
regression_results: str = 'Slope'#
validator: Callable[[Any], None] | None = <RangeValidator: [-10.0, 10.0]>#
Parameters:

value (Any) –

class dispel.providers.generic.tasks.cps.steps.ExtractSubsetReactionTimesBase[source]#

Bases: ExtractReactionTimesBase

An extraction processing step mix in for subset reaction time.

subset#

Enumerated constant representing the specific selection modalities

Type:

dispel.data.values.AbbreviatedValue | dispel.providers.generic.tasks.cps.modalities.ResponsesModality

lower#

The lower index to select of the data frame.

Type:

int | None

upper#

The upper index to select of the data frame.

Type:

int | None

aggregation: List[Tuple[str, str]] = [('mean', 'mean'), ('std', 'standard deviation'), ('median', 'median'), ('min', 'minimum'), ('max', 'maximum'), ('q95', '95th percentile'), ('q05', '5th percentile'), ('iqr', 'iqr'), ('skew', 'skewness'), ('kurtosis', 'kurtosis')]#
function_factory(agg, agg_label)[source]#

Get apply function for ExtractSteps.

get_function()[source]#

Get iterable of transform function.

Return type:

Iterable[Dict[str, Any]]

lower: int | None = None#
subset: AbbreviatedValue | ResponsesModality#
upper: int | None = None#
class dispel.providers.generic.tasks.cps.steps.ExtractTotalAnswerLen[source]#

Bases: ExtractTotalAnswersBase

Total of answers ExtractStep.

description: str = 'The total number of responses of the user '#
get_function()[source]#

Get iterable of transform function.

Return type:

Iterable[Dict[str, Any]]

measure_name: AV = total number of responses (tot)#
class dispel.providers.generic.tasks.cps.steps.ExtractTotalAnswersBase[source]#

Bases: SequenceModeKeyModalityDefinitionMixIn, ExtractCPSSteps

Mismatching Multiple Extract Steps mix in.

data_set_ids: str | Iterable[str] = 'keys-analysis'#

An iterable of data sets to be being processed

data_type: str | None = 'int64'#
validator: Callable[[Any], None] | None = <RangeValidator: [0, ∞]>#
Parameters:

value (Any) –

class dispel.providers.generic.tasks.cps.steps.ExtractTotalErrorPercentage[source]#

Bases: ExtractTotalAnswersBase

Percentage Total of errors ExtractStep.

description: str = 'The percentage of errors of the user '#
get_function()[source]#

Get iterable of transform function.

Return type:

Iterable[Dict[str, Any]]

measure_name: AV = percentage of errors (err_per)#
class dispel.providers.generic.tasks.cps.steps.ExtractTotalNumError[source]#

Bases: ExtractTotalAnswersBase

Total of errors ExtractStep.

description: str = 'The total number of errors of the user '#
get_function()[source]#

Get iterable of transform function.

Return type:

Iterable[Dict[str, Any]]

measure_name: AV = total number of errors (err)#
class dispel.providers.generic.tasks.cps.steps.ExtractTotalValidAnswerLen[source]#

Bases: ExtractTotalAnswersBase

Total of correct answers ExtractStep.

description: str = 'The number of correct responses of the user '#
get_function()[source]#

Get iterable of transform function.

Return type:

Iterable[Dict[str, Any]]

measure_name: AV = number of correct responses (corr)#
class dispel.providers.generic.tasks.cps.steps.KeyAnalysisBase[source]#

Bases: SequenceModeKeyModalityDefinitionMixIn, ExtractCPSSteps

Keys Analysis Multiple Extract Steps mix in.

key_list#

List of symbol or digits on which to apply analysis

Type:

List[dispel.providers.generic.tasks.cps.modalities.DigitEnum | dispel.providers.generic.tasks.cps.modalities.SymmetryModality | dispel.providers.generic.tasks.cps.modalities.DigitConfusionPairModality | dispel.providers.generic.tasks.cps.modalities.SymbolConfusionPairModality | dispel.providers.generic.tasks.cps.modalities.ThirdsPairModality | dispel.providers.generic.tasks.cps.modalities.SymbolEnum]

aggregation_list: List[Tuple[str, str]] = [('mean', 'mean'), ('std', 'standard deviation'), ('median', 'median'), ('min', 'minimum'), ('max', 'maximum'), ('q95', '95th percentile'), ('q05', '5th percentile'), ('iqr', 'iqr')]#
abstract apply_key(data, key, agg)[source]#

Get the measure value definition.

Parameters:
Return type:

WrappedResult[float]

data_set_ids: str | Iterable[str] = 'keys-analysis'#

An iterable of data sets to be being processed

data_type: str | None = 'float64'#
function_factory(key, agg)[source]#

Get function factory.

Parameters:
Return type:

dict

get_function()[source]#

Get iterable of transform function.

Return type:

List[Dict[str, Any]]

key_list: List[DigitEnum | SymmetryModality | DigitConfusionPairModality | SymbolConfusionPairModality | ThirdsPairModality | SymbolEnum]#
validator: Callable[[Any], None] | None = <RangeValidator: [0, 10]>#
Parameters:

value (Any) –

class dispel.providers.generic.tasks.cps.steps.KeyReactionTimeBase[source]#

Bases: KeyAnalysisBase

Reaction Time ExtractStep mix in.

apply_key(data, key, agg)[source]#

Get apply function for ExtractSteps.

Parameters:
Return type:

WrappedResult[float]

description: str = 'The {aggregation} reaction time for {key} '#
measure_name: AV = reaction time (rt)#
class dispel.providers.generic.tasks.cps.steps.SequenceModeKeyModalityDefinitionMixIn[source]#

Bases: object

A Mix in Class for Sequence, mode and key parameters.

Parameters:
  • mode – The desired mode to compute the transformation (digit-to-symbol, digit-to-digit).

  • key_set – The specific key set filter on which you desire to extract measures.

  • sequence – The sequence type

__init__(*args, **kwargs)[source]#
add_modality(modality)[source]#

Add additional modality.

Parameters:

modality (AbbreviatedValue) –

data_type: str | None = None#
description: str#
get_function()[source]#

Get iterable of transform function.

Return type:

Iterable[Dict[str, Any]]

get_prototype_definition()[source]#

Get the measure value definition.

Return type:

MeasureValueDefinitionPrototype

measure_name: AbbreviatedValue#
unit: str | None = None#
validator: Callable[[Any], None] | None = None#
class dispel.providers.generic.tasks.cps.steps.SequenceTransformMixin[source]#

Bases: object

A Mix in Class for Sequence parameters.

Parameters:

Sequence – The sequence type

__init__(*args, **kwargs)[source]#
abstract get_prototype_definition()[source]#

Get the measure value definition.

Return type:

MeasureValueDefinitionPrototype

class dispel.providers.generic.tasks.cps.steps.SummarizeCorrectResponses[source]#

Bases: AggregateModalities

Summarize correct responses irrespective of key set.

Parameters:

sequence – The CPS sequence for which to aggregate the measures.

__init__(sequence)[source]#
Parameters:

sequence (CPSSequence) –

get_definition(**kwargs)[source]#

Get the measure value definition.

Return type:

ValueDefinition

get_modalities()[source]#

Get the modalities to aggregate.

Return type:

List[List[str | AbbreviatedValue]]

class dispel.providers.generic.tasks.cps.steps.SummarizeKeySetOneTwoCorrectResponses[source]#

Bases: SummarizeCorrectResponses

Summarize correct responses of key set one and two.

get_definition(**kwargs)[source]#

Get the measure value definition.

Return type:

ValueDefinition

get_modalities()[source]#

Get the modalities to aggregate.

Return type:

List[List[str | AbbreviatedValue]]

class dispel.providers.generic.tasks.cps.steps.SummarizeKeySetOneTwoReactionTimeDiff[source]#

Bases: AggregateModalities

Summarize reaction time difference of key set one and two.

__init__(sequence, aggregation, extra_modality)[source]#
Parameters:
get_definition(**kwargs)[source]#

Get the measure value definition.

Return type:

ValueDefinition

get_modalities()[source]#

Get the modalities to aggregate.

Return type:

List[List[str | AbbreviatedValue]]

class dispel.providers.generic.tasks.cps.steps.SummarizeKeySetOneTwoReactionTimeExtraModality[source]#

Bases: AggregateModalities

Summarize reaction time for key set one and two.

__init__(sequence, aggregation, **kwargs)[source]#
Parameters:
get_definition(**kwargs)[source]#

Get the measure value definition.

Return type:

ValueDefinition

get_modalities()[source]#

Get the modalities to aggregate.

Return type:

List[List[str | AbbreviatedValue]]

class dispel.providers.generic.tasks.cps.steps.SummarizeMeasures[source]#

Bases: ProcessingStepGroup

A processing step group containing all the measure aggregation steps.

__init__()[source]#
class dispel.providers.generic.tasks.cps.steps.SummarizeResponseTimes[source]#

Bases: AggregateModalities

Summarize response times irrespective of key set.

__init__(mode)[source]#
Parameters:

mode (CPSMode) –

get_definition(**kwargs)[source]#

Get the measure value definition.

Return type:

ValueDefinition

get_modalities()[source]#

Get the modalities to aggregate.

Return type:

List[List[str | AbbreviatedValue]]

class dispel.providers.generic.tasks.cps.steps.TransformConfusion[source]#

Bases: TransformKeyAnalysisBase

Create a confusion matrix between pressed and displayed symbols or digits.

The confusion matrix is either on the symbols or digits CPS keys depending on the current processed level.

definitions: List[RawDataValueDefinition] = [<RawDataValueDefinition: 1 (confusion for 1, float64)>, <RawDataValueDefinition: 2 (confusion for 2, float64)>, <RawDataValueDefinition: 3 (confusion for 3, float64)>, <RawDataValueDefinition: 4 (confusion for 4, float64)>, <RawDataValueDefinition: 5 (confusion for 5, float64)>, <RawDataValueDefinition: 6 (confusion for 6, float64)>, <RawDataValueDefinition: 7 (confusion for 7, float64)>, <RawDataValueDefinition: 8 (confusion for 8, float64)>, <RawDataValueDefinition: 9 (confusion for 9, float64)>]#
new_data_set_id: str = 'confusion-matrix'#
transform_function()#

Compute the confusion matrix for each symbols/digits.

Parameters:

data (DataFrame) – A pandas data frame coming from dispel.providers.generic.tasks.cps.steps.TransformKeysAnalysisData.

Returns:

The confusion matrix for the current level.

Return type:

pandas.DataFrame

class dispel.providers.generic.tasks.cps.steps.TransformKeyAnalysisBase[source]#

Bases: TransformStep

Transformation step based on keys-analysis.

data_set_ids: str | Iterable[str] = 'keys-analysis'#

An iterable of data sets to be being processed

class dispel.providers.generic.tasks.cps.steps.TransformKeysAnalysisData[source]#

Bases: NotEmptyDataSetAssertionMixin, TransformUserInputBase

Create a data frame of reaction time per symbol or digit association.

The data frame has three columns, the reaction time to press a key when one is displayed, a column expected with the displayed key, and a column actual with the key pressed by the user.

definitions: List[RawDataValueDefinition] = [<RawDataValueDefinition: expected (expected item.)>, <RawDataValueDefinition: actual (actual item given.)>, <RawDataValueDefinition: mismatching (The error between expected and actual items.)>, <RawDataValueDefinition: reactionTime (reaction time., s)>, <RawDataValueDefinition: tsAnswer (timestamp answer)>]#
new_data_set_id: str = 'keys-analysis'#
transform_function(level)#

Create a uniform data frame from user responses to perform analyses.

Parameters:
  • data (DataFrame) – A pandas data frame obtained from a reading raw data set userInput

  • level (Level) – The level to be processed

Raises:

ValueError – Make sure length between input data and transformed dataset are consistent

Returns:

The proper pandas data frame containing expect, actual ,``reactionTime`` and tsAnswer pandas.Series to perform the digits or symbols analyses.

Return type:

pandas.DataFrame

class dispel.providers.generic.tasks.cps.steps.TransformNBacks[source]#

Bases: TransformKeyAnalysisBase

A transform step to extract data frame containing n-backs information.

Extract 1Back, 2Back and 3Back reaction time for correct responses to capture the working memory capacity of participants.

definitions: List[RawDataValueDefinition] = [<RawDataValueDefinition: rtBack1 (reaction time for 1-back back, float64)>, <RawDataValueDefinition: rtCurrent1 (reaction time for 1-back current, float64)>, <RawDataValueDefinition: rtBack2 (reaction time for 2-back back, float64)>, <RawDataValueDefinition: rtCurrent2 (reaction time for 2-back current, float64)>, <RawDataValueDefinition: rtBack3 (reaction time for 3-back back, float64)>, <RawDataValueDefinition: rtCurrent3 (reaction time for 3-back current, float64)>]#
new_data_set_id: str = 'n-backs'#
transform_function()#

Extract 1Back, 2Back and 3Back reaction time for correct responses only.

Parameters:

data (DataFrame) – A pandas data frame obtained from dispel.providers.generic.tasks.cps.steps.TransformKeysAnalysisData.

Returns:

a pandas data frame containing 1,2 and 3 back and current reaction time when each 1,2 or 3 back is displayed for a given level.

Return type:

pandas.DataFrame

class dispel.providers.generic.tasks.cps.steps.TransformStreakData[source]#

Bases: NotEmptyDataSetAssertionMixin, TransformUserInputBase

Extract the longest streak of incorrect/correct responses.

apply(data)[source]#

Get transform function.

definitions: List[RawDataValueDefinition] = [<RawDataValueDefinition: correct (longest streak of correct responses.)>, <RawDataValueDefinition: incorrect (longest streak of incorrect responses.)>]#
new_data_set_id: str = 'streak-data'#
class dispel.providers.generic.tasks.cps.steps.TransformUserInputBase[source]#

Bases: TransformStep

Transformation step based on keys-analysis.

data_set_ids: str | Iterable[str] = 'userInput'#

An iterable of data sets to be being processed