[AstroPy] Vector Quantities in QTable
Jeffrey Brent McBeth
mcbeth at broggs.org
Mon May 15 15:03:04 EDT 2017
On Mon, May 15, 2017 at 02:18:23PM -0400, Aldcroft, Thomas wrote:
> Hi Jeffrey,
> Sorry for the delay, I finally had a chance to dig into this.
> Congratulations, you have found a real bug
> ([1]https://github.com/astropy/astropy/issues/6072). There is no bounty
> but we should be able to fix this for next bug-fix release. Unfortunately
> I can't think of an easy workaround apart from assembling the table as a
> Table and then converting to QTable at the end.
> >>> foo = Table(names=('state1','mass'),dtype=('(3,)f8','f8'))
> >>> foo['state1'].unit = u.K
> >>> foo['mass'].unit = [2]u.mg
> >>> s0 = [235,240,245]*u.K
> >>> m0 = 5*u.g
> >>> foo.add_row(([3]s0.to(u.K), [4]m0.to([5]u.mg)))
> >>> foo = QTable(foo, copy=False)
> >>> foo
> <QTable length=1>
> state1 [3] mass
> K mg
> float64 float64
> -------------- -------
> 235.0 .. 245.0 5000.0
Thank you for getting back to me. I'm glad to hear that it isn't just me being crazy. I'll follow the development with bated breath.
Jeff
--
"The man who does not read good books has no advantage over
the man who cannot read them."
-- not Mark Twain, maybe a southen librarian in 1910
More information about the AstroPy
mailing list