opan.utils.decorate

Custom decorators defined for Open Anharmonic.

Decorators

class opan.utils.decorate.arraysqueeze(*args)

Converts selected arguments to squeezed np.arrays

Pre-applies an np.array(...).squeeze() conversion to all positional arguments according to integer indices passed, and to any keyword arguments according to any strings passed.

Each int argument passed instructs the decorator to convert the corresponding positional argument in the function definition.

Each str argument passed instructs the decorator to convert the corresponding keyword argument.

str parameters corresponding to keyword arguments absent in a particular function call and positional/optional argument indices beyond the range of the actual *args of the decorated function are ignored.

Warning

Likely fragile with optional arguments; needs to be tested.

Parameters:*args (int or str) – Arguments to convert to squeezed np.array.