data - Data handling utilities

indfloat Convert string to float, with support for inf and nan.
parse_file Parse a file into a header and data.

Data handling utilities.

bumps.data.indfloat(s)[source]

Convert string to float, with support for inf and nan.

Example:

>>> from numpy import isinf, isnan
>>> print(isinf(indfloat('inf')))
True
>>> print(isinf(indfloat('-inf')))
True
>>> print(isnan(indfloat('nan')))
True
bumps.data.parse_file(file)[source]

Parse a file into a header and data.

Header lines look like # key value Keys can be made multiline by repeating the key Data lines look like float float float Comment lines look like # float float float Data may contain inf or nan values.

Special hack for TOF data: if the first column contains bin edges, then the last row will only have the bin edge. To make the array square, we replace the bin edges with bin centers.