file_handler

Functions for file input/output handling

This module can be called from mdtools via the shortcut fh:

import mdtools as mdt
mdt.fh  # instead of mdt.file_handler

Functions

backup

Backup a file by renaming it.

cd_up

Move n steps upwards in the directory tree.

header_str

Create a standard header string for text files.

indent

Indent a text by a given amount.

load_dtrj

Load a discrete trajectory from file.

save_dtrj

Save a discrete trajectory to file.

savetxt

Save an array to a text file.

savetxt_matrix

Save a data matrix to a text file.

str2bool

Convert a string to a boolean value.

str2none_or_type

Convert a string to the NoneType None or to a given type.

tail

Read the last n lines from a file.

write_header

Write the standard MDTools header to file.

write_matrix_block

Save a data matrix as block to a text file.

xopen

Open a (compressed) file and return a corresponding file-like object.