triqs.gfs.backwd_compat.gf_legendre.GfLegendre.__getitem__

GfLegendre.__getitem__(key)

Return a mesh point, a sliced view, or a target-space sub-block.

The bracket operator dispatches on the type of key:

  • g[:] — return self (so that g[:] << RHS is equivalent to g << RHS).

  • g[mp] with mp a MeshPoint, Idx or MatsubaraFreq — return the target-space slab at that mesh point (a numpy array).

  • g[mp0, mp1, ...] — same, for a MeshProduct.

  • g[mp, :] (mix of mesh points and :) — return a Gf on the remaining mesh axes.

  • g[i, j, ...] with all-integer indices — extract a target_rank-dimensional sub-block as a Gf view of reduced target rank.

  • g[i:j, ...] with all-slice indices — slice the target space and return a Gf view.

Parameters:
keyslice, MeshPoint, Idx, MatsubaraFreq, int, or tuple thereof

See the bullet list above.

Returns:
Gf or numpy.ndarray

A Gf view when the operation slices the mesh or target space; a numpy array when key resolves to a single mesh point.

Notes

Partial slicing of the mesh and string indices are not supported.