pydmqmc.report_registry.enroll
- report_registry.enroll(name, function, requires)
Include a new analysis function in the registry.
- Parameters:
- namestr
Name by which to identify the function.
- functionfunction
Function for performing the analysis. Must take a Method object as its first argument.
- requiresstring, list of strings or None
List of prerequisites required by the analysis function. These should be attributes of a Method or System object. Can be formatted as, e.g., “method.system.hamiltonian” or just “hamiltonian”. In the latter case, the Method and its System will be searched for an attribute called hamiltonian.
Examples
Assuming the existance of a user defined function called my_func that operates on a matrix in conjunction with a System’s hamiltonian, we can enroll it into the global registry under the name “my_analysis” as below: >>> def my_func(matrix: NDArray, hamiltonian: NDArray): … return np.norm(hamiltonian @ matrix) >>> my_reg.enroll(“my_analysis”, my_func, [“hamiltonian”])