scipp.logspace#

scipp.logspace(dim, start, stop, num, *, endpoint=True, base=10.0, unit=<automatically deduced unit>, dtype=None)#

Constructs a Variable with values spaced evenly on a log scale.

This is similar to scipp.geomspace(), but with endpoints specified as exponents.

Parameters
  • dim (str) – Dimension label.

  • start (TypeVar(NumberOrVar, Union[int, float], Variable)) – The starting value of the sequence.

  • stop (TypeVar(NumberOrVar, Union[int, float], Variable)) – The end value of the sequence.

  • num (int) – Number of samples to generate.

  • base (Union[int, float], default: 10.0) – The base of the log space.

  • endpoint (bool, default: True) – If True, step is the last returned value. Otherwise, it is not included.

  • unit (Union[Unit, str, None], default: <automatically deduced unit>) – Unit of contents.

  • dtype (scipp.typing.DTypeLike) – Type of underlying data. By default, inferred from value argument.

Returns

Variable – A variable of evenly spaced values on a logscale.

Examples

>>> sc.logspace('x', 1, 4, num=4)
<scipp.Variable> (x: 4)    float64  [dimensionless]  [10, 100, 1000, 10000]
>>> sc.logspace('x', 1, 4, num=4, endpoint=False)
<scipp.Variable> (x: 4)    float64  [dimensionless]  [10, 56.2341, 316.228, 1778.28]

Set a different base:

>>> sc.logspace('x', 1, 4, num=4, base=2)
<scipp.Variable> (x: 4)    float64  [dimensionless]  [2, 4, 8, 16]

Set a unit:

>>> sc.logspace('x', 1, 3, num=3, unit='m')
<scipp.Variable> (x: 3)    float64              [m]  [10, 100, 1000]