Hi Libby,<br><br>You could also try getting the NumberOfParticles parameter from the parameter file with:<br>pf.get_parameter('NumberOfParticles',type=int)<br><br>Britton<br><br><div class="gmail_quote">On Fri, Apr 16, 2010 at 10:04 AM, Elizabeth Harper-Clark <span dir="ltr"><<a href="mailto:h-clark@astro.utoronto.ca">h-clark@astro.utoronto.ca</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">Hi guys,<br><br>I sometimes have particles in my sims and when i do I want to plot them. At the moment I have:<br>
        if sp["ParticleMassMsun"].size > 0:<br>            p.modify["particles"](1.0, p_size=10.0, col='k')<br>
<br clear="all">but if there are no particles I get this error message:<br><br>yt         INFO       2010-04-16 11:58:29,408 Getting ParticleMassMsun using ParticleIO<br>Traceback (most recent call last):<br>  File "Density_movie.py", line 29, in <module><br>

    if sp["ParticleMassMsun"].size > 0:<br>  File "/scratch/YT-x86_64/lib/python2.5/site-packages/yt-2.0dev-py2.5-linux-x86_64.egg/yt/lagos/BaseDataTypes.py", line 249, in __getitem__<br>    self.get_data(key)<br>

  File "/scratch/YT-x86_64/lib/python2.5/site-packages/yt-2.0dev-py2.5-linux-x86_64.egg/yt/lagos/BaseDataTypes.py", line 1636, in get_data<br>    self[field] = self.particles[field]<br>  File "/scratch/YT-x86_64/lib/python2.5/site-packages/yt-2.0dev-py2.5-linux-x86_64.egg/yt/lagos/ParticleIO.py", line 45, in __getitem__<br>

    return self.get_data(key)<br>  File "/scratch/YT-x86_64/lib/python2.5/site-packages/yt-2.0dev-py2.5-linux-x86_64.egg/yt/lagos/ParticleIO.py", line 91, in get_data<br>    conv_factors)<br>  File "/scratch/YT-x86_64/lib/python2.5/site-packages/yt-2.0dev-py2.5-linux-x86_64.egg/yt/lagos/DataReadingFuncs.py", line 206, in _read_particles<br>

    filenames, ids, conv_factors = zip(*sorted(zip(filenames, ids, conv_factors)))<br>ValueError: need more than 0 values to unpack<br><br><br>Can anyone think of a better if statement to check if i have particles that doesn't crash YT if there isn't?<br>

<br>Many thanks,<br><br>Libby<br><br><br><br>-- <br>Elizabeth Harper-Clark MA MSci<br>PhD Candidate, Astrophysics, UofT<br><br><a href="http://www.astro.utoronto.ca/%7Eh-clark" target="_blank">www.astro.utoronto.ca/~h-clark</a><br>
<a href="mailto:h-clark@cita.utoronto.ca" target="_blank">h-clark@cita.utoronto.ca</a><br>
AIM: edphc1<br>MSN: <a href="mailto:edphc1@hotmail.com" target="_blank">edphc1@hotmail.com</a><br>Skype: eharperclark<br>Office phone: 416-978-5759<br>
<br>_______________________________________________<br>
yt-users mailing list<br>
<a href="mailto:yt-users@lists.spacepope.org">yt-users@lists.spacepope.org</a><br>
<a href="http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org" target="_blank">http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org</a><br>
<br></blockquote></div><br>