3. dataList¶
dataList contain a list of dataArray for several datasets.
- list subclass as lists of dataArrays (allowing variable sizes).
- basic list routines as read/save, appending, selection, filter, sort, prune, interpolate, spline…
- multidimensional least square fit that uses the attributes of the dataArray elements.
- read/write in human readable ASCII text of multiple files in one run (gzip possible).
dataList creation can be from read ASCII files or ndarrays as js.dL(‘filename.dat’).
A file may contain several datasets.
See dataList for details.
Example:
p=js.grace()
dlist2=js.dL()
x=np.r_[0:10:0.5]
D,A,q=0.45,0.99,1.2
for q in np.r_[0.1:2:0.2]:
dlist2.append(js.dA(np.vstack([x,np.exp(-q**2*D*x),np.random.rand(len(x))*0.05])) )
dlist2[-1].q=q
p.clear()
p.plot(dlist2,legend='Q=$q')
p.legend()
dlist2.save('test.dat.gz')
The dataarray module can be run standalone in a new project.
3.1. Attributes¶
dataList.attr |
Returns all attribute names (including commonAttr of elements) of the dataList. |
dataList.commonAttr |
Returns list of attribute names existing in elements. |
dataList.dtype |
return dtype of elements |
dataList.names |
List of element names. |
dataList.whoHasAttributes |
Lists which attribute is found in which element. |
dataList.showattr([maxlength, exclude]) |
Show data specific attributes for all elements. |
3.2. Fitting¶
dataList.fit(model[, freepar, fixpar, …]) |
Least square fit of model that minimizes chi**2 (uses scipy.optimize.leastsq). |
dataList.modelValues(**kwargs) |
Calculates modelValues of model after a fit. |
dataList.setLimit(**kwargs) |
Set upper and lower limits for parameters in least square fit. |
dataList.hasLimit |
Return existing limits |
dataList.setConstrain(*args) |
Set inequality constrains for constrained minimization in fit. |
dataList.hasConstrain |
Return list with defined constrained source code. |
dataList.makeErrPlot(**kwargs) |
dummy |
dataList.makeNewErrPlot(**kwargs) |
dummy |
dataList.detachErrPlot() |
dummy |
dataList.killErrPlot(**kwargs) |
dummy |
dataList.showlastErrPlot(**kwargs) |
dummy |
dataList.errPlot(*args, **kwargs) |
dummy |
dataList.savelastErrPlot(**kwargs) |
dummy |
dataList.interpolate([func, invfunc, deg]) |
Interpolates Y at given attribute values for X values. |
dataList.polyfit([func, invfunc, xfunc, …]) |
Inter/Extrapolated values along attribut for all given X values using a polyfit. |
dataList.extrapolate([func, invfunc, xfunc, …]) |
Inter/Extrapolated values along attribut for all given X values using a polyfit. |
dataList.bispline([func, invfunc, tx, ta, …]) |
Weighted least-squares bivariate spline approximation for interpolation of Y at given attribute values for X values. |
3.3. Housekeeping¶
dataList.setColumnIndex(*arg, **kwargs) |
Set the columnIndex where to find X,Y,Z, eY, eX, eZ….. |
dataList.append([objekt, index, usecols, …]) |
Reads/creates new dataArrays and appends to dataList. |
dataList.extend([objekt, index, usecols, …]) |
Reads/creates new dataArrays and appends to dataList. |
dataList.insert(i[, objekt, index, usecols, …]) |
Reads/creates new dataArrays and inserts in dataList. |
dataList.prune(*args, **kwargs) |
Reduce number of values between upper and lower limits. |
dataList.savetxt([name, exclude, fmt]) |
Saves dataList as ASCII text file, optional compressed (gzip). |
dataList.sort([key, reverse]) |
Sort dataList -> INPLACE!!! |
dataList.reverse() |
Reverse dataList -> INPLACE!!! |
dataList.delete(index) |
Delete element at index |
dataList.extractAttribut(parName[, func, …]) |
Extract a simpler attribute from a complex attribute in each element of dataList. |
dataList.filter(filterfunction) |
Filter elements according to filterfunction. |
dataList.index(value[, start, stop]) |
original doc from list |
dataList.merge(indices[, isort]) |
Merges elements of dataList. |
dataList.mergeAttribut(parName[, limit, …]) |
Merges elements of dataList if attribute values are closer than limit (in place). |
dataList.pop([i]) |
original doc from list |
dataList.copyattr2elements([maxndim, exclude]) |
Copy dataList specific attributes to all elements. |
dataList.getfromcomment(attrname) |
Extract a non number parameter from comment with attrname in front |
dataList.transposeAttribute(attr) |
Use attribute as new X axis (like transpose .X and attribute). |