triqs.gfs.descriptor_base.Function

class triqs.gfs.descriptor_base.Function(function)[source]

Bases: Base

Descriptor wrapping a Python callable.

When applied to a Green’s function with mesh values \(\{x_i\}\), sets G.data[i] = function(x_i) for every mesh point.

Parameters:
functioncallable

A function f(mesh_value) -> scalar or numpy.ndarray matching the target’s target_shape.

Attributes

function

(callable) The stored function f, accessible as an attribute.

Methods

__call__(G)

Fill G.data with function evaluated at every mesh point.

Examples

>>> from triqs.gfs.descriptor_base import Function
>>> g << Function(lambda w: 1.0 / (w - 0.5))