volumential.tools#
Miscellaneous host-side utilities, plus the historical grab-bag import surface.
This module owns two small host-side helpers, clean_file() and
import_code(). Everything else it used to define now lives in a focused
module and is re-exported here unchanged, so that from volumential.tools
import ... keeps working:
ScalarFieldExpressionEvaluation–volumential.expression_evalBoxSpecificMap,DiscreteLegendreTransform,InverseDiscreteLegendreTransform,BoxSpecificReduction,BoxSumandgenerate_leading_order_filtering()–volumential.box_operators
- volumential.tools.clean_file(filename, new_name=None) None[source]#
Remove/rename file if exists. Fails silently when the file does not exist. Useful for, for example, writing output files that are meant to overwrite existing ones.
- volumential.tools.import_code(code, name, add_to_sys_modules=True) ModuleType[source]#
Dynamically generates a module.
- Parameters:
code – a string or a compiled code object, as accepted by
exec().name – the name the new module is given.
add_to_sys_modules – whether to register the module in
sys.modulesunder name.
- Returns:
a new module object initialized by dynamically importing code.