snake.core.handlers.base#

Base handler module.

Module Contents#

Classes#

MetaHandler

MetaClass for Handlers.

AbstractHandler

Handler Interface.

HandlerList

Represent a Chain of Handler, that needs to be apply to a simulation.

Functions#

list_handlers

List all available handlers.

get_handler

Get a handler from its name.

Data#

API#

snake.core.handlers.base.T = 'TypeVar(...)'#
class snake.core.handlers.base.MetaHandler[source]#

Bases: snake._meta.MetaDCRegister

MetaClass for Handlers.

dunder_name: ClassVar[str] = 'handler'#
class snake.core.handlers.base.AbstractHandler[source]#

Handler Interface.

__registry__: ClassVar[dict[str, type[snake.core.handlers.base.AbstractHandler]]] = None#
__handler_name__: ClassVar[str] = None#
get_static(phantom: snake.core.phantom.Phantom, sim_conf: snake.core.simulation.SimConfig) snake.core.phantom.Phantom[source]#

Get the static information of the handler.

get_dynamic(phantom: snake.core.phantom.Phantom, sim_conf: snake.core.simulation.SimConfig) snake.core.phantom.DynamicData | None[source]#

Get the dynamic information of the handler.

get_dynamic_kspace(sim_conf: snake.core.simulation.SimConfig) snake.core.phantom.KspaceDynamicData | None[source]#

Get the dynamic kspace information of the handler.

to_yaml() str[source]#

Show the yaml config associated with the handler.

class snake.core.handlers.base.HandlerList(*args: snake.core.handlers.base.AbstractHandler)[source]#

Bases: collections.UserList

Represent a Chain of Handler, that needs to be apply to a simulation.

Initialization

classmethod from_cfg(cfg: dict[str, Any]) snake.core.handlers.base.HandlerList[source]#

Create a HandlerList from a configuration.

to_yaml(filename: str | None = None) str[source]#

Serialize the handlerList as a yaml string.

serialize() list[dict[str, Any]][source]#

Serialize the handlerList as a list of dictionary.

snake.core.handlers.base.H = None#
snake.core.handlers.base.handler = None#
snake.core.handlers.base.list_handlers() list[str][source]#

List all available handlers.

snake.core.handlers.base.get_handler(name: str) type[snake.core.handlers.base.AbstractHandler][source]#

Get a handler from its name.