1919def loadData (filename , minrows = 10 , headers = False , hdel = '=' , hignore = None , ** kwargs ):
2020 """Find and load data from a text file.
2121
22- The data reading starts at the first matrix block of at least minrows rows
23- and constant number of columns. This seems to work for most of the
24- datafiles including those generated by PDFGetX2.
22+ The data block is identified as the first matrix block of at least minrows rows
23+ and constant number of columns. This seems to work for most of the datafiles including
24+ those generated by PDFGetX2.
2525
2626 filename -- name of the file we want to load data from.
2727 minrows -- minimum number of rows in the first data block.
2828 All rows must have the same number of floating point values.
29- headers -- when true (default False), the function instead returns
30- a dictionary of values specified in header.
29+ headers -- when False (defualt), the function returns a numpy array of the
30+ data in the data block. When True, the function instead returns a
31+ dictionary of parameters and their corresponding values parsed from
32+ header (information prior the data block). See hdel and hignore for
33+ options to help with parsing header information.
3134 hdel -- (only used when headers enabled) delimiter for parsing header
32- information.
35+ information (default '='). e.g. using default hdel, the line
36+ 'parameter = p_value' is put into the dictionary as
37+ {parameter: p_value}.
3338 hignore -- (only used when headers enabled) ignore header rows beginning
34- with any elements in the hignore list
39+ with any elements in the hignore list. e.g. hignore=['# ', '[']
40+ means the following lines are skipped: '# qmax=10', '[defaults]'.
3541 kwargs -- keyword arguments that are passed to numpy.loadtxt including
36- the following arguments below.
37- delimiter -- delimiter for the data in the block.
42+ the following arguments below. (See also numpy.loadtxt for more
43+ details.)
44+ delimiter -- delimiter for the data in the block (default None). e.g. for
45+ comma-separated values in the datablock, set delimiter to ','.
3846 usecols -- zero-based index of columns to be loaded, by default use
3947 all detected columns. The reading skips data blocks that
4048 do not have the usecols-specified columns.
@@ -43,9 +51,8 @@ def loadData(filename, minrows=10, headers=False, hdel='=', hignore=None, **kwar
4351 Note transposing the loaded array as loadData(FILENAME).T
4452 has the same effect.
4553
46- Return a numpy array of the data. (See also numpy.loadtxt for more details.)
47- If headers enabled, instead returns a dictionary of values read from header
48- information.
54+ Return a numpy array of the data. If headers enabled, instead returns a
55+ dictionary of parameters read from the header.
4956 """
5057 from numpy import array , loadtxt
5158 # for storing header data
0 commit comments