Python Utilities
Miscellaneous utility functions used throughout the dragonfly package.
Miscellaneous utility functions called by one or more python modules
- class dragonfly.utils.py_src.py_utils.MyTimer[source]
Bases:
objectClass to report elapsed time for logging.
- dragonfly.utils.py_src.py_utils.write_density(in_den_file, in_den, binary=True)[source]
Write density volume to file.
- Parameters:
in_den_file (str) – Output file path.
in_den (
numpy.ndarray) – 3D density array.binary (bool) – Write binary if True, text if False.
- dragonfly.utils.py_src.py_utils.read_density(in_den_file)[source]
Read density volume from binary file.
- Parameters:
in_den_file (str) – Input file path.
- Returns:
3D density array.
- Return type:
- dragonfly.utils.py_src.py_utils.check_to_overwrite(fname)[source]
Check if file exists and prompt before overwriting.
By default, the file is overwritten.
- dragonfly.utils.py_src.py_utils.confirm_oversampling(ratio)[source]
Print message if oversampling ratio is too high and prompt for continuation.