nifty7.domain_tuple module

class DomainTuple(domain, _callingfrommake=False)[source]

Bases: object

Ordered sequence of Domain objects.

This class holds a tuple of Domain objects, which together form the space on which a Field is defined. This corresponds to a tensor product of the corresponding vector fields.


DomainTuples should never be created using the constructor, but rather via the factory function make!

property axes

axis indices of the underlying domains


tuple of tuple of int

static make(domain)[source]

Returns a DomainTuple matching domain.

This function checks whether a matching DomainTuple already exists. If yes, this object is returned, otherwise a new DomainTuple object is created and returned.


domain (Domain or tuple of Domain or DomainTuple) – The geometrical structure for which the DomainTuple shall be obtained.

static scalar_domain()[source]

Returns the uniform volume element for a sub-domain of self.


spaces (int, tuple of int or None) – Indices of the sub-domains to be considered. If None, the entire domain is used.


If the requested sub-domain has a uniform volume element, it is returned. Otherwise, None is returned.

Return type

float or None

property shape

number of pixels along each axis

The shape of the array-like object required to store information defined on the DomainTuple.


tuple of int

property size

total number of pixels.

Equivalent to the products over all entries in the object’s shape.




Returns the total volume of self or of a subspace of it.


spaces (int, tuple of int or None) – Indices of the sub-domains of the domain to be considered. If None, the total volume of the whole domain is returned.


the total volume of the requested (sub-)domain.

Return type