I/O Read: From Path#
A convenience function to create readers that take a path instead of a stream.
Example
>>> from tad_mctc.io import read
>>> read_xyz = read.create_path_reader(read.read_xyz_fileobj)
>>> path = ...
>>> numbers, positions = read_xyz(path)
- tad_mctc.io.read.frompath.create_path_reader(reader_function)[source]#
Creates a function that reads data from a specified file path using a given reader function.
- Parameters:
reader_function (ReaderFunction) – The function used to read and process the file contents.
- Returns:
A function that takes a file path, mode, device, and dtype, and returns the processed data.
- Return type:
FileReaderFunction
- tad_mctc.io.read.frompath.create_path_reader_dotfiles(reader_function, name)[source]#
Creates a function that reads data from a specified file path using a given reader function.
- Parameters:
reader_function (ReaderFunction) – The function used to read and process the file contents.
name (Literal[“.CHRG”, “.UHF”]) – Name of the dotfile to be read.
- Returns:
A function that takes a file path, mode, device, and dtype, and returns the processed data.
- Return type:
FileReaderFunction