next up previous contents index
Next: Operator Class Up: esys.escript Classes Previous: Interpolating Data   Contents   Index


Saving Data as CSV

For simple post-processing, Data objects can be saved in comma separated value format.

If mydata1 and mydata2 are scalar data, the following command:
\begin{python}
saveDataCSV('output.csv',U=mydata1, V=mydata2)
\end{python}
will record the values of mydata in output.csv in the following format:

U, V
1.0000000e+0, 2.0000000e-1
5.0000000e-0, 1.0000000e+1
...

The names of the keyword parameters form the names of columns in the output. If the data objects are over different function spaces, then saveDataCSV will attempt to interpolate to a common function space. If this is not possible, then an exception will be raised.

Output can be restricted using a scalar mask.
\begin{python}
saveDataCSV('outfile.csv', U=mydata1, V=mydata2, mask=myscalar)
\end{python}
Will only output those rows which correspond to to positive values of myscalar. Some aspects of the output can be tuned using additional parameters.
\begin{python}
saveDataCSV('data.csv', append=True, sep=' ', csep='/', mask=mymask, e=mat1)
\end{python}

The above command would produce output like this:

e/0/0 e/1/0 e/0/1 e/1/1
1.0000000000e+00 2.0000000000e+00 3.0000000000e+00 4.0000000000e+00
...

Note that while the order in which rows are output can vary, all the elements in a given row always correspond to the same input.


next up previous contents index
Next: Operator Class Up: esys.escript Classes Previous: Interpolating Data   Contents   Index
esys@esscc.uq.edu.au