[yt-users] Particles in FLASH output

John Zuhone jzuhone at gmail.com
Tue Apr 28 12:44:37 PDT 2015


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. 

It should work now, based on looking at the code, so if it doesn’t then we definitely have a bug. 

> On Apr 28, 2015, at 3:37 PM, Nathan Goldbaum <nathan12343 at gmail.com> wrote:
> 
> 
> 
> On Tue, Apr 28, 2015 at 12:27 PM, Jason Galyardt <jason.galyardt at gmail.com <mailto:jason.galyardt at gmail.com>> wrote:
> Hi all,
> 
> 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?
> 
> Can you try:
> 
> p.annotate_particles((4, 'kpc'))
> 
> ?
> 
> If that works, can you file a bug about annotate_particles not handling widths that are YTQuantity instances correctly?
> 
> https://bitbucket.org/yt_analysis/yt/issues/new <https://bitbucket.org/yt_analysis/yt/issues/new>
>  
> 
> Thanks,
> Jason
> 
> On Tue, Apr 28, 2015 at 2:56 PM, Yuan Li <bear0980 at gmail.com <mailto:bear0980 at gmail.com>> wrote:
> Hi Jason,
> 
> 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?
> 
> Yuan
> 
> On Tue, Apr 28, 2015 at 2:53 PM, Jason Galyardt <jason.galyardt at gmail.com <mailto:jason.galyardt at gmail.com>> wrote:
> Nathan,
> 
> 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:
> 
> ---------------------------------------------------------------------------
> ValueError                                Traceback (most recent call last)
> <ipython-input-49-3f118016da60> in <module>()
> ----> 1 p.annotate_particles((4.0,'kpc'))
> 
> /usr/local/lib/python2.7/dist-packages/yt/visualization/plot_container.pyc in newfunc(*args, **kwargs)
>      68         rv = f(*args, **kwargs)
>      69         args[0]._plot_valid = False
> ---> 70         args[0]._setup_plots()
>      71         return rv
>      72     return newfunc
> 
> /usr/local/lib/python2.7/dist-packages/yt/visualization/plot_window.pyc in _setup_plots(self)
>     860                 label.set_fontproperties(fp)
>     861 
> --> 862             self.run_callbacks(f)
>     863 
>     864             if draw_axes is False:
> 
> /usr/local/lib/python2.7/dist-packages/yt/visualization/plot_container.pyc in run_callbacks(self, f)
>     313             CallbackMaker = callback_registry[name]
>     314             callback = CallbackMaker(*args[1:], **kwargs)
> --> 315             callback(cbw)
>     316         for key in self.frb.keys():
>     317             if key not in keys:
> 
> /usr/local/lib/python2.7/dist-packages/yt/visualization/plot_modifications.pyc in __call__(self, plot)
>    1053         pt = self.ptype
>    1054         gg = ( ( reg[pt, field_x] >= x0 ) & ( reg[pt, field_x] <= x1 )
> -> 1055            &   ( reg[pt, field_y] >= y0 ) & ( reg[pt, field_y] <= y1 ) )
>    1056         if self.minimum_mass is not None:
>    1057             gg &= (reg[pt, "particle_mass"] >= self.minimum_mass)
> 
> /usr/local/lib/python2.7/dist-packages/yt/data_objects/data_containers.pyc in __getitem__(self, key)
>     238                 return self.field_data[f]
>     239             else:
> --> 240                 self.get_data(f)
>     241         # fi.units is the unit expression string. We depend on the registry
>     242         # hanging off the dataset to define this unit object.
> 
> /usr/local/lib/python2.7/dist-packages/yt/data_objects/data_containers.pyc in get_data(self, fields)
>     665 
>     666         read_particles, gen_particles = self.index._read_particle_fields(
> --> 667                                         particles, self, self._current_chunk)
>     668         for f, v in read_particles.items():
>     669             self.field_data[f] = self.ds.arr(v, input_units = finfos[f].units)
> 
> /usr/local/lib/python2.7/dist-packages/yt/geometry/geometry_handler.pyc in _read_particle_fields(self, fields, dobj, chunk)
>     232             self._chunk_io(dobj, cache = False),
>     233             selector,
> --> 234             fields_to_read)
>     235         return fields_to_return, fields_to_generate
>     236 
> 
> /usr/local/lib/python2.7/dist-packages/yt/utilities/io_handler.pyc in _read_particle_selection(self, chunks, selector, fields)
>     148         # Here, ptype_map means which particles contribute to a given type.
>     149         # And ptf is the actual fields from disk to read.
> --> 150         psize = self._count_particles_chunks(chunks, ptf, selector)
>     151         # Now we allocate
>     152         # ptf, remember, is our mapping of what we want to read
> 
> /usr/local/lib/python2.7/dist-packages/yt/utilities/io_handler.pyc in _count_particles_chunks(self, chunks, ptf, selector)
>     119     def _count_particles_chunks(self, chunks, ptf, selector):
>     120         psize = defaultdict(lambda: 0) # COUNT PTYPES ON DISK
> --> 121         for ptype, (x, y, z) in self._read_particle_coords(chunks, ptf):
>     122             psize[ptype] += selector.count_points(x, y, z, 0.0)
>     123         return dict(psize.items())
> 
> /usr/local/lib/python2.7/dist-packages/yt/frontends/flash/io.pyc in _read_particle_coords(self, chunks, ptf)
>      72                 start = p_ind[g1.id <http://g1.id/> - g1._id_offset]
>      73                 end = p_ind[g2.id <http://g2.id/> - g2._id_offset + 1]
> ---> 74                 x = np.asarray(p_fields[start:end, px], dtype="=f8")
>      75                 y = np.asarray(p_fields[start:end, py], dtype="=f8")
>      76                 z = np.asarray(p_fields[start:end, pz], dtype="=f8")
> 
> /usr/lib/python2.7/dist-packages/h5py/_hl/dataset.pyc in __getitem__(self, args)
>     312 
>     313         # Perform the dataspace selection.
> --> 314         selection = sel.select(self.shape, args, dsid=self.id <http://self.id/>)
>     315 
>     316         if selection.nselect == 0:
> 
> /usr/lib/python2.7/dist-packages/h5py/_hl/selections.pyc in select(shape, args, dsid)
>      92 
>      93     sel = SimpleSelection(shape)
> ---> 94     sel[args]
>      95     return sel
>      96 
> 
> /usr/lib/python2.7/dist-packages/h5py/_hl/selections.pyc in __getitem__(self, args)
>     259             return self
>     260 
> --> 261         start, count, step, scalar = _handle_simple(self.shape,args)
>     262 
>     263         self._id.select_hyperslab(start, count, step)
> 
> /usr/lib/python2.7/dist-packages/h5py/_hl/selections.pyc in _handle_simple(shape, args)
>     510     for arg, length in zip(args, shape):
>     511         if isinstance(arg, slice):
> --> 512             x,y,z = _translate_slice(arg, length)
>     513             s = False
>     514         else:
> 
> /usr/lib/python2.7/dist-packages/h5py/_hl/selections.pyc in _translate_slice(exp, length)
>     551         raise ValueError("Step must be >= 1 (got %d)" % step)
>     552     if stop == start:
> --> 553         raise ValueError("Zero-length selections are not allowed")
>     554     if stop < start:
>     555         raise ValueError("Reverse-order selections are not allowed")
> 
> ValueError: Zero-length selections are not allowed
> ------------------------------------------------------------------------
> 
> Let me know if any other info would be useful.
> 
> Cheers,
> Jason
> 
> On Tue, Apr 28, 2015 at 2:39 PM, Nathan Goldbaum <nathan12343 at gmail.com <mailto:nathan12343 at gmail.com>> wrote:
> 
> 
> On Tue, Apr 28, 2015 at 11:37 AM, Nathan Goldbaum <nathan12343 at gmail.com <mailto:nathan12343 at gmail.com>> wrote:
> 
> 
> On Tue, Apr 28, 2015 at 11:36 AM, Jason Galyardt <jason.galyardt at gmail.com <mailto:jason.galyardt at gmail.com>> wrote:
> Hi all,
> 
> 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 
> 
> ds = yt.load(plotfileName, particle_filename=partfileName)
> 
> 
> However, when I try to create a projection and annotate the particles with
> 
> p = yt.ProjectionPlot(ds, "y", "density")
> p.annotate_particles(1.0)                      # ValueError!
> # p.annotate_particles((4.0, 'kpc'))         # ValueError!
> 
> 
> Can you pastebin the full error traceback?  Which yt version are you using?
> 
> Forgot to mention that you can get precise version information by executing "yt version" at the bash command line.
>  
>  
> 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. 
> 
> 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.
> 
> Thanks,
> 
> Jason Galyardt
> Department of Physics and Astronomy
> University of Georgia
> 
> 
> _______________________________________________
> yt-users mailing list
> yt-users at lists.spacepope.org <mailto:yt-users at lists.spacepope.org>
> http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org <http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org>
> 
> 
> 
> 
> _______________________________________________
> yt-users mailing list
> yt-users at lists.spacepope.org <mailto:yt-users at lists.spacepope.org>
> http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org <http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org>
> 
> 
> 
> _______________________________________________
> yt-users mailing list
> yt-users at lists.spacepope.org <mailto:yt-users at lists.spacepope.org>
> http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org <http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org>
> 
> 
> 
> _______________________________________________
> yt-users mailing list
> yt-users at lists.spacepope.org <mailto:yt-users at lists.spacepope.org>
> http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org <http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org>
> 
> 
> 
> _______________________________________________
> yt-users mailing list
> yt-users at lists.spacepope.org <mailto:yt-users at lists.spacepope.org>
> http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org <http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org>
> 
> 
> _______________________________________________
> yt-users mailing list
> yt-users at lists.spacepope.org <mailto:yt-users at lists.spacepope.org>
> http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org <http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.spacepope.org/pipermail/yt-users-spacepope.org/attachments/20150428/d6524416/attachment.htm>
-------------- next part --------------
_______________________________________________
yt-users mailing list
yt-users at lists.spacepope.org
http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org


More information about the yt-users mailing list