Package xdp :: Module data
[show private | hide private]
[frames | no frames]

Module xdp.data

Exceptions
RebinError Exception indicating that an error occured during rebinning.

Function Summary
2-tuple of the form (start, end) checkRange(Min, Max, start, end)
Perform range checking and assist in implementing autoranging.
  clean(v, *vectors)
Remove recurring values from one or more vectors.
Numeric matrix or None coljoin(*vectors)
Join two or more vectors together as the columns of a matrix.
int, float, or complex greatestMin(*vectors)
Find the greatest minimum value of a series of vectors.
Numeric vector grid(start, stop, stepSize)
Create a vector which can be used as an abscissa for interpolation.
int, float, or complex leastMax(*vectors)
Find the least maximum value of a series of vectors.
2-tuple of the form (greatest_minimum, least_maximum) minmax(*vectors)
Find the greatest minimum and least maximum of a series of vectors.
Numeric matrix old_rebin(data, eColumn, Eo, after, kstep)
Reduce XAFS data by binning it in k-space.
Numeric matrix rebin(data, eColumn, Eo, offset, estep, kstep)
Reduce XAFS data by binning it's pre-edge and XAFS regions.
Numeric matrix rebin_data(x, data, grid)
The data reduction algorithm used by rebin().
2-tuple of the form (trimmed_x, trimmed_y) trim(x, y, start, end)
Trim vectors to fit a new range of independent values.

Function Details

checkRange(Min, Max, start, end)

Perform range checking and assist in implementing autoranging.

The values of start and end are checked for validity against the range minimum Min and the range maximum Max. If start or end is None then the value of Min or Max, repectively, will be returned in its place.
Parameters:
Min - minimum valid value in the range
           (type=int or float)
Max - maximum valid value in the range
           (type=int or float)
start - start of the range
           (type=int, float, or None)
end - end of the range
           (type=int, float, or None)
Returns:
final start and end values
           (type=2-tuple of the form (start, end))
Raises:
ValueError - either start or end is outside of the valid range

clean(v, *vectors)

Remove recurring values from one or more vectors.

Recurring values are removed from the vector v and the corresponding elements are removed from elements of vectors
Parameters:
v - vector to check for recurring values
           (type=Numeric vector)
vectors - additional vectors to clean
           (type=n-tuple of Numeric vectors)
Returns:
vectors with recurring values in v removed @rtype : n-tuple of Numeric vectors
Raises:
ValueError - not all elements of vectors are vectors with the same length as v

coljoin(*vectors)

Join two or more vectors together as the columns of a matrix.
Parameters:
vectors - vectors to join
           (type=n-tuple of Numeric vectors)
Returns:
matrix with vectors as the columns
           (type=Numeric matrix or None)
Raises:
ValueError - not all elements of vectors are vectors with the same length

Note: The function returns None when vectors == ().

greatestMin(*vectors)

Find the greatest minimum value of a series of vectors.
Parameters:
vectors - series of vectors
           (type=n-tuple of Numeric vectors)
Returns:
greatest minimum value of vectors or zero if vectors is empty
           (type=int, float, or complex)

grid(start, stop, stepSize)

Create a vector which can be used as an abscissa for interpolation.
Parameters:
start - first value in the grid
           (type=int or float)
stop - last value in the grid
           (type=int or float)
stepSize - difference between values in the grid
           (type=int, float, or complex)
Returns:
vector of values going from start to stop by {stepSize}
           (type=Numeric vector)

leastMax(*vectors)

Find the least maximum value of a series of vectors.
Parameters:
vectors - series of vectors
           (type=n-tuple of Numeric vectors)
Returns:
least maximum value of vectors or zero if vectors is empty
           (type=int, float, or complex)

minmax(*vectors)

Find the greatest minimum and least maximum of a series of vectors.

Example:
   >>> x = [1,2,3,4,5]
   >>> y = [0,2,4,6,8]
   >>> print xdp.range.minmax(x, y)
   (1, 5)
Parameters:
vectors - series of vectors
           (type=n-tuple of Numeric vectors)
Returns:
the greatest minimum and least maximum of vectors
           (type=2-tuple of the form (greatest_minimum, least_maximum))

old_rebin(data, eColumn, Eo, after, kstep)

Reduce XAFS data by binning it in k-space.

All points for which the energy is greater than Eo+after are reduced to a new set of points in which the energy varies regularly with respect to k-space, which increases by k-step per point.
Parameters:
data - XAFS data
           (type=Numeric matrix)
eColumn - index of the energy column
           (type=int)
Eo - edge energy
           (type=int or float)
after - rebin this much after Eo
           (type=int or float)
kstep - bin size in k-space
           (type=int or float)
Returns:
matrix of rebinned data
           (type=Numeric matrix)
Raises:
RebinError - Eo or after is too large, or on of the k-space bins contained no data

rebin(data, eColumn, Eo, offset, estep, kstep)

Reduce XAFS data by binning it's pre-edge and XAFS regions.

All points for which the energy is greater than Eo+offset are reduced to a new set of points in which the energy varies regularly with respect to k-space, which increases by k-step per point.

If {e-step} is not None, then all points for which the energy is less than Eo+offset are reduced to a new set of points in which the energy varies regularly with an increas of e-step per point.
Parameters:
data - XAFS data
           (type=Numeric matrix)
eColumn - index of the energy column in data
           (type=int)
Eo - edge energy
           (type=int or float)
offset - rebin this much before and after Eo
           (type=int or float)
estep - bin size of pre-edge region
           (type=int or float or None to disable pre-edge rebinning)
kstep - bin size of XAFS region in k-space
           (type=int or float)
Returns:
matrix of rebinned data
           (type=Numeric matrix)
Raises:
RebinError - Eo or offset is too large

rebin_data(x, data, grid)

The data reduction algorithm used by rebin().
Parameters:
x - values of the independent variable from data
           (type=Numeric vector)
data - data to be reduced
           (type=Numeric matrix)
grid - regular abscissa of bin values
           (type=Numeric vector)
Returns:
Numeric matrix
Raises:
RebinError - one of the bins contained no data

trim(x, y, start, end)

Trim vectors to fit a new range of independent values.

All of the x/y pairs outside of the range of start to end are discarded. Either start or end may be None, which indicates that that portion of the range should not be trimmed.
Parameters:
x - independent values
           (type=Numeric vector)
y - dependent values
           (type=Numeric vector or array)
start - beginning of the new range
           (type=int, float, or None)
end - end of the new range
           (type=int, float, or None)
Returns:
trimmed vectors
           (type=2-tuple of the form (trimmed_x, trimmed_y))
Raises:
ValueError - either start or end is outside the valid range for x

Note: Due to the implementation of Numeric, the trimmed vectors reference the same data as the original vectors. Subsequent changes made to the trimmed vectors will be reflected in the values of the original vectors. If this is undesirable, use the copy method of the vectors to create an independent copy of the data.


Generated by Epydoc 2.1 on Wed Jul 20 11:51:05 2005 http://epydoc.sf.net