getxyFromFile

Return to directory of Todd's CASA extensions

Gets two columns of data from an ASCII file, as numpy arrays. See also interpolateTable.

Usage:

au.getxyFromFile(filename, xcol, ycol, delimiter=None, maxLines=None, 
            startAfter=None, stopAt=None, yhms=False, ydms=False)
Inputs:
  • xcol: the column number from which to read x-axis data
  • ycol: the column number from which to read y-axis data
  • delimiter: the string that delimits columns within a row (default = None which means whitespace)
  • startAfter: if defined, then skip all rows up to and including the first one contaning 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.SSS and convert to deg
  • ydms: if True, then read 3 columns starting at ycol as DD MM SS.SSS and convert to deg

If a colon is seen in the xcol & ycol data, and xcol = ycol, then assume both columns are a sky position in sexagesimal format and convert them to radians. If a colon is seen in only one of them, then assume it is HH:MM[:SS] and convert it to floating point hours.

Example:

CASA <6>: au.getxyFromFile('random.both',xcol=0,ycol=21)
Skipping row 1 because there are only 1 columns.
  Out[6]:
(array([ 79.34,  92.57,  74.23,  73.54,  83.93,  79.78,  77.58,  80.42,
        76.14,  84.57,  79.66,  78.12,  93.07,  78.79,  91.85,  76.03,
        78.96,  93.6 ,  74.51,  72.2 ,  74.51,  86.11,  73.1 ,  85.24,
        92.79,  90.5 ,  86.89,  79.84,  72.82,  78.94,  84.36,  84.91,
        94.71,  83.97,  73.17,  90.37,  74.49,  76.64,  86.75,  90.5 ,
        88.53,  83.21,  87.58,  90.02,  85.57,  80.42,  86.05,  72.67,
        90.42,  83.53,  83.91,  93.55,  94.26,  81.86,  72.4 ,  80.93,
        91.54,  75.01,  85.03,  83.87,  79.56,  94.66,  74.87,  91.26,
        89.63,  74.07,  76.6 ,  89.67,  88.87,  94.15,  78.1 ,  83.7 ,
        74.66,  86.14,  84.68,  79.02,  85.66,  94.99,  76.94,  74.02,
        83.48,  91.27,  92.29,  83.05,  73.03,  90.78,  85.04,  76.34,
        93.39,  75.75,  94.14,  89.52,  79.4 ,  85.66,  74.53,  88.73,
        76.81,  86.73,  82.16,  74.45,  72.47,  85.09,  86.89,  80.42,
        72.96,  78.7 ,  79.37,  89.99,  79.98,  82.88,  77.5 ,  90.08,
        80.71,  86.64,  84.07,  85.8 ,  74.73,  80.73,  80.62,  93.18,
        77.89,  72.38,  93.13,  89.13,  88.81,  85.48,  82.32,  84.95,
        86.97,  77.53,  72.54,  93.63,  85.47,  72.14,  82.41,  82.64,
        77.37,  93.16,  86.89,  73.35,  82.7 ,  84.48,  80.17,  88.19,
        89.07,  91.41,  78.01,  83.29,  92.89,  82.68,  82.88,  73.86,
        80.25,  80.14,  80.56,  84.1 ,  85.42,  89.95,  91.51,  82.83,
        73.94,  88.56,  92.71,  88.66,  87.34,  86.15,  86.31,  76.85,
        74.57,  83.83,  84.72,  78.72,  76.93,  85.39,  81.45,  82.82,
        76.69,  94.7 ,  76.56,  82.54,  84.35,  75.72,  87.65,  86.49,
        73.5 ,  82.14,  77.58,  91.46,  85.3 ,  73.68,  74.77,  87.  ,
        88.57,  85.96,  72.1 ,  91.61,  78.59,  86.99,  72.49,  82.59]),
 array([ 26.,  17.,  18.,  18.,  19.,  20.,  47.,  14.,  23.,  17.,  15.,
        56.,  17.,  26.,  16.,  28.,  17.,  16.,  19.,  19.,  20.,  16.,
        19.,  17.,  15.,  12.,  10.,  20.,  19.,  18.,  15.,  17.,  16.,
        17.,  18.,  16.,  18.,  17.,  14.,  13.,  24.,  18.,  12.,  18.,
        15.,  17.,  15.,  18.,  12.,  25.,  26.,  16.,  17.,  16.,  19.,
        15.,  20.,  20.,  18.,  22.,  20.,  18.,  20.,  16.,  13.,  20.,
        17.,  14.,  15.,  16.,  50.,  17.,  19.,  15.,  14.,  19.,  18.,
        16.,  19.,  28.,  21.,  16.,  15.,  18.,  20.,  20.,  17.,  18.,
        17.,  18.,  19.,  14.,  20.,  15.,  20.,  13.,  18.,  11.,  16.,
        20.,  25.,  16.,  14.,  18.,  18.,  18.,  22.,  19.,  16.,  21.,
        14.,  17.,  15.,  20.,  16.,  18.,  24.,  16.,  16.,  15.,  49.,
        18.,  17.,  19.,  14.,  17.,  25.,  19.,  62.,  18.,  17.,  15.,
        16.,  19.,  18.,  15.,  15.,  17.,  12.,  20.,  18.,  14.,  19.,
        13.,  19.,  15.,  51.,  18.,  16.,  20.,  17.,  19.,  15.,  16.,
        15.,  17.,  16.,  19.,  17.,  17.,  19.,  16.,  14.,  14.,  16.,
        14.,  16.,  17.,  18.,  15.,  14.,  20.,  16.,  17.,  15.,  18.,
        17.,  17.,  18.,  13.,  17.,  17.,  12.,  13.,  20.,  14.,  16.,
        19.,  16.,  20.,  18.,  59.,  14.,  14.,  19.,  16.,  18.,  52.,
        19.,  20.]))

-- ToddHunter - 2014-01-17

This topic: ALMA > TWikiUsers > ToddHunter > CasaExtensions > GetxyFromFile
Topic revision: 2015-01-02, 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