/ . / Trajectory / DCD / MDToolsMarch97 / md_Data.py / Data
General structure for sequence of data points.
Data: fields, names, data
Methods:
d = Data(fields,[data])
fields: list or tuple of field names as in (t ,x ,y ,z )
d.append(rec) - append a record such as (1,1.2,3.2,5.1)
d[8:13] - return a list of records
len(d) - return number of records
addfield(name,args,func) - add a field based on other fields
name: name of new field, as in x+y
args: tuple of arguments for func, as in (x ,y ), just one, as in x
func: function to create new field, as in lambda x,y:x+y
addindex([offset],[name]) - add an index field
filter(args,func) - return new Data of records that pass filter func
average(args,[func]) - mean of function (default is x)
deviation(args,[func]) - STD of function (default is x)
Warning: deviation() divides by N - 1 to estimate the STD from a sample
plot([args]) - launch a plotting program to plot args
list([args],[file],[titles]) - print to screen (file) w/ or w/o titles
See also: xyplotfunction
Methods
|
|
|
deviation
|
deviation (
self,
args,
func=None,
zero=0.,
)
|
|
plot
|
plot ( self, args=None )
|
|
__getitem__
|
__getitem__ ( self, key )
|
|
__getslice__
|
__getslice__ (
self,
i,
j,
)
|
|
addfield
|
addfield (
self,
name,
args,
func,
)
|
|
average
|
average (
self,
args,
func=None,
zero=0.,
)
|
|
addindex
|
addindex (
self,
offset=0,
name='index',
)
Exceptions
|
|
'field name ' + ` name ` + ' already in use'
|
|
|
list
|
list (
self,
args=None,
file=None,
titles=1,
)
|
|
filter
|
filter (
self,
args,
func,
)
|
|
__init__
|
__init__ (
self,
fields,
data=[],
)
Exceptions
|
|
"integer field names not allowed"
"duplicate field name " + ` f `
|
|
|
append
|
append ( self, rec )
|
|
__repr__
|
__repr__ ( self )
|
|
|