There is a sympy atoms method.  If x and y are symbols, then:


> a = x*y
> print a.atoms(sympy.Symbol)
set([x, y])

I suspect that this would work with the units defined in yt.  There is probably a way to get powers too.



On Tue, Sep 30, 2014 at 10:38 AM, John ZuHone <jzuhone@gmail.com> wrote:
This should be obvious to me, but I can't seem to figure it out.

Is there a way to take a compound units expression like:

dyne*cm**2/g**2

and split it into its constituent parts, so that I have a list like this:

[dyne, cm, g]

and maybe even containing the information about the powers?
_______________________________________________
yt-dev mailing list
yt-dev@lists.spacepope.org
http://lists.spacepope.org/listinfo.cgi/yt-dev-spacepope.org



--
Michael Zingale
Associate Professor

Dept. of Physics & Astronomy • Stony Brook University • Stony Brook, NY 11794-3800
phone:  631-632-8225
e-mail: Michael.Zingale@stonybrook.edu
web: http://www.astro.sunysb.edu/mzingale