normalized_nodes_on_bdry

odl.util.normalize.normalized_nodes_on_bdry(nodes_on_bdry, length)[source]

Return a list of 2-tuples of bool from the input parameter.

This function is intended to normalize a nodes_on_bdry parameter that can be given as a single boolean (global) or as a sequence (per axis). Each entry of the sequence can either be a single boolean (global for the axis) or a boolean sequence of length 2.

Parameters
nodes_on_bdrybool or sequence

Input parameter to be normalized according to the above scheme.

lengthpositive int

Desired length of the returned list.

Returns
normalizedlist of 2-tuples of bool

Normalized list with length entries, each of which is a 2-tuple of boolean values.

Examples

Global for all axes:

>>> normalized_nodes_on_bdry(True, length=2)
[(True, True), (True, True)]

Global per axis:

>>> normalized_nodes_on_bdry([True, False], length=2)
[(True, True), (False, False)]

Mixing global and explicit per axis:

>>> normalized_nodes_on_bdry([[True, False], False, True], length=3)
[(True, False), (False, False), (True, True)]