psweep.psweep.logspace#
- psweep.psweep.logspace(start, stop, num=50, offset=0, log_func=<ufunc 'log10'>, **kwds)[source]#
Like
numpy.logspacebutstart and stop are not exponents but the actual bounds
tuneable log scale strength
Control the strength of the log scale by offset, where we use by default
log_func=np.log10andbase=10and returnnp.logspace(np.log10(start + offset), np.log10(stop + offset)) - offset. offset=0 is equal tonp.logspace(np.log10(start), np.log10(stop)). Higher offset values result in more evenly spaced points.- Parameters:
start – same as in
np.logspacestop – same as in
np.logspacenum – same as in
np.logspace**kwds – same as in
np.logspaceoffset – Control strength of log scale.
log_func (
Callable) – Must match base (pass that as part of **kwds). Default isbase=10as innp.logspaceand solog_func=np.log10. If you want a different base, also provide a matching log_func, e.g.base=e, log_func=np.log.
Examples
Effect of different offset values:
>>> from matplotlib import pyplot as plt >>> from psweep import logspace >>> import numpy as np >>> for ii, offset in enumerate([1e-16,1e-3, 1,2,3]): ... x=logspace(0, 2, 20, offset=offset) ... plt.plot(x, np.ones_like(x)*ii, "o-", label=f"{offset=}") >>> plt.legend()