mpylab.tools.spacing module

This is mpylab.tools.spacing: routines returning sequences aka range

author:

Hans Georg Krauthäuser (main author)

license:

GPL-3 or higher

class mpylab.tools.spacing.LinSpace(start=80000000.0, stop=1000000000.0, step=1000000.0, endpoint=True)

Bases: object

Iterable linear spacing helper.

class mpylab.tools.spacing.LogSpace(start=80000000.0, stop=1000000000.0, step=1.01, endpoint=True)

Bases: object

Iterable logarithmic spacing helper.

step is interpreted as multiplicative factor. If endpoint is true, stop is yielded after the last generated value when it was not reached exactly.

mpylab.tools.spacing.frange(limit1, limit2=None, increment=1.0)

Range function that accepts floats (and integers).

Usage:

frange(-2, 2, 0.1)
frange(10)
frange(10, increment = 0.5)

The returned value is a generator. Use list(frange) for a list.

mpylab.tools.spacing.idxset(n, m)

returns a list of length n with equidistant elem of range(m)

mpylab.tools.spacing.linspace(start, stop, step, endpoint=0, precision=2)

Evenly spaced samples on a linear scale.

Return evenly spaced samples from start to stop. If endpoint=1 then last sample is stop and step is adjusted.

mpylab.tools.spacing.linspaceN(start, stop, number, endpoint=0, precision=2)

Evenly spaced samples on a linear scale.

Return number evenly spaced samples from start to stop. If endpoint=1 then last sample is stop and number is adjusted.

mpylab.tools.spacing.logspace(start, stop, factor=1.01, endpoint=0, precision=2)

Evenly spaced samples on a logarithmic scale.

Returns evenly spaced samples from start to stop. If endpoint=1 then last sample is stop and factor is adjusted.

mpylab.tools.spacing.logspaceN(start, stop, number, endpoint=0, precision=2)

Evenly spaced samples on a logarithmic scale.

Return number evenly spaced samples from start to stop. If endpoint=1 then last sample is stop and factor is adjusted.

mpylab.tools.spacing.logspaceTab(start, end, ftab=None, nftab=None, endpoint=True)

logspaceTab function.