triqs.operators.util.observables.check_backward_compat
- triqs.operators.util.observables.check_backward_compat(fname, n_orb, orb_names)[source]
Validate and normalize the orbital count for backward compatibility.
Raises if the removed
orb_namesargument is supplied, and converts a list passed in place ofn_orbinto its length while emitting aUserWarning.- Parameters:
- fnamestr
Name of the calling function, used in the warning message.
- n_orbint or list
Number of orbitals. A list is accepted for backward compatibility and replaced by its length.
- orb_namesobject
Removed argument retained for error reporting. Must be
None; otherwise aRuntimeErroris raised.
- Returns:
- int
The (normalized) number of orbitals.
Examples
>>> check_backward_compat('N_op', 5, None) 5 >>> check_backward_compat('N_op', ['s', 'p_x', 'p_y'], None) 3