Skip to content

Add functools.scaled

Tobias Hangleiter requested to merge tobias/scaled into master

Adds scaled decorator/wrapper that performs a linear transformation on the function result.

For example:

from qutil import const, functools

fig, ax = plt.subplots()
xax2 = ax.secondary_xaxis('top', functions=(functools.scaled(1e+9)(const.lambda2eV),
                                            functools.scaled(1e-9)(const.eV2lambda))
xax2.set_xlabel('eV')
ax.set_xlabel('nm')

Merge request reports