PatchProcessor

class of dascore.core.processor
inherits from: DascoreBaseModel, pydantic.main.BaseModel
source

PatchProcessor(
    *args ,
)-> None

An operation on a patch, written as a class.

Subclasses declare their parameters as fields and override some of:

  • derive(patch): the result’s metadata, from a patch without data.
  • plan(patch, out): the numbers kernel needs, as a dict of ints, floats, bools, tuples of those, or numeric arrays.
  • kernel(data, **plan): the array computation. None of it may see a patch, so a chain of kernels can be compiled.
  • reconcile(data, out): the one hook which sees both halves.

Each subclass is registered under name (snake case of the class name unless set) and gets a generated patch function, cls.patch_function: (patch, <fields in declaration order>), with *name for the field _var_positional names and **kwargs when extra="allow". A class with name = None gets neither.

Methods

Name Description
check Refuse a patch which does not carry what the operation needs.
derive Return the result’s metadata, as a patch without data.
kernel_for Return the kernel this class runs for a backend, or None.
new Create new instance with some attributed updated.
plan Return the keyword arguments kernel needs; see the class docs.
reconcile Return the result’s metadata once the data are known; default as is.
run Run the operation: check, derive, plan, kernel, reconcile, record.