E-Cell Simulation Environment Version 3.1.100 User's Manual (Draft: Dec. 18, 2003) | ||
---|---|---|
Prev | Chapter 5. Scripting A Simulation Session | Next |
E-Cell SE uses ECD (E-Cell Data) file format to store simulation results. ECD is a plain text file, and easily handled by user-written and third-party data processing and plotting software such as gnuplot.
An ECD file can store a matrix of floating-point numbers.
ecell.ECDDataFile
class can be
used to save and load ECD files. A
ECDDataFile
object takes and returns a rank-2
array of Numeric Python. A
'rank-2' array is a matrix, which means that
Numeric.rank( ARRAY )
and len(
Numeric.shape( ARRAY ) )
returns
'2
'.
ECDDataFile
classTo import the ECDDataFile
class,
import the whole ecell
module,
import ecellor import
ecell.ECDDataFile
module selectively.
import ecell.ECDDataFile
To save data to an ECD file, say,
datafile.ecd, instantiate an
ECDDataFile
object and use
save
() method.
DATA
is a rank-2 array
of Numeric Python or an
equivalent object. The data can also be set by using
setData
() method after the
instantiation. If the data is already set, it is replaced.
Loading the ECD file is also straightforward.
ThegetData
() method extracts the data from the ECDDataFile
object as an array.
In addition to the data itself, an ECD file can hold some information in its header.
Data name
The name of data. Setting a FullPN may be a good idea. Use setDataName
( name
) and getDataName
() methods to set and get this field.
Label
This field is used to name axes
of the data. Use setLabel
(
labels
) and
getLabel
() methods. These
methods takes and returns a
Python tuple,
and stored in the file as a space-separated list. The default value of this field is: ( 't', 'value', 'avg', 'min', 'max' )
.
Note
This is a free-format field.
This can be a multi-line or a single-line string. Use
setNote
(
note
) and
getNote
().
The header information is stored in the file like this.
#DATA: #SIZE: 5 1010 #LABEL: t value avg min max #NOTE: # #---------------------- 0 0.1 0.1 0.1 0.1 ...Each line of the header is headed by a sharp (#) character. The
'#SIZE:'
line is automatically set when saved to
show size of the data. This field is ignored in loading. The header
ends with '#----...'
.
For most cases Numeric Python will offer any necessary functionality for scientific data processing. However, using some external software can enhance the usability.
ECD files can be used as input to any software which supports white space-separated text format, and treats lines with heading sharps (#) as comments.
GNU gnuplot is a scientific presentation-quality plotting software with a sophisticated interactive command system. To plot an ECD file from gnuplot, just use plot command. For example, this draws a time-value 2D-graph:
Use using modifier to specify which column to use for the plotting. The following example makes a time-average 2D-plot.Another OpenSource software useful for data processing is GNU Octave. Loading an ECD from Octave is also simplest.
Now the data is stored in a matrix variable with the same name as the file without the extension (datafile
).
Currently loading and saving of the binary file format is not supported. However, Numeric Python has an efficient, platform-dependent way of exporting and importing array data. See the Numeric Python manual.