<div dir="ltr">Perfect, +1 from me.</div><div class="gmail_extra"><br><br><div class="gmail_quote">On Sun, Mar 10, 2013 at 6:05 PM, Christopher Moody <span dir="ltr"><<a href="mailto:chrisemoody@gmail.com" target="_blank">chrisemoody@gmail.com</a>></span> wrote:<br>

<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">Hi Sam,<div>Yeah; I think it should change only the derived field. You want the derived field to pass along whatever field type you asked for, or use the implicit one if you didn't ask for the type explicitly. If you tried to implement this in the original call, you'd do something like <font face="courier new, monospace">dd[(Ellipsis,"ParticleMassMsun")]</font>.   I can't see use cases where this would be better than <font face="courier new, monospace">dd[("all","ParticleMassMsun")]</font> -- so yeah, no changes to the original call.</div>


<div><br></div><div>chris</div></div><div class="HOEnZb"><div class="h5"><div class="gmail_extra"><br><br><div class="gmail_quote">On Sun, Mar 10, 2013 at 4:30 PM, Sam Skillman <span dir="ltr"><<a href="mailto:samskillman@gmail.com" target="_blank">samskillman@gmail.com</a>></span> wrote:<br>


<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">Hi Chris,<div><br></div><div>Just to be clear, this change would occur in the derived field definition, not the call to get the star ParticleMassMsun itself, correct?  </div>


<div><br></div><div>

If so, I think something like this, or with a yt-specific term, would be great.</div><div><br></div><div>Thanks,</div><div>Sam</div></div><div><div><div class="gmail_extra"><br><br><div class="gmail_quote">
On Sun, Mar 10, 2013 at 5:20 PM, Matthew Turk <span dir="ltr"><<a href="mailto:matthewturk@gmail.com" target="_blank">matthewturk@gmail.com</a>></span> wrote:<br>

<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hi Chris,<br>
<div><div><br>
On Sat, Mar 9, 2013 at 4:00 PM, Christopher Moody <<a href="mailto:chrisemoody@gmail.com" target="_blank">chrisemoody@gmail.com</a>> wrote:<br>
> Hi everyone,<br>
> Fields in yt-3.0 are now defined like (field_type,field_name) but for<br>
> backwards-compatibility still maintains a field_name -> ("all",field_name)<br>
> mapping. Consider a few use cases:<br>
><br>
> keys = ["ParticleMassMsun",<br>
>         ("all","ParticleMassMsun"),<br>
>         ("stars","particle_mass"),<br>
>         ("stars","ParticleMassMsun") ]#broken<br>
><br>
> I think we all have natural expectations for what should happen, but at the<br>
> moment the last key in the series is broken. particle_mass is a native<br>
> field, ParticleMassMsun is a derived field:<br>
><br>
> def _ParticleMassMsun(field, data):<br>
>     return data["particle_mass"]/mass_sun_cgs<br>
> add_field("ParticleMassMsun", function=_ParticleMassMsun,<br>
> particle_type=True)<br>
><br>
> Note that in this case data["particle_mass"] maps to<br>
> data[("all","particle_mass")] even when I originally asked for<br>
> dd[("stars","ParticleMassMsun")], which is why things break.<br>
><br>
> So I propose a syntax where in the derived field definition we can do<br>
> something like data[(Ellipsis,"ParticleMassMsun")] or alternatively<br>
> data[(field.field_type,"ParticleMassMsun")]. This ensures that derived<br>
> fields will work intuitively and be as specific to a field type as they want<br>
> to be or just pass through whatever field type they may want.<br>
><br>
<br>
</div></div>I like this, but maybe we should use a yt-specific object instead of<br>
Ellipsis.  This would be very nice and is something I have thought /<br>
worried about and been unable to come up with an elegant solution for.<br>
 Seems like you found one!  :)<br>
<br>
This week I need to address this for my own work on a simulation with<br>
multiple particle types; I'll take a pass at implementing something<br>
like this.  We're also a bit overdue for a YTEP that details access to<br>
multiple fluids and multiples particles.  Once some things get off my<br>
plate on Tuesday I will make that a priority.  Then we can use that as<br>
a place to sort of hash this out and how it'll work.<br>
<br>
-Matt<br>
<br>
> Thanks!<br>
> chris<br>
><br>
> _______________________________________________<br>
> yt-dev mailing list<br>
> <a href="mailto:yt-dev@lists.spacepope.org" target="_blank">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>
><br>
_______________________________________________<br>
yt-dev mailing list<br>
<a href="mailto:yt-dev@lists.spacepope.org" target="_blank">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></div>
</div></div><br>_______________________________________________<br>
yt-dev mailing list<br>
<a href="mailto:yt-dev@lists.spacepope.org" target="_blank">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>
<br></blockquote></div><br></div>
</div></div><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>
<br></blockquote></div><br></div>