Skip to content

mopipe.core.data.reader

reader.py

This module contains the default Reader classes, including the AbstractReader base class which can be used for creating new readers.

AbstractReader Objects

class AbstractReader(ABC)

AbstractReader

Abstract base class for all Readers. Readers are used to read data from a source and return it in a pandas dataframe.

__init__

@abstractmethod
def __init__(source: t.Union[str, Path, pd.DataFrame],
             name: str,
             data_id: t.Optional[str] = None,
             sample_rate: t.Optional[float] = None,
             **kwargs)

Initialize the AbstractReader.

Parameters

source : Path or DataFrame The source of the data to be read. name : str The name of the data/experiment to be read. data_id : str, optional The id of the data to be read. If not provided, a random id will be generated. sample_rate : float, optional The sample rate of the data to be read.

source

@property
def source() -> t.Union[Path, pd.DataFrame]

The source of the data to be read.

sample_rate

@property
def sample_rate() -> t.Optional[float]

The sample rate of the data to be read.

allowed_extensions

@property
def allowed_extensions() -> list[str]

The allowed extensions for the source.

metadata

@property
def metadata() -> MetaData

The metadata for the data to be read.

name

@property
def name() -> str

The name of the data/experiment to be read.

data_id

@property
def data_id() -> str

The id of the data/experiment to be read.

read

@abstractmethod
def read() -> t.Optional[EmpiricalData]

Read the data from the source and return it as a dataframe.

MocapReader Objects

class MocapReader(AbstractReader)

MocapReader

The MocapReader class is used to read motion capture data from a source and return it as a pandas dataframe.

__init__

def __init__(source: t.Union[Path, pd.DataFrame],
             name: str,
             data_id: t.Optional[str] = None,
             sample_rate: t.Optional[float] = None,
             **kwargs)

Initialize the MocapReader.

Parameters

source : Path or DataFrame The source of the data to be read. name : str The name of the data/experiment to be read. sample_rate : float, optional The sample rate of the data to be read. level : DataLevel, optional The level of the data to be read.

metadata

@property
def metadata() -> MocapMetaData

The metadata for the data to be read.

read

def read() -> MocapTimeSeries

Read the data from the source and return it as a dataframe.

Returns

MocapTimeSeries The data read from the source.