[yt-dev] kwargs for SlicePlot and ProjectionPlot?
Nathan Goldbaum
nathan12343 at gmail.com
Sun Jan 13 16:04:48 PST 2013
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 at lists.spacepope.org
> http://lists.spacepope.org/listinfo.cgi/yt-dev-spacepope.org
More information about the yt-dev
mailing list