aerosandbox.numpy.spacing#

Module Contents#

Functions#

linspace([start, stop, num])

Returns evenly spaced numbers over a specified interval.

cosspace([start, stop, num])

Makes a cosine-spaced vector.

sinspace([start, stop, num, reverse_spacing])

Makes a sine-spaced vector. By default, bunches points near the start.

logspace([start, stop, num])

Return numbers spaced evenly on a log scale.

geomspace([start, stop, num])

Return numbers spaced evenly on a log scale (a geometric progression).

aerosandbox.numpy.spacing.linspace(start=0.0, stop=1.0, num=50)[source]#

Returns evenly spaced numbers over a specified interval.

See syntax here: https://numpy.org/doc/stable/reference/generated/numpy.linspace.html

Parameters:
  • start (float) –

  • stop (float) –

  • num (int) –

aerosandbox.numpy.spacing.cosspace(start=0.0, stop=1.0, num=50)[source]#

Makes a cosine-spaced vector.

Cosine spacing is useful because these correspond to Chebyshev nodes: https://en.wikipedia.org/wiki/Chebyshev_nodes

To learn more about cosine spacing, see this: https://youtu.be/VSvsVgGbN7I

Parameters:
  • start (float) – Value to start at.

  • end – Value to end at.

  • num (int) – Number of points in the vector.

  • stop (float) –

aerosandbox.numpy.spacing.sinspace(start=0.0, stop=1.0, num=50, reverse_spacing=False)[source]#

Makes a sine-spaced vector. By default, bunches points near the start.

Sine spacing is exactly identical to half of a cosine-spaced distrubution, in terms of relative separations.

To learn more about sine spacing and cosine spacing, see this: https://youtu.be/VSvsVgGbN7I

Parameters:
  • start (float) – Value to start at.

  • end – Value to end at.

  • num (int) – Number of points in the vector.

  • reverse_spacing (bool) – Does negative-sine spacing. In other words, if this is True, the points will be bunched near

  • start. (the stop rather than at the) –

  • stop (float) –

Points are bunched up near the start of the interval by default. To reverse this, use the reverse_spacing parameter.

aerosandbox.numpy.spacing.logspace(start=0.0, stop=1.0, num=50)[source]#

Return numbers spaced evenly on a log scale.

See syntax here: https://numpy.org/doc/stable/reference/generated/numpy.logspace.html

Parameters:
  • start (float) –

  • stop (float) –

  • num (int) –

aerosandbox.numpy.spacing.geomspace(start=1.0, stop=10.0, num=50)[source]#

Return numbers spaced evenly on a log scale (a geometric progression).

This is similar to logspace, but with endpoints specified directly.

See syntax here: https://numpy.org/doc/stable/reference/generated/numpy.geomspace.html

Parameters:
  • start (float) –

  • stop (float) –

  • num (int) –