neuralset.base.Chain

class neuralset.base.Chain(*, infra: Backend | None = None, steps: list[Step] | OrderedDict[str, Step])[source][source]

A sequence of processing steps executed in order.

A Chain groups multiple Step objects (such as Study and EventsTransform) into a single cohesive pipeline. Because a Chain is itself a Step, it can be nested inside other chains or used anywhere a Step is expected. When you call .run(), it passes the output of each step as the input to the next.

Parameters:
  • steps (list of dict or dict of str to dict) – The ordered sequence of steps to execute. Since this is a pydantic config, it is strongly recommended to pass a list of dictionaries rather than instantiated objects (these dictionaries are coerced automatically). If a dict of dicts is provided, the keys act as step names.

  • infra (dict or exca.Infra, optional) – A pydantic config for caching and execution infrastructure inherited from Step. If provided, it determines how the final output of the chain is cached (e.g. using the Cached backend) or executed remotely (e.g. via Slurm).

Examples

chain = ns.Chain(steps=[
    {"name": "MyStudy", "path": "/data",
     "infra": {"backend": "Cached", "folder": "/cache"}},
    {"name": "QueryEvents", "query": "timeline_index < 5"},
])
events = chain.run()