/[escript]/trunk/escript/py_src/util.py
ViewVC logotype

Diff of /trunk/escript/py_src/util.py

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 3359 by gross, Wed Nov 17 08:02:32 2010 UTC revision 3360 by jfenwick, Thu Nov 18 00:20:21 2010 UTC
# Line 99  def saveDataCSV(filename, append=False, Line 99  def saveDataCSV(filename, append=False,
99      Writes `Data` objects to a csv file.      Writes `Data` objects to a csv file.
100      These objects must have compatible FunctionSpaces. ie it must be possible to      These objects must have compatible FunctionSpaces. ie it must be possible to
101      interpolate all data to one `FunctionSpace`.      interpolate all data to one `FunctionSpace`.
102      Example::  
     s=Scalar(..)  
     v=Vector(..)  
     t=Tensor(..)  
         f=float()  
     saveDataCSV("f.csv",a=s, b=v, c=t, d=f)  
       
     Will result in a file  
       
     a, b0, b1, c0_0, c0_1, .., c1_0    d  
     1.0, 1.5, 2.7, 3.1, 3.4, .., 0.89  0.0  
     0.9, 8.7, 1.9, 3.4, 7.8, .., 1.21  0.0  
       
     The first line is a header, the remaining lines give the values.  
       
103      :param filename: file to save data to.      :param filename: file to save data to.
104      :type filename: ``string``      :type filename: ``string``
105      :param append: If ``True``, then open file at end rather than beginning      :param append: If ``True``, then open file at end rather than beginning
# Line 121  def saveDataCSV(filename, append=False, Line 107  def saveDataCSV(filename, append=False,
107      :param sep: separator between fields      :param sep: separator between fields
108      :type sep: ``string``      :type sep: ``string``
109      :param csep: separator for components of rank2 and above eg ('_' -> c0_1)      :param csep: separator for components of rank2 and above eg ('_' -> c0_1)
110        
111      The keyword args are Data objects to save.      The keyword args are Data objects to save.
112      If a scalar `Data` object is passed with the name ``mask``, then only      If a scalar `Data` object is passed with the name ``mask``, then only
113      samples which correspond to positive values in ``mask`` will be output.      samples which correspond to positive values in ``mask`` will be output.
114        Example::
115    
116            s=Scalar(..)
117            v=Vector(..)
118            t=Tensor(..)
119            f=float()
120            saveDataCSV("f.csv",a=s, b=v, c=t, d=f)
121        
122        Will result in a file
123        
124        a, b0, b1, c0_0, c0_1, .., c1_0    d
125        1.0, 1.5, 2.7, 3.1, 3.4, .., 0.89  0.0
126        0.9, 8.7, 1.9, 3.4, 7.8, .., 1.21  0.0
127        
128        The first line is a header, the remaining lines give the values.
129    
130      """      """
131      # find a function space:      # find a function space:
132      fs = None      fs = None

Legend:
Removed from v.3359  
changed lines
  Added in v.3360

  ViewVC Help
Powered by ViewVC 1.1.26