Hi I think I've found a bug with serialization and projections with a data_source. If I do a projection providing a data_source everything is fine: disk = pf.h.disk((0.5,0.5,0.5), (0,0,1), (10.0,'kpc'), (2.0,'kpc')) pc = PlotCollection(pf) pc.add_projection("NumberDensity","z",weight_field="Density", data_source=disk) But then, if I do the exact same projection without a data_source, it breaks with an error: 'No field named px'. The full traceback is at http://paste.yt-project.org/show/2637/. Note that if I first delete the .yt file, then the projection without data_source works just fine. Mike -- ********************************************************************* * * * Dr. Michael Kuhlen Theoretical Astrophysics Center * * email: mqk@astro.berkeley.edu UC Berkeley * * cell phone: (831) 588-1468 B-116 Hearst Field Annex # 3411 * * skype username: mikekuhlen Berkeley, CA 94720 * * * *********************************************************************
Hi Mike,
This is a problem. The issue is actually that "data_source" is not
the right argument, and gets passed as a field argument instead. If
you set it to "source" this will fix the issue you're seeing.
But, ugh, this is terrible, and I take responsibility. The kwargs
argument is the issue here. It has been a problem in the past, and
was set up so that things like mu could be passed in directly, but it
has caused way more harm than good. I committed a change to yt 3 last
night that removed kwargs and replaced with field_parameters, but I
think we should consider that in the 2.x branches as well. It's
annoying that this is basically a super easy way to shoot yourself in
the foot. It's also inconsistent because nearly everywhere else, it
*is* data_source, not just source.
What does everyone thing of removing kwargs from the data objects and
replacing with a field_parameters argument?
-Matt
On Thu, Aug 9, 2012 at 6:30 PM, Michael Kuhlen
Hi
I think I've found a bug with serialization and projections with a data_source.
If I do a projection providing a data_source everything is fine:
disk = pf.h.disk((0.5,0.5,0.5), (0,0,1), (10.0,'kpc'), (2.0,'kpc')) pc = PlotCollection(pf) pc.add_projection("NumberDensity","z",weight_field="Density", data_source=disk)
But then, if I do the exact same projection without a data_source, it breaks with an error: 'No field named px'. The full traceback is at http://paste.yt-project.org/show/2637/.
Note that if I first delete the .yt file, then the projection without data_source works just fine.
Mike
-- ********************************************************************* * * * Dr. Michael Kuhlen Theoretical Astrophysics Center * * email: mqk@astro.berkeley.edu UC Berkeley * * cell phone: (831) 588-1468 B-116 Hearst Field Annex # 3411 * * skype username: mikekuhlen Berkeley, CA 94720 * * * ********************************************************************* _______________________________________________ yt-dev mailing list yt-dev@lists.spacepope.org http://lists.spacepope.org/listinfo.cgi/yt-dev-spacepope.org
+1
Using kwargs is a kick the can down the road type of solution that has a
way of leading to stuff like this.
Britton
On Fri, Aug 10, 2012 at 4:25 PM, John ZuHone
On Aug 10, 2012, at 4:17 PM, Matthew Turk
wrote: What does everyone thing of removing kwargs from the data objects and replacing with a field_parameters argument?
+1 _______________________________________________ yt-dev mailing list yt-dev@lists.spacepope.org http://lists.spacepope.org/listinfo.cgi/yt-dev-spacepope.org
participants (4)
-
Britton Smith
-
John ZuHone
-
Matthew Turk
-
Michael Kuhlen