<html><head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class="">The reason why this would not work in previous yt versions is that annotate_particles assumed code units for length, which for flash are centimeters. So “4" would be 4 cm, a ridiculously thin slab, which would explain why you end up with a zero selection. <div class=""><br class=""></div><div class="">It should work now, based on looking at the code, so if it doesn’t then we definitely have a bug. </div><div class=""><br class=""><div><blockquote type="cite" class=""><div class="">On Apr 28, 2015, at 3:37 PM, Nathan Goldbaum <<a href="mailto:nathan12343@gmail.com" class="">nathan12343@gmail.com</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><div dir="ltr" style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><div class="gmail_extra"><br class="Apple-interchange-newline"><br class=""><div class="gmail_quote">On Tue, Apr 28, 2015 at 12:27 PM, Jason Galyardt<span class="Apple-converted-space"> </span><span dir="ltr" class=""><<a href="mailto:jason.galyardt@gmail.com" target="_blank" class="">jason.galyardt@gmail.com</a>></span><span class="Apple-converted-space"> </span>wrote:<br class=""><blockquote class="gmail_quote" style="margin: 0px 0px 0px 0.8ex; border-left-width: 1px; border-left-color: rgb(204, 204, 204); border-left-style: solid; padding-left: 1ex;"><div dir="ltr" class=""><div class=""><div class=""><div class="">Hi all,<br class=""><br class=""></div>I've updated to the latest development release of yt (v3.2dev). I no longer get the ValueError to do with zero length selections when I do annotate_particles(). However, I don't get any particles in the plot either. Any other ideas?<br class=""></div></div></div></blockquote><div class=""><br class=""></div><div class="">Can you try:<br class=""></div><div class=""><br class=""></div><div class="">p.annotate_particles((4, 'kpc'))</div><div class=""><br class=""></div><div class="">?</div><div class=""><br class=""></div><div class="">If that works, can you file a bug about annotate_particles not handling widths that are YTQuantity instances correctly?</div><div class=""><br class=""></div><div class=""><a href="https://bitbucket.org/yt_analysis/yt/issues/new" class="">https://bitbucket.org/yt_analysis/yt/issues/new</a><br class=""></div><div class=""> </div><blockquote class="gmail_quote" style="margin: 0px 0px 0px 0.8ex; border-left-width: 1px; border-left-color: rgb(204, 204, 204); border-left-style: solid; padding-left: 1ex;"><div dir="ltr" class=""><div class=""><div class=""><br class=""></div>Thanks,<br class=""></div>Jason<br class=""></div><div class=""><div class="h5"><div class="gmail_extra"><br class=""><div class="gmail_quote">On Tue, Apr 28, 2015 at 2:56 PM, Yuan Li<span class="Apple-converted-space"> </span><span dir="ltr" class=""><<a href="mailto:bear0980@gmail.com" target="_blank" class="">bear0980@gmail.com</a>></span><span class="Apple-converted-space"> </span>wrote:<br class=""><blockquote class="gmail_quote" style="margin: 0px 0px 0px 0.8ex; border-left-width: 1px; border-left-color: rgb(204, 204, 204); border-left-style: solid; padding-left: 1ex;"><div dir="ltr" class="">Hi Jason,<div class=""><br class=""></div><div class="">I had trouble with Flash particles last year, and John ZuHone fixed the bug. Could you try the newest yt3 and see if the problem goes away?</div><span class=""><font color="#888888" class=""><div class=""><br class=""></div><div class="">Yuan</div></font></span></div><div class=""><div class=""><div class="gmail_extra"><br class=""><div class="gmail_quote">On Tue, Apr 28, 2015 at 2:53 PM, Jason Galyardt<span class="Apple-converted-space"> </span><span dir="ltr" class=""><<a href="mailto:jason.galyardt@gmail.com" target="_blank" class="">jason.galyardt@gmail.com</a>></span><span class="Apple-converted-space"> </span>wrote:<br class=""><blockquote class="gmail_quote" style="margin: 0px 0px 0px 0.8ex; border-left-width: 1px; border-left-color: rgb(204, 204, 204); border-left-style: solid; padding-left: 1ex;"><div dir="ltr" class=""><div class=""><div class=""><div class="">Nathan,<br class=""><br class=""></div>I'm using yt version 3.0.2 (which I see is not quite current) on Debian 7 (wheezy). I tried to pastebin the iPython error traceback, but it failed with a complaint that the MySQL server has 'gone away'. With apologies to the list, here's the traceback:<br class=""><br class="">---------------------------------------------------------------------------<br class="">ValueError                                Traceback (most recent call last)<br class=""><ipython-input-49-3f118016da60> in <module>()<br class="">----> 1 p.annotate_particles((4.0,'kpc'))<br class=""><br class="">/usr/local/lib/python2.7/dist-packages/yt/visualization/plot_container.pyc in newfunc(*args, **kwargs)<br class="">    <span class="Apple-converted-space"> </span>68         rv = f(*args, **kwargs)<br class="">    <span class="Apple-converted-space"> </span>69         args[0]._plot_valid = False<br class="">---> 70         args[0]._setup_plots()<br class="">    <span class="Apple-converted-space"> </span>71         return rv<br class="">    <span class="Apple-converted-space"> </span>72     return newfunc<br class=""><br class="">/usr/local/lib/python2.7/dist-packages/yt/visualization/plot_window.pyc in _setup_plots(self)<br class="">   <span class="Apple-converted-space"> </span>860                 label.set_fontproperties(fp)<br class="">   <span class="Apple-converted-space"> </span>861<span class="Apple-converted-space"> </span><br class="">--> 862             self.run_callbacks(f)<br class="">   <span class="Apple-converted-space"> </span>863<span class="Apple-converted-space"> </span><br class="">   <span class="Apple-converted-space"> </span>864             if draw_axes is False:<br class=""><br class="">/usr/local/lib/python2.7/dist-packages/yt/visualization/plot_container.pyc in run_callbacks(self, f)<br class="">   <span class="Apple-converted-space"> </span>313             CallbackMaker = callback_registry[name]<br class="">   <span class="Apple-converted-space"> </span>314             callback = CallbackMaker(*args[1:], **kwargs)<br class="">--> 315             callback(cbw)<br class="">   <span class="Apple-converted-space"> </span>316         for key in self.frb.keys():<br class="">   <span class="Apple-converted-space"> </span>317             if key not in keys:<br class=""><br class="">/usr/local/lib/python2.7/dist-packages/yt/visualization/plot_modifications.pyc in __call__(self, plot)<br class="">  <span class="Apple-converted-space"> </span>1053         pt = self.ptype<br class="">  <span class="Apple-converted-space"> </span>1054         gg = ( ( reg[pt, field_x] >= x0 ) & ( reg[pt, field_x] <= x1 )<br class="">-> 1055            &   ( reg[pt, field_y] >= y0 ) & ( reg[pt, field_y] <= y1 ) )<br class="">  <span class="Apple-converted-space"> </span>1056         if self.minimum_mass is not None:<br class="">  <span class="Apple-converted-space"> </span>1057             gg &= (reg[pt, "particle_mass"] >= self.minimum_mass)<br class=""><br class="">/usr/local/lib/python2.7/dist-packages/yt/data_objects/data_containers.pyc in __getitem__(self, key)<br class="">   <span class="Apple-converted-space"> </span>238                 return self.field_data[f]<br class="">   <span class="Apple-converted-space"> </span>239             else:<br class="">--> 240                 self.get_data(f)<br class="">   <span class="Apple-converted-space"> </span>241         # fi.units is the unit expression string. We depend on the registry<br class="">   <span class="Apple-converted-space"> </span>242         # hanging off the dataset to define this unit object.<br class=""><br class="">/usr/local/lib/python2.7/dist-packages/yt/data_objects/data_containers.pyc in get_data(self, fields)<br class="">   <span class="Apple-converted-space"> </span>665<span class="Apple-converted-space"> </span><br class="">   <span class="Apple-converted-space"> </span>666         read_particles, gen_particles = self.index._read_particle_fields(<br class="">--> 667                                         particles, self, self._current_chunk)<br class="">   <span class="Apple-converted-space"> </span>668         for f, v in read_particles.items():<br class="">   <span class="Apple-converted-space"> </span>669             self.field_data[f] = self.ds.arr(v, input_units = finfos[f].units)<br class=""><br class="">/usr/local/lib/python2.7/dist-packages/yt/geometry/geometry_handler.pyc in _read_particle_fields(self, fields, dobj, chunk)<br class="">   <span class="Apple-converted-space"> </span>232             self._chunk_io(dobj, cache = False),<br class="">   <span class="Apple-converted-space"> </span>233             selector,<br class="">--> 234             fields_to_read)<br class="">   <span class="Apple-converted-space"> </span>235         return fields_to_return, fields_to_generate<br class="">   <span class="Apple-converted-space"> </span>236<span class="Apple-converted-space"> </span><br class=""><br class="">/usr/local/lib/python2.7/dist-packages/yt/utilities/io_handler.pyc in _read_particle_selection(self, chunks, selector, fields)<br class="">   <span class="Apple-converted-space"> </span>148         # Here, ptype_map means which particles contribute to a given type.<br class="">   <span class="Apple-converted-space"> </span>149         # And ptf is the actual fields from disk to read.<br class="">--> 150         psize = self._count_particles_chunks(chunks, ptf, selector)<br class="">   <span class="Apple-converted-space"> </span>151         # Now we allocate<br class="">   <span class="Apple-converted-space"> </span>152         # ptf, remember, is our mapping of what we want to read<br class=""><br class="">/usr/local/lib/python2.7/dist-packages/yt/utilities/io_handler.pyc in _count_particles_chunks(self, chunks, ptf, selector)<br class="">   <span class="Apple-converted-space"> </span>119     def _count_particles_chunks(self, chunks, ptf, selector):<br class="">   <span class="Apple-converted-space"> </span>120         psize = defaultdict(lambda: 0) # COUNT PTYPES ON DISK<br class="">--> 121         for ptype, (x, y, z) in self._read_particle_coords(chunks, ptf):<br class="">   <span class="Apple-converted-space"> </span>122             psize[ptype] += selector.count_points(x, y, z, 0.0)<br class="">   <span class="Apple-converted-space"> </span>123         return dict(psize.items())<br class=""><br class="">/usr/local/lib/python2.7/dist-packages/yt/frontends/flash/io.pyc in _read_particle_coords(self, chunks, ptf)<br class="">    <span class="Apple-converted-space"> </span>72                 start = p_ind[<a href="http://g1.id/" target="_blank" class="">g1.id</a><span class="Apple-converted-space"> </span>- g1._id_offset]<br class="">    <span class="Apple-converted-space"> </span>73                 end = p_ind[<a href="http://g2.id/" target="_blank" class="">g2.id</a><span class="Apple-converted-space"> </span>- g2._id_offset + 1]<br class="">---> 74                 x = np.asarray(p_fields[start:end, px], dtype="=f8")<br class="">    <span class="Apple-converted-space"> </span>75                 y = np.asarray(p_fields[start:end, py], dtype="=f8")<br class="">    <span class="Apple-converted-space"> </span>76                 z = np.asarray(p_fields[start:end, pz], dtype="=f8")<br class=""><br class="">/usr/lib/python2.7/dist-packages/h5py/_hl/dataset.pyc in __getitem__(self, args)<br class="">   <span class="Apple-converted-space"> </span>312<span class="Apple-converted-space"> </span><br class="">   <span class="Apple-converted-space"> </span>313         # Perform the dataspace selection.<br class="">--> 314         selection = sel.select(self.shape, args, dsid=<a href="http://self.id/" target="_blank" class="">self.id</a>)<br class="">   <span class="Apple-converted-space"> </span>315<span class="Apple-converted-space"> </span><br class="">   <span class="Apple-converted-space"> </span>316         if selection.nselect == 0:<br class=""><br class="">/usr/lib/python2.7/dist-packages/h5py/_hl/selections.pyc in select(shape, args, dsid)<br class="">    <span class="Apple-converted-space"> </span>92<span class="Apple-converted-space"> </span><br class="">    <span class="Apple-converted-space"> </span>93     sel = SimpleSelection(shape)<br class="">---> 94     sel[args]<br class="">    <span class="Apple-converted-space"> </span>95     return sel<br class="">    <span class="Apple-converted-space"> </span>96<span class="Apple-converted-space"> </span><br class=""><br class="">/usr/lib/python2.7/dist-packages/h5py/_hl/selections.pyc in __getitem__(self, args)<br class="">   <span class="Apple-converted-space"> </span>259             return self<br class="">   <span class="Apple-converted-space"> </span>260<span class="Apple-converted-space"> </span><br class="">--> 261         start, count, step, scalar = _handle_simple(self.shape,args)<br class="">   <span class="Apple-converted-space"> </span>262<span class="Apple-converted-space"> </span><br class="">   <span class="Apple-converted-space"> </span>263         self._id.select_hyperslab(start, count, step)<br class=""><br class="">/usr/lib/python2.7/dist-packages/h5py/_hl/selections.pyc in _handle_simple(shape, args)<br class="">   <span class="Apple-converted-space"> </span>510     for arg, length in zip(args, shape):<br class="">   <span class="Apple-converted-space"> </span>511         if isinstance(arg, slice):<br class="">--> 512             x,y,z = _translate_slice(arg, length)<br class="">   <span class="Apple-converted-space"> </span>513             s = False<br class="">   <span class="Apple-converted-space"> </span>514         else:<br class=""><br class="">/usr/lib/python2.7/dist-packages/h5py/_hl/selections.pyc in _translate_slice(exp, length)<br class="">   <span class="Apple-converted-space"> </span>551         raise ValueError("Step must be >= 1 (got %d)" % step)<br class="">   <span class="Apple-converted-space"> </span>552     if stop == start:<br class="">--> 553         raise ValueError("Zero-length selections are not allowed")<br class="">   <span class="Apple-converted-space"> </span>554     if stop < start:<br class="">   <span class="Apple-converted-space"> </span>555         raise ValueError("Reverse-order selections are not allowed")<br class=""><br class="">ValueError: Zero-length selections are not allowed<br class="">------------------------------------------------------------------------<br class=""><br class=""></div><div class="">Let me know if any other info would be useful.<br class=""></div><div class=""><br class=""></div>Cheers,<br class=""></div>Jason<br class=""></div><div class=""><div class=""><div class="gmail_extra"><br class=""><div class="gmail_quote">On Tue, Apr 28, 2015 at 2:39 PM, Nathan Goldbaum<span class="Apple-converted-space"> </span><span dir="ltr" class=""><<a href="mailto:nathan12343@gmail.com" target="_blank" class="">nathan12343@gmail.com</a>></span><span class="Apple-converted-space"> </span>wrote:<br class=""><blockquote class="gmail_quote" style="margin: 0px 0px 0px 0.8ex; border-left-width: 1px; border-left-color: rgb(204, 204, 204); border-left-style: solid; padding-left: 1ex;"><div dir="ltr" class=""><br class=""><div class="gmail_extra"><br class=""><div class="gmail_quote"><span class="">On Tue, Apr 28, 2015 at 11:37 AM, Nathan Goldbaum<span class="Apple-converted-space"> </span><span dir="ltr" class=""><<a href="mailto:nathan12343@gmail.com" target="_blank" class="">nathan12343@gmail.com</a>></span><span class="Apple-converted-space"> </span>wrote:<br class=""><blockquote class="gmail_quote" style="margin: 0px 0px 0px 0.8ex; border-left-width: 1px; border-left-color: rgb(204, 204, 204); border-left-style: solid; padding-left: 1ex;"><div dir="ltr" class=""><br class=""><div class="gmail_extra"><br class=""><div class="gmail_quote"><span class="">On Tue, Apr 28, 2015 at 11:36 AM, Jason Galyardt<span class="Apple-converted-space"> </span><span dir="ltr" class=""><<a href="mailto:jason.galyardt@gmail.com" target="_blank" class="">jason.galyardt@gmail.com</a>></span><span class="Apple-converted-space"> </span>wrote:<br class=""><blockquote class="gmail_quote" style="margin: 0px 0px 0px 0.8ex; border-left-width: 1px; border-left-color: rgb(204, 204, 204); border-left-style: solid; padding-left: 1ex;"><div dir="ltr" class=""><div class=""><div class=""><div class=""><div class=""><div class=""><div class="">Hi all,<br class=""><br class=""></div>I'm sure I've just overlooked some bit of documentation, but I'm having trouble plotting particles generated by FLASH on top of the gas density. I've been able to load a plot file with the associated particle file via<span class="Apple-converted-space"> </span><br class=""><br class="">ds = yt.load(plotfileName, particle_filename=partfileName)<br class=""><br class=""><br class=""></div>However, when I try to create a projection and annotate the particles with<br class=""><br class=""></div>p = yt.ProjectionPlot(ds, "y", "density")<br class="">p.annotate_particles(1.0)                      # ValueError!<br class=""></div><div class=""># p.annotate_particles((4.0, 'kpc'))         # ValueError!<br class=""></div><div class=""><br class=""></div></div></div></div></blockquote><div class=""><br class=""></div></span><div class="">Can you pastebin the full error traceback?  Which yt version are you using?</div></div></div></div></blockquote><div class=""><br class=""></div></span><div class="">Forgot to mention that you can get precise version information by executing "yt version" at the bash command line.</div><span class=""><div class=""> </div><blockquote class="gmail_quote" style="margin: 0px 0px 0px 0.8ex; border-left-width: 1px; border-left-color: rgb(204, 204, 204); border-left-style: solid; padding-left: 1ex;"><div dir="ltr" class=""><div class="gmail_extra"><div class="gmail_quote"><div class=""> </div><blockquote class="gmail_quote" style="margin: 0px 0px 0px 0.8ex; border-left-width: 1px; border-left-color: rgb(204, 204, 204); border-left-style: solid; padding-left: 1ex;"><span class=""><div dir="ltr" class=""><div class=""><div class=""><div class="">I get a ValueError from h5py indicating that zero-length selections are not allowed. I have also tried passing the full width of the simulation domain to the annotation function without success. I suspect that this is a user error stemming from differences between the way that Enzo and FLASH store particle data. However, I can't find much in the way of documentation or examples for the FLASH particle data format.<span class="Apple-converted-space"> </span><br class=""><br class="">Of course, it would also be handy to be able to write my own analysis scripts using both gas and particles, but for now, I'll settle for any help I can get on simple plotting functionality.<br class=""><br class=""></div>Thanks,<br class=""><br class=""></div>Jason Galyardt<br class=""></div>Department of Physics and Astronomy<br class=""><div class=""><div class=""><div class="">University of Georgia<br class=""></div><div class=""><br class=""></div></div></div></div><br class=""></span>_______________________________________________<br class="">yt-users mailing list<br class=""><a href="mailto:yt-users@lists.spacepope.org" target="_blank" class="">yt-users@lists.spacepope.org</a><br class=""><a href="http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org" target="_blank" class="">http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org</a><br class=""><br class=""></blockquote></div><br class=""></div></div></blockquote></span></div><br class=""></div></div><br class="">_______________________________________________<br class="">yt-users mailing list<br class=""><a href="mailto:yt-users@lists.spacepope.org" target="_blank" class="">yt-users@lists.spacepope.org</a><br class=""><a href="http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org" target="_blank" class="">http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org</a><br class=""><br class=""></blockquote></div><br class=""></div></div></div><br class="">_______________________________________________<br class="">yt-users mailing list<br class=""><a href="mailto:yt-users@lists.spacepope.org" target="_blank" class="">yt-users@lists.spacepope.org</a><br class=""><a href="http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org" target="_blank" class="">http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org</a><br class=""><br class=""></blockquote></div><br class=""></div></div></div><br class="">_______________________________________________<br class="">yt-users mailing list<br class=""><a href="mailto:yt-users@lists.spacepope.org" target="_blank" class="">yt-users@lists.spacepope.org</a><br class=""><a href="http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org" target="_blank" class="">http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org</a><br class=""><br class=""></blockquote></div><br class=""></div></div></div><br class="">_______________________________________________<br class="">yt-users mailing list<br class=""><a href="mailto:yt-users@lists.spacepope.org" class="">yt-users@lists.spacepope.org</a><br class=""><a href="http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org" target="_blank" class="">http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org</a><br class=""><br class=""></blockquote></div><br class=""></div></div><span style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; float: none; display: inline !important;" class="">_______________________________________________</span><br style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><span style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; float: none; display: inline !important;" class="">yt-users mailing list</span><br style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><a href="mailto:yt-users@lists.spacepope.org" style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class="">yt-users@lists.spacepope.org</a><br style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><a href="http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org" style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class="">http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org</a></div></blockquote></div><br class=""></div></body></html>