<div dir="ltr">There is a sympy atoms method.  If x and y are symbols, then:<div><br></div><div><br><div><div>> a = x*y</div></div><div><div>> print a.atoms(sympy.Symbol)</div><div>set([x, y])</div></div></div><div><br></div><div>I suspect that this would work with the units defined in yt.  There is probably a way to get powers too.</div><div><br></div><div><br></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Tue, Sep 30, 2014 at 10:38 AM, John ZuHone <span dir="ltr"><<a href="mailto:jzuhone@gmail.com" target="_blank">jzuhone@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">This should be obvious to me, but I can't seem to figure it out.<br>
<br>
Is there a way to take a compound units expression like:<br>
<br>
dyne*cm**2/g**2<br>
<br>
and split it into its constituent parts, so that I have a list like this:<br>
<br>
[dyne, cm, g]<br>
<br>
and maybe even containing the information about the powers?<br>
_______________________________________________<br>
yt-dev mailing list<br>
<a href="mailto:yt-dev@lists.spacepope.org">yt-dev@lists.spacepope.org</a><br>
<a href="http://lists.spacepope.org/listinfo.cgi/yt-dev-spacepope.org" target="_blank">http://lists.spacepope.org/listinfo.cgi/yt-dev-spacepope.org</a><br>
</blockquote></div><br><br clear="all"><div><br></div>-- <br><div>Michael Zingale</div><div>Associate Professor</div><div><br></div><div>Dept. of Physics & Astronomy • Stony Brook University • Stony Brook, NY 11794-3800</div><div><i>phone</i>:  631-632-8225</div><div><i>e-mail</i>: <a href="mailto:Michael.Zingale@stonybrook.edu" target="_blank">Michael.Zingale@stonybrook.edu</a></div><div><i>web</i>: <a href="http://www.astro.sunysb.edu/mzingale" target="_blank">http://www.astro.sunysb.edu/mzingale</a></div>
</div>