eon.fileio
#
Con(figuration) i/o library
Module Contents#
Classes#
Functions#
Load a con file filein: may be either a filename or a file-like object |
|
Save a con file fileout: can be either a file name or a file-like object p: information (in the form of an atoms object) to save w: write/append flag |
|
Reads a mode.dat file into an N by 3 numpy array modefilein: may be either a file-like object of a filename |
|
Saves an Nx3 numpy array into a mode.dat file. modefileout: may be either a filename or file-like object displace_vector: the mode (Nx3 numpy array) |
|
Saves a results.dat file from a dictionary |
|
Reads a results.dat file and gives a dictionary of the values contained therein |
|
Load the POSCAR file named filename and returns an atoms object |
|
Save a POSCAR fileout: name to save it under point: atoms object to save w: write/append flag |
|
Data#
API#
- eon.fileio.logger#
‘getLogger(…)’
- eon.fileio.loadcon(filein, reset=True)[source]#
Load a con file filein: may be either a filename or a file-like object
- eon.fileio.savecon(fileout, p, w='w')[source]#
Save a con file fileout: can be either a file name or a file-like object p: information (in the form of an atoms object) to save w: write/append flag
- eon.fileio.load_mode(modefilein)[source]#
Reads a mode.dat file into an N by 3 numpy array modefilein: may be either a file-like object of a filename
- eon.fileio.save_mode(modefileout, displace_vector)[source]#
Saves an Nx3 numpy array into a mode.dat file. modefileout: may be either a filename or file-like object displace_vector: the mode (Nx3 numpy array)
- eon.fileio.parse_results(filein)[source]#
Reads a results.dat file and gives a dictionary of the values contained therein
- eon.fileio.loadposcar(filein)[source]#
Load the POSCAR file named filename and returns an atoms object
- eon.fileio.saveposcar(fileout, p, w='w', direct=False)[source]#
Save a POSCAR fileout: name to save it under point: atoms object to save w: write/append flag
- class eon.fileio.ini(filenames)[source]#
Bases:
configparser.ConfigParser
- class eon.fileio.Dynamics(filename)[source]#
The Dynamics class handles I/O for the dynamics.txt file of an aKMC simulation.
Initialization
- class eon.fileio.Table(filename, columns=None, overwrite=False)[source]#
A class that provides a nice io abstraction for table like data. The data is saved in a pretty printed format. Also provides nice data retrival methods.
t = Table(“sample.tbl”, [‘id’, ‘name’, ‘age’ ]) t.eagerwrite = False t.add_row({‘id’:0,’name’:”Sam”,”age”:24}) t.add_row({‘id’:1,’name’:”David”,”age”:50}) t.add_row({‘id’:2,’name’:”Anna”,”age”:21}) t #doctest: +NORMALIZE_WHITESPACE id name age
-- ----- --- 0 Sam 24 1 David 50 2 Anna 21
Rows can be accessed directly:
t.rows[1] #doctest: +SKIP {‘age’: 50, ‘id’: 1, ‘name’: ‘David’} t.max_value(‘age’) #doctest: +NORMALIZE_WHITESPACE 50 t.min_row(‘age’) #doctest: +NORMALIZE_WHITESPACE +SKIP {‘age’: 21, ‘id’: 2, ‘name’: ‘Anna’} sorted(t.min_row(‘id’).items()) #doctest: +NORMALIZE_WHITESPACE [(‘age’, 24), (‘id’, 0), (‘name’, ‘Sam’)] len(t) #doctest: +NORMALIZE_WHITESPACE 3 sum(t.getcolumn(‘age’)) #doctest: +NORMALIZE_WHITESPACE 95 t.write() #doctest: +SKIP
The table can be loaded from disk without specifying columns. This is slightly unsafe because the columns can’t be checked, but it could cut down on the verbosity in some places.
t2 = Table(“sample.tbl”) #doctest: +SKIP
Initialization