scipp.geomspace#

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

Constructs a Variable with values spaced evenly on a log scale (a geometric progression).

This is similar to scipp.logspace(), but with endpoints specified directly instead of as exponents. Each output sample is a constant multiple of the previous.

Parameters:
  • dim (str) – Dimension label.

  • start (NumberOrVar) – The starting value of the sequence.

  • stop (NumberOrVar) – The end value of the sequence.

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

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

  • unit (Unit | str | DefaultUnit | 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.geomspace('x', 1.0, 1000.0, num=4)
<scipp.Variable> (x: 4)    float64  [dimensionless]  [1, 10, 100, 1000]
>>> sc.geomspace('x', 1.0, 1000.0, num=4, endpoint=False)
<scipp.Variable> (x: 4)    float64  [dimensionless]  [1, 5.62341, 31.6228, 177.828]
>>> sc.geomspace('x', 1.0, 100.0, num=3, unit='s')
<scipp.Variable> (x: 3)    float64              [s]  [1, 10, 100]