Open tmancal74 opened 1 year ago
The most elegant solution would be to implement decorators which decorate the functions for which the presence of context should be enforced (or prevented). The decorated function will detect the present of the context and through an exception if the context policy is breached.
Simple detection of eigenbasis_of context is implemented. Wrappers prevent_basis_context and enforce_basis_context are available and working.
The new wrapper is not yet applied to anything as its presence will likely break several existing automated tests.
Wrappers now successfully applied to CorrelationFunction. This object has to be created under the energy_units context.
It is desirable not to allow functions that set physical values to be used outside the units context (energy_units etc.). These functions should raise an Exception if used without the context. Similarly, some functions should not be used inside the eigenbasis_of context. Again, an Exception should be raised if this context is applied on the function.