get_compressed_file

gmx.get_compressed_file(fname)[source]

Check if the input file or a compressed version of it exsists.

Check if the input file exsists. If it does not exist, check whether a file with the same name but with one of the following extensions exsists:

  1. .gz

  2. .bz2

  3. .xz

  4. .lzma

Files are checked in the given order. The name of the first file found will be returned. If none of the files exsists, an exception is raised.

Parameters:

fname (str or bytes or os.PathLike) – Name of the input file.

Returns:

found_file (str or bytes) – Name of the first file found.

Raises:

FileNotFoundError : – If neither the input file itself nor the input file with one of the above mentioned extensions exists.