4.1.6. Misc

mod.prefixFilename(name)

Utility function for converting script-relative paths to current-working-directory-relative paths (see also include()). This function is used in all PyMØD functions that takes a filename as argument. To circumvent this prefixing use the CWDPath class.

Returns:

name prefixed with all strings pushed with pushFilePrefix() and popped yet.

Return type:

str

mod.pushFilePrefix(s)

Push another prefix used in prefixFilename(). The prefixes are concatenated in the order they are pushed. No directory delimiters are inserted, so they must explicitly be part of the pushed prefixes. If the argument starts with /, then during concatenation all previously pushed prefixes are ignored.

Parameters:

s (str) – the string to push as a prefix to be concatenated in prefixFilename().

mod.popFilePrefix()

Pop a previously pushed prefix.

class mod.CWDPath

A dummy class to wrap a filename in to disable prefixing.

For example, if a graph GML file is to be loaded relative to the current file (assuming include() is used for script inclusion), then it can be done with

g = graphGML(f)

If the file is located relative to the current working directory (i.e., where the mod wrapper script were invoked from), then the graph loading should be done as

g = graphGML(CWDPath(f))
__init__(f)

Wrap a filename.

mod.magicLibraryValue()
Returns:

a number unique for each instantiation of libMØD. This can be used to check for the diamond problem for shared libraries.

Return type:

int

mod.version()
Returns:

the version of MØD.

Return type:

str

mod.rngReseed(seed)

Reseed the random bit generator used in the library.

mod.rngUniformReal()
Returns:

a uniformly random real number between 0 and 1. :rtype: float