interpolateTable

Return to directory of Todd's CASA extensions

Perform a spline (or other type of) interpolation on any two columns in a table of data from an ASCII file. Uses getxyFromFile.

Usage:

au.interpolateTable(filename, xcol, ycol, xvalue, delimiter=None, k=3, 
     startAfter=None,  stopAt=None, xvaluecol=None, maxLines=None, 
     yhms=False, ydms=False)
Inputs:
  • filename: an ascii file with 2 or more columns that are space-delimited
  • xcol: the column number to use for x
  • ycol: the column number to use for y
  • xvalue: the value(s) of x for which you want to determine y. If it is a string, then assume it is a filename and read values from xvaluecol (up to maxLines)
  • xvaluecol: the column number to use from file=xvalue for new xvalues
  • delimiter: the string that delimits columns within a row (default = whitespace)
  • k: if an integer, then use scipy.interpolate.UnivariateSpline
  • k: if a string, then use scipy.interpolate.interp1d with corresponding options: 'linear', 'nearest', 'zero', 'slinear', 'quadratic', 'cubic'
  • startAfter: if defined, then skip all rows up to and including the first one containing this string
  • stopAt: if defined, then skip all remaining rows when this string is seen
  • yhms: if True, then read 3 columns starting at ycol as HH MM SS and convert to deg
  • ydms: if True, then read 3 columns starting at ycol as DD MM SS and convert to deg
Returns:
  • Either a scalar value or an array of values, depending on the type of xvalue

Example:

CASA <3>: au.interpolateTable('yig.MLXM-0818.ascii',2,0,58000)
Skipping row 1 because there are only 1 columns.
  Out[3]: 58.077275005358388

-- ToddHunter - 2014-01-10
Topic revision: r4 - 2015-03-10, ToddHunter
This site is powered by FoswikiCopyright © by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding NRAO Public Wiki? Send feedback