Package PyFoam :: Package ThirdParty :: Package Gnuplot :: Module utils
[hide private]
[frames] | no frames]

Module utils

source code

utils.py -- Utility functions used by Gnuplot.

This module contains utility functions used by Gnuplot.py which aren't particularly gnuplot-related.

Functions [hide private]
 
float_array(m)
Return the argument as a numpy array of type at least 'Float32'.
source code
 
write_array(f, set, item_sep=' ', nest_prefix='', nest_suffix='\n', nest_sep='')
Write an array of arbitrary dimension to a file.
source code
Function Details [hide private]

float_array(m)

source code 

Return the argument as a numpy array of type at least 'Float32'.

Leave 'Float64' unchanged, but upcast all other types to 'Float32'. Allow also for the possibility that the argument is a python native type that can be converted to a numpy array using 'numpy.asarray()', but in that case don't worry about downcasting to single-precision float.

write_array(f, set, item_sep=' ', nest_prefix='', nest_suffix='\n', nest_sep='')

source code 
Write an array of arbitrary dimension to a file.

    A general recursive array writer.  The last four parameters allow
    a great deal of freedom in choosing the output format of the
    array.  The defaults for those parameters give output that is
    gnuplot-readable.  But using '(",", "{", "}", ",
")' would output
    an array in a format that Mathematica could read.  'item_sep'
    should not contain '%' (or if it does, it should be escaped to
    '%%') since it is put into a format string.

    The default 2-d file organization::

        set[0,0] set[0,1] ...
        set[1,0] set[1,1] ...

    The 3-d format::

        set[0,0,0] set[0,0,1] ...
        set[0,1,0] set[0,1,1] ...

        set[1,0,0] set[1,0,1] ...
        set[1,1,0] set[1,1,1] ...