[yt-dev] yt Particle Plots & openPMD Frontend

Nathan Goldbaum nathan12343 at gmail.com
Fri Jun 10 08:55:14 PDT 2016


Hey,

The issue you're having is because you're constructing known_other_fields
dynamically. All the other frontends define it statically, so it's filled
out by the time it's needed in the `setup_fluid_aliases` function defined
in in yt/fields/field_info_container.py. The fix is to change the order of
operations - setup known_other_fields and known_particle_fields before
calling the __init__ method on the superclass of OpenPMDFieldInfo.

You're also incorrectly setting the units of the field to a Unit object ---
the unit entry in the known_other_fields tuple should be a string.

The following diff allows me to set the units properly for your frontend:

http://paste.yt-project.org/show/6606/

Out of curiosity - why build the known_other_fields and
known_particle_fields tuples dynamically? The reason they're static for all
the other frotends is to make it easy to reason about which fields are
associated with a given frontend and so that the fields known by a given
frontend are independent of any particular dataset you might be looking at.

By the way, it also looks like the 'all' particle union is working
correctly - are you still having issues with that?

-Nathan

On Fri, Jun 10, 2016 at 8:24 AM, Fabian Koller <f.koller at hzdr.de> wrote:

> Cheers Nathan,
>
> thank you for the patch. I pulled the code (#2213) into my local copy
> and gave it as in-depth a test as I could. It works, except for one detail.
>
> I am unsure whether the problem arises from the frontend or through the
> unit system, but what I am currently facing is: fields from
> known_other_fields do not have units (ergo are dimensionless) in
> datasets, no matter what the unit in known_other_fields.
>
> I've attached a script which tries to show the problem by using one of
> the example files Axel linked to in his last mail.
>
>
> --Fabian
>
>
> On 03/06/16 23:05, Nathan Goldbaum wrote:
> > I've opened a pull request to fix the issue you discovered with
> > magnetic units:
> >
> > https://bitbucket.org/yt_analysis/yt/pull-requests/2213
> >
> > I'd appreciate it if one of you could give it a test. Let me know if
> > you have questions about how to pull a pull request in locally with
> > mercurial.
> >
> > I haven't had a time to look at the issue you were having with the
> > 'all' particle union, but I have it on my list to look at it.
> >
> > On Fri, May 27, 2016 at 2:37 AM, Huebl, Axel <a.huebl at hzdr.de
> > <mailto:a.huebl at hzdr.de>> wrote:
> >
> >     Dear Nathan and John,
> >
> >     thank you for the quick answers.
> >
> >     Yes, the resources to reproduce the questions are:
> >
> >     Repo:
> >       https://bitbucket.org/C0nsultant/openpmd/src?at=yt
> >
> >     Example Files:
> >       PIConGPU > 2D3V > one of the .h5 files
> >       https://owncloud.hzdr.de/index.php/s/ouisGZe5M0wCVzj
> >       password: openPMD
> >
> >     Example script (attached, like last mail).
> >
> >
> >     Axel
> >
> >     On 24.05.2016 18 <tel:24.05.2016%2018>:37, Nathan Goldbaum wrote:
> >     >
> >     >
> >     > On Tue, May 24, 2016 at 11:30 AM, Huebl, Axel <a.huebl at hzdr.de
> >     <mailto:a.huebl at hzdr.de>
> >     > <mailto:a.huebl at hzdr.de <mailto:a.huebl at hzdr.de>>> wrote:
> >     >
> >     >     Hi yt-devs,
> >     >
> >     >     I am forwarding this conversation to the public list to keep
> >     it open for
> >     >     others to join in and to build up a record that might help
> >     others.
> >     >
> >     >     Our new student Fabian updated our frontend and implemented
> >     particle
> >     >     readers. Unfortunately some details of the particle "fields"
> >     still cause
> >     >     some bumps that we can not get our head around.
> >     >
> >     >     We are now able to read fields and particles, even
> >     chunk-wise, and can
> >     >     work with the data we read in python scripts via the
> >     all_data() method.
> >     >
> >     >     Nevertheless, using the particle scatter plots such as
> >     yt.ParticlePlot
> >     >     seems not to work. We have some problems with unions / the
> >     "all" group
> >     >     and the fact that we have several particle species (e.g., "hot
> >     >     electrons", "cold electrons", "helium ions", "nitrogen
> >     ions", etc.)
> >     >
> >     >
> >     > The 'all' particle union should get set up automatically, but maybe
> >     > something is going wrong with that machinery.
> >     >
> >     > Can you create a test script that illustrates this issue using a
> >     > publicly available OpenPMD dataset?
> >     >
> >     >
> >     >
> >     >     Also since the last rebase: did someone recently change the
> >     unit system
> >     >     in yt? T for "Tesla" seems not to be understood any more. Is
> >     there a
> >     >     changelog somewhere available? Do we have to describe our
> >     data in
> >     >     cgs / mks?
> >     >
> >     >
> >     > I just double-checked, and Tesla should be working:
> >     >
> >     > In [1]: from yt import YTQuantity
> >     >
> >     > In [2]: YTQuantity(1, 'T')
> >     > Out[2]: 1.0 T
> >     >
> >     > In [3]: YTQuantity(1, 'T').to_equivalent('G', 'CGS')
> >     > Out[3]: 10000.0 G
> >     >
> >     > Can you explain a little bit more what issue you're having? A test
> >     > script that illustrates the issue would also help.
> >     >
> >     >
> >     >     Would someone be interested for a quick heads up via e.g.,
> >     skype /
> >     >     web-rtc so we can ask specific questions?
> >     >
> >     >     Fabian is around on Tuesdays and Fridays, something like
> >     early CA time,
> >     >     and late GER time usually works great (e.g., 9pm-PDT /
> >     6pm-CEST).
> >     >
> >     >     Our current branch HEAD can be found here
> >     (->yt->frontends->openPMD):
> >     >       https://bitbucket.org/C0nsultant/openpmd/src?at=yt
> >     >
> >     >     And an example script is attached.
> >     >
> >     >
> >     >     Thanks a lot!
> >     >     Axel
> >     >
> >     >
> >
> >     --
> >
> >     Axel Huebl
> >     Phone +49 351 260 3582 <tel:%2B49%20351%20260%203582>
> >     https://www.hzdr.de/crp
> >     Computational Radiation Physics
> >     Laser Particle Acceleration Division
> >     Helmholtz-Zentrum Dresden - Rossendorf e.V.
> >
> >     Bautzner Landstrasse 400, 01328 Dresden
> >     POB 510119, D-01314 Dresden
> >     Vorstand: Prof. Dr.Dr.h.c. R. Sauerbrey
> >               Prof. Dr.Dr.h.c. P. Joehnk
> >     VR 1693 beim Amtsgericht Dresden
> >
> >     _______________________________________________
> >     yt-dev mailing list
> >     yt-dev at lists.spacepope.org <mailto:yt-dev at lists.spacepope.org>
> >     http://lists.spacepope.org/listinfo.cgi/yt-dev-spacepope.org
> >
> >
> >
> >
> > _______________________________________________
> > yt-dev mailing list
> > yt-dev at lists.spacepope.org
> > http://lists.spacepope.org/listinfo.cgi/yt-dev-spacepope.org
>
>
> _______________________________________________
> yt-dev mailing list
> yt-dev at lists.spacepope.org
> http://lists.spacepope.org/listinfo.cgi/yt-dev-spacepope.org
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.spacepope.org/pipermail/yt-dev-spacepope.org/attachments/20160610/3c2e05ea/attachment-0001.htm>


More information about the yt-dev mailing list