Util

The util module provides a collection of general purpose methods. Most importantly it provides the run() method which is the preferred entry point of a nutils application, taking care of command line parsing, output dir creation and initiation of a log file.

class nutils.util.ImmutableArray[source]

immutable array

nutils.util.delaunay(points)[source]

delaunay triangulation

nutils.util.withrepr(f)[source]

add string representation to generated function

class nutils.util.Cache(*args)[source]

cache

nutils.util.getpath(pattern)[source]

create file in dumpdir

nutils.util.sum(seq)[source]

a better sum

nutils.util.product(seq)[source]

multiply items in sequence

nutils.util.clone(obj)[source]

clone object

nutils.util.iterate(context='iter', nmax=-1)[source]

iterate forever

class nutils.util.NanVec[source]

nan-initialized vector

where[source]

find non-nan items

class nutils.util.Clock(interval)[source]

simple interval timer

nutils.util.tensorial(args)[source]

create n-dimensional array containing tensorial combinations of n args

nutils.util.arraymap(f, dtype, *args)[source]

call f for sequence of arguments and cast to dtype

nutils.util.objmap(func, *arrays)[source]

map numpy arrays

nutils.util.fail(msg, *args)[source]

generate exception

class nutils.util.Locals[source]

local namespace as object

nutils.util.getkwargdefaults(func)[source]

helper for run

class nutils.util.Statm(rusage=None)[source]

memory statistics on systems that support it

nutils.util.run(*functions)[source]

call function specified on command line