<div dir="ltr">I think it actually has to be<div><br></div><div><span style="color:rgb(80,0,80);font-family:arial,sans-serif;font-size:13px"> _con_args = ("_base_region", "_field_cuts")</span><br></div>
</div><div class="gmail_extra"><br><br><div class="gmail_quote">On Mon, Jun 17, 2013 at 11:35 AM, david collins <span dir="ltr"><<a href="mailto:dcollins4096@gmail.com" target="_blank">dcollins4096@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"><div>Thanks for the suggestion, Matt. </div><div><br></div>I'm still getting an error-- I added the following to data_containers.py:<div>
<br></div><div><code></div><div><div>class InLineExtractedRegionBase(AMR3DData):</div>
<div> """ In-line extracted regions accept a base region and a set of field_cuts to</div><div> determine which points in a grid should be included.</div><div class="im"><div> """ </div>
<div> _con_args = ("base_region", "field_cuts")</div>
<div> _type_name = "cut_region"</div></div></div><div></code></div><div><br></div><div>and now I get the error</div><div><br></div><div>AttributeError: 'InLineExtractedRegionBase' object has no attribute 'base_region'<br>
</div><div><br></div><div><div class="im"><div> File "/nics/b/home/collins/yt2.0/fPickle.py", line 15, in dump</div><div> output = cPickle.dump(object,file,*args,**kwargs)</div></div><div> File "/nics/b/home/collins/local_2013_03_12/src/yt-dave-hg-hangnail/yt/data_objects/data_containers.py", line 407, in __reduce__</div>
<div class="im">
<div> [getattr(self, n) for n in self._con_args] +</div></div><div>AttributeError: 'InLineExtractedRegionBase' object has no attribute 'base_region'</div></div><div><br></div><div>Thanks a ton,</div><div>
d.</div><div><br></div></div><div class="HOEnZb"><div class="h5"><div class="gmail_extra"><br><br><div class="gmail_quote">On Mon, Jun 17, 2013 at 11:34 AM, 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 Dave,<br>
<br>
I think it needs the following items:<br>
<br>
_con_args = ("base_region", "field_cuts")<br>
_type_name = "cut_region"<br>
<br>
in the class definition and I think it should be good to go.<br>
<br>
-Matt<br>
<div><div><br>
On Mon, Jun 17, 2013 at 1:32 PM, David Collins <<a href="mailto:dcollins4096@gmail.com" target="_blank">dcollins4096@gmail.com</a>> wrote:<br>
> Hi, all--<br>
><br>
> I'm trying to pickle a dataset I made with cut_region. This fails on the<br>
> call to __reduce__ since the cut_region doesn't have a _type_name attribute.<br>
> Is there an easy way to give _type_names to cut regions in general, or<br>
> should I clone the __reduce__ method for InLineExtractedRegionBase?<br>
><br>
> I generate the object like this:<br>
><br>
>>> region = pf.h.region(Center,Left,Right)<br>
>>> cut_region = region.cut_region(['grid[some_field] == some_value'})<br>
>>> file = open(args)<br>
>>> cPickle.dump(cut_region,file)<br>
><br>
> which gives the following error:<br>
><br>
> Traceback (most recent call last):<br>
> File "<stdin>", line 1, in <module><br>
> File "/nics/b/home/collins/yt2.0/fPickle.py", line 15, in dump<br>
> output = cPickle.dump(object,file,*args,**kwargs)<br>
> File<br>
> "/nics/b/home/collins/local_2013_03_12/src/yt-dave/yt/data_objects/data_containers.py",<br>
> line 407, in __reduce__<br>
> [getattr(self, n) for n in self._con_args] +<br>
> AttributeError: 'InLineExtractedRegionBase' object has no attribute<br>
> '_type_name'<br>
><br>
><br>
> Thanks!<br>
> d.<br>
><br>
</div></div>> _______________________________________________<br>
> yt-users mailing list<br>
> <a href="mailto:yt-users@lists.spacepope.org" target="_blank">yt-users@lists.spacepope.org</a><br>
> <a href="http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org" target="_blank">http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org</a><br>
><br>
_______________________________________________<br>
yt-users mailing list<br>
<a href="mailto:yt-users@lists.spacepope.org" target="_blank">yt-users@lists.spacepope.org</a><br>
<a href="http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org" target="_blank">http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org</a><br>
</blockquote></div><br></div>
</div></div><br>_______________________________________________<br>
yt-users mailing list<br>
<a href="mailto:yt-users@lists.spacepope.org">yt-users@lists.spacepope.org</a><br>
<a href="http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org" target="_blank">http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org</a><br>
<br></blockquote></div><br></div>