Tools

class tools.Grid(i, j)[source]

Supporting class for the plot_atoms function.

put(c, i, j, depth=1000000000.0)[source]
tools.ascii_atoms(atoms)[source]

Blatantly stolen from GPAW. Ascii-art plot of the atoms.

tools.find_db_rows(db, **kwargs)[source]

Find all row of a database containing one or more kwargs.

Parameters:db (ASE database object (sqlite or json)) –
Returns:A list of ASE db row object matching the conditions.
Return type:list
tools.find_file(name, first=True, follow_symlinks=False, name_type='f')[source]

Locate name using call to bash find.

tools.find_runs(path)[source]
tools.getstatusoutput(*args, **kwargs)[source]

Helper function to replace the old commands.getstatusoutput.

Returns the returncode, stdout and sterr associated with the command.

getstatusoutput([command], stdin=subprocess.PIPE)

tools.handler(signum, frame)[source]

Signal handler for timed find_file.

tools.read_configuration(fname)[source]
tools.read_db(directory)[source]

Read the persistent data from a storq.db

Parameters:directory (str) – Path (relative or absolute) to the calculation directory.
Returns:data – Dictionary containing all the persistent data from storq.db
Return type:dict
tools.tail(fname)[source]

Quick way to read the last line of a file.

tools.timed_find_file(name, first=True, follow_symlinks=False, name_type='f')[source]

Timed version of find.

tools.timeit()[source]

Context manager for timing a piece of code.

tools.write_configuration(fname, config)[source]