quvac.utils¶
Useful generic utilities.
Functions¶
|
Read a YAML file and return its contents. |
|
Write data to a YAML file. |
|
Format time in seconds to a human-readable string. |
|
Format memory in kilobytes to a human-readable string. |
|
Save FFTW wisdom to a file. |
|
Load FFTW wisdom from a file. |
Get the maximum resident set size used (in kilobytes). |
|
|
Zip a directory using shutil. |
|
Find all class names in a given package. |
|
Module Contents¶
- quvac.utils.read_yaml(yaml_file)[source]¶
Read a YAML file and return its contents.
- Parameters:
yaml_file (str) – Path to the YAML file.
- Returns:
Contents of the YAML file.
- Return type:
dict
- quvac.utils.write_yaml(yaml_file, data)[source]¶
Write data to a YAML file.
- Parameters:
yaml_file (str) – Path to the YAML file.
data (dict) – Data to write to the YAML file.
- quvac.utils.format_time(seconds)[source]¶
Format time in seconds to a human-readable string.
- Parameters:
seconds (float) – Time in seconds.
- Returns:
Formatted time string.
- Return type:
str
- quvac.utils.format_memory(mem)[source]¶
Format memory in kilobytes to a human-readable string.
- Parameters:
mem (float) – Memory in kilobytes.
- Returns:
Formatted memory string.
- Return type:
str
- quvac.utils.save_wisdom(ini_file, wisdom_file=None, add_host_name=False)[source]¶
Save FFTW wisdom to a file.
- Parameters:
ini_file (str) – Path to the initialization file.
wisdom_file (str, optional) – Path to save the FFTW wisdom, by default None.
add_host_name (bool, optional) – Whether to add the host name to the wisdom file name, by default False.
- quvac.utils.load_wisdom(wisdom_file)[source]¶
Load FFTW wisdom from a file.
- Parameters:
wisdom_file (str) – Path to the FFTW wisdom file.
- Returns:
FFTW wisdom.
- Return type:
tuple
- quvac.utils.get_maxrss()[source]¶
Get the maximum resident set size used (in kilobytes).
- Returns:
Maximum resident set size used.
- Return type:
int
- quvac.utils.zip_directory_shutil(directory_path, output_path)[source]¶
Zip a directory using shutil.
- Parameters:
directory_path (str) – Path to the directory to zip.
output_path (str) – Path to save the zipped directory.