file IO class for reading ascii files with extensions
More...
file IO class for reading ascii files with extensions
- dat(.gz)
- vec(.gz) Direct read/write to gzipped files is possible. The class automatically determines if the file is gzipped by its extension.
This class is little more than an elaborate wrapper for the numpy loadtxt and savetxt functions, but is included for completeness in the :mod:carputils.carpio
module.
- Parameters
-
filename | str The filename to open |
mode | str, optional 'r' for read mode (default), 'w' for write mode |
◆ __init__()
def carputils.carpio.txt.TxtFile.__init__ |
( |
|
self, |
|
|
|
filename, |
|
|
|
mode = 'r' |
|
) |
| |
◆ check_ext()
def carputils.carpio.txt.TxtFile.check_ext |
( |
|
self, |
|
|
|
ext |
|
) |
| |
◆ close()
def carputils.carpio.txt.TxtFile.close |
( |
|
self | ) |
|
◆ count()
def carputils.carpio.txt.TxtFile.count |
( |
|
self | ) |
|
◆ data()
def carputils.carpio.txt.TxtFile.data |
( |
|
self | ) |
|
Return a numpy array of the file contents.
- Returns
-
numpy.ndarray A numpy array with the file contents
◆ write()
def carputils.carpio.txt.TxtFile.write |
( |
|
self, |
|
|
|
data, |
|
|
|
kwargs |
|
) |
| |
Write a numpy array to a .dat or .vec file.
- Parameters
-
data | numpy.ndarray The array to be written to the IGB file |
The documentation for this class was generated from the following file: