Io
Handle IO of auxillary data.
load_data(subpex_config, data_dir=None)
¶
Populate subpex_config auxillary data with the last value found in data_dir.
Calls
| PARAMETER | DESCRIPTION |
|---|---|
subpex_config |
The Subpex configuration.
TYPE:
|
data_dir |
Directory to search for auxillary data files. If
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
SubpexConfig
|
The updated SubpexConfig object with the last value of data found appended to |
SubpexConfig
|
the respective auxiliary data. |
write_data(subpex_config, data_dir=None)
¶
Writes activated auxiliary data from the subpex_config to files in the
specified directory.
This function iterates through the active auxiliary data in the provided
subpex_config and writes them to files in the data_dir. The format of the output
files is determined by their extensions:
.xyzand.pdb: The data is expected to be a field of points and is written using thewrite_fopfunction..txt: The data is written as plain text. If the data consists of floats, each value is written on a new line. If the data is iterable (e.g., a list of lists), each sublist is written on a new line, with values formatted to four decimal places and separated by spaces.
| PARAMETER | DESCRIPTION |
|---|---|
subpex_config |
The Subpex configuration object containing auxiliary data to be written to files.
TYPE:
|
data_dir |
The directory where the data files will be written. If
TYPE:
|
Warning
- If the file extension is not supported (
.xyz,.pdb, or.txt), the function logs a warning and skips writing the data. - If the data type does not match the expected format for a given file extension, the function logs a warning and skips writing the data.
- If the data type is not accounted for, the function logs a warning and skips writing the data.