How to construct an electron#

An electron is a single subtask in the workflow. In order to construct an electron, we define a function to perform some task and attach the electron decorator as shown in the two examples below.

import covalent as ct

Here’s how one can construct an electron for the identity operation.

def identity(x):
    return x

As another example, consider how an electron corresponding to the quadrature operation is created.

from math import sqrt

def quadrature(x, y):
    return sqrt(x**2 + y**2)