register#

Base classes for loading datakit sources.

class mesofield.datakit.sources.register.LoadContext[source]#

Bases: object

Context object passed to every DataSource.load call.

Carries identity (subject/session/task), the inventory row for that cell (so sources can locate sibling files via path_for()), and any upstream sources that were loaded for the same cell as declared on DataSource.requires.

For backward parity with previous releases, when "dataqueue" is present in dependencies, the convenience attributes dataqueue_frame, dataqueue_meta, master_timeline, and experiment_window are populated from it. New sources should prefer reading from dependencies directly.

path_for(tag)[source]#

Return the path stored in the inventory row for tag, or None.

Parameters:

tag (str)

Return type:

Path | None

require_path(tag)[source]#

Like path_for() but raises FileNotFoundError when missing.

Parameters:

tag (str)

Return type:

Path

get_dependency(tag)[source]#

Return a previously-loaded dependency stream, or None if unavailable.

Parameters:

tag (str)

Return type:

LoadedStream | None

require_dependency(tag)[source]#

Like get_dependency() but raises if the dependency is missing.

Parameters:

tag (str)

Return type:

LoadedStream

__init__(subject, session, task, inventory_row, dependencies=<factory>, master_timeline=None, experiment_window=None, dataqueue_frame=None, dataqueue_meta=None)#
Parameters:
Return type:

None

class mesofield.datakit.sources.register.DataSource[source]#

Bases: object

Base class for a file-backed data source.

requires: ClassVar[Tuple[str, ...]] = ()#

Tag names of upstream sources whose loaded streams should be made available via LoadContext.dependencies. Soft contract: a missing or failed dependency yields None in dependencies[tag]; sources are responsible for either degrading gracefully or raising.

load(path, *, context=None)[source]#

Load data from the given path.

Parameters:
Return type:

LoadedStream

class mesofield.datakit.sources.register.TimeseriesSource[source]#

Bases: DataSource

Base class for time-indexed sources.

build_timeseries(path, *, context=None)[source]#

Return (timeline, value, meta).

Parameters:
Return type:

tuple[ndarray, Any, Dict[str, Any]]

load(path, *, context=None)[source]#

Load data from the given path.

Parameters:
Return type:

LoadedStream

class mesofield.datakit.sources.register.TableSource[source]#

Bases: DataSource

Base class for static table sources.

build_table(path, *, context=None)[source]#

Return (timeline, value, meta).

Parameters:
Return type:

tuple[ndarray, Any, Dict[str, Any]]

load(path, *, context=None)[source]#

Load data from the given path.

Parameters:
Return type:

LoadedStream

class mesofield.datakit.sources.register.IntervalSeriesSource[source]#

Bases: DataSource

Base class for interval-based sources.

build_intervals(path, *, context=None)[source]#

Return an intervals table with start/stop columns and meta.

Parameters:
Return type:

tuple[DataFrame, Dict[str, Any]]

load(path, *, context=None)[source]#

Load data from the given path.

Parameters:
Return type:

LoadedStream