matscipy.io.tbl

Functions

loadtbl(fn[, usecols, types, fromfile])

Load tabulated data from column header strings.

savetbl(fn, **kwargs)

Save tabulated data and write column header strings.

matscipy.io.tbl.savetbl(fn, **kwargs)

Save tabulated data and write column header strings.

Example

savetbl(‘file.dat’, time=time, strain=strain, energy=energy)

Parameters:
  • fn (str) – Name of file to write to.

  • kwargs (dict) – Keyword argument pass data and column header names.

matscipy.io.tbl.loadtbl(fn, usecols=None, types=None, fromfile=False, **kwargs)

Load tabulated data from column header strings.

Example data file:

# time strain energy 1.0 0.01 283 2.0 0.02 398 …

strain, energy = loadtbl(‘file.dat’, usecols=[‘strain’, ‘energy’])

Parameters:
  • fn (str) – Name of file to load.

  • usecols (list of strings) – List of column names.

  • types (dictionary) – Types per column.

  • fromfile (bool) – Use numpy.fromfile instead of numpy.loadtxt if set to True. Can be faster in some circumstances.

Returns:

data – Return tuple of array with data for each colume in usecols if usecols specified. For usecols=None, return dictionary with header keys and arrays as data entries.

Return type:

tuple of arrays