dispel.data.levels module#

A module containing models for levels.

class dispel.data.levels.Context[source]#

Bases: ValueSet

Contextual information for a level.

class dispel.data.levels.Level[source]#

Bases: Epoch

An entity to separate sub-task inside each test (Levels).

FIXME: DOC

context#

Contextual information about the level

measure_set#

A :class:’~dispel.data.measures.MeasureSet’ of a given Level

Parameters:
  • id – The identifier of a given Level.

  • start – The timestamp of the beginning of the level

  • end – The timestamp of the end of the level

  • context – Contextual information about the level

  • raw_data_sets – An iterable of :class:’~dispel.data.raw.RawDataSet’ of a given Level

  • measure_set – A :class:’~dispel.data.measures.MeasureSet’ of a given Level

  • epochs – An iterable of EpochMeasureSet to be added to the level.

__init__(id_, start, end, context=None, raw_data_sets=None, measure_set=None, epochs=None)[source]#
Parameters:
property epochs: List[LevelEpoch]#

Get all epoch measure sets.

get_raw_data_set(id_)[source]#

Get the raw data set for a given data set id.

Parameters:
  • id – The id of the raw data set to be returned

  • id_ (str) –

Returns:

The raw data set with the matching id

Return type:

RawDataSet

Raises:

ValueError – If the given id does not correspond to any existing raw data set within the level.

has_raw_data_set(id_)[source]#

Return True if the level contains the desired raw data set.

Parameters:

id_ (str) –

Return type:

bool

property id: LevelId#

Get the ID of the level from its definition.

Returns:

The ID of the definition provided via definition.

Return type:

LevelId

property raw_data_sets: List[RawDataSet]#

Get all raw data sets.

set(value, **kwargs)[source]#
set(value)
set(value)
set(value, concatenate=False, overwrite=False)
set(value)
set(value)

Set a value inside a level.

class dispel.data.levels.LevelEpoch[source]#

Bases: Epoch, MeasureSet

Level specific epoch with measures.

This data model allows to store measures that are specific to a given time point during an evaluation.

VALUE_CLS#

alias of LevelEpochMeasureValue

class dispel.data.levels.LevelEpochMeasureValue[source]#

Bases: MeasureValue

A measure value for a specific epoch.

Parameters:

epoch – The epoch for which the measure value was extracted.

epoch#

The epoch for which the measure value was extracted.

__init__(epoch, *args, **kwargs)[source]#
Parameters:

epoch (LevelEpoch) –

to_dict(stringify=False)[source]#

Get a dictionary representation of measure information.

Parameters:

stringify (bool) – True if all dictionary values are converted to strings. False otherwise.

Returns:

A dictionary summarizing measure value and epoch information.

Return type:

Dict[str, Optional[Any]]

class dispel.data.levels.LevelId[source]#

Bases: DefinitionId

Match evaluation code with level id.

Parameters:

modalities – One or several context information on which the LevelId is built.

__init__(modalities)[source]#
Parameters:

modalities (str | List[str]) –

class dispel.data.levels.Modalities[source]#

Bases: object

An entity to match level context modalities with a Level.id.

Parameters:

mapping – A dict composed of evaluation_code and level context information

__init__(mapping=None, app_version=None)[source]#
Parameters:
  • mapping (Dict[str, Any] | None) –

  • app_version (str | None) –

get_modalities_from_context(evaluation_code, context)[source]#

Map level contexts to level modalities from an evaluation code.

Parameters:
Return type:

str | List[str]

property is_default_mode#

Return whether the app version is the default mode.

exception dispel.data.levels.RawDataSetAlreadyExists[source]#

Bases: Exception

Exception risen when a raw data set with an existent id is set in level.

Parameters:
  • raw_data_set_id – The identifier of the raw data set in question.

  • message – An optional message.

__init__(raw_data_set_id, level_id, message='')[source]#
Parameters: