Hi Matt and Nathan,

Thanks for your responses. I'm fine with an explicit field_parameters instead of **kwargs - in fact, now that you both mention it, I agree that it's better to do it that way. I'll submit a pull request shortly for you to look at.

Thanks,
Andrew

On Sun, Jan 13, 2013 at 4:04 PM, Nathan Goldbaum <nathan12343@gmail.com> wrote:
Hi Andrew,

Rather than adding **kwargs to the signature of __init__ for PWViewMPL, I think it would be better to add a field_parameters keyword argument.  This would be a dict that would be iterated over to set field parameters.  This is actually exactly how **kwargs is handled in the AMRData base class but I think mandating that the dict is referred to as field_parameters internally is a bit clearer with the added benefit that the API is concrete and doesn't rely on a somewhat advanced python concept.  I'm not a big fan of how the data containers currently handle the kwargs dict and am -1 on exposing **kwargs in a user-facing function.

That being said, I haven't thought about this issue as deeply as others on the project have, and there may be very good reasons for using **kwargs in this context.

Cheers,

Nathan
Hi Folks,

I was wondering if there are any objections (particularly from Nathan) to adding an optional **kwargs argument to SlicePlot and ProjectionPlot, so that we can pass in field parameters like this:

pw = SlicePlot(pf, 2, 'GravitationalForceMag', center=c, width=(1e4, 'au'), particle_data=pd)

instead of the (very slighty) more clunky:

slice = pf.h.slice(2, c[2], ['GravitationalForceMag'], particle_data=pd)
pw = slice.to_pw('GravitationalForceMag', center=c, width=(1e4, 'au'))

I think it would be nice to able to use the same syntax to generate slices and projections whether or not a derived field requires extra field parameters.

Thanks,
Andrew



_______________________________________________
yt-dev mailing list
yt-dev@lists.spacepope.org
http://lists.spacepope.org/listinfo.cgi/yt-dev-spacepope.org

_______________________________________________
yt-dev mailing list
yt-dev@lists.spacepope.org
http://lists.spacepope.org/listinfo.cgi/yt-dev-spacepope.org