[AstroPy] numpy.arange and quantities

Ole Streicher astropy at liska.ath.cx
Tue Nov 29 03:39:03 EST 2016


Hi,

how can I create a sequence of quantities, when start, end, and step are
given?

The simplest approach doesn't work (astropy 1.2.1):

>>> import numpy
>>> import astropy.units as u
>>> z0 = 0
>>> z1 = 9 * u.km
>>> dz = 100 * u.m
>>> r = numpy.arange(z0, z1, dz)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ValueError: setting an array element with a sequence.

Best regards

Ole



More information about the AstroPy mailing list