<div dir="ltr">I personally find the behavior of field_info to be one of the biggest friction points in my day-to-day use and development in yt.  Specifically, I really think that if I ask to access field_info, it should be filled out/constructed automatically.  At the very least I think we should move _get_field_info to get_field_info, and then people might think to use that rather than access the field_info container directly.  In fact, if that's the route we go, we should even consider moving field_info to _field_info since it is a less stable interface to the information.<div>

<br></div><div>My $0.02</div></div><div class="gmail_extra"><br><br><div class="gmail_quote">On Tue, Apr 1, 2014 at 5:14 PM, Nathan Goldbaum <span dir="ltr"><<a href="mailto:nathan12343@gmail.com" target="_blank">nathan12343@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">I've opened a PR here that fixes it: <a href="https://bitbucket.org/yt_analysis/yt/pull-request/784/generate-the-index-for-the-total_mass/diff" target="_blank">https://bitbucket.org/yt_analysis/yt/pull-request/784/generate-the-index-for-the-total_mass/diff</a><div>



<br></div><div>I think this is a special case - it's the only derived quantity that uses the `field_info` like this.</div></div><div class="HOEnZb"><div class="h5"><div class="gmail_extra"><br><br><div class="gmail_quote">

On Tue, Apr 1, 2014 at 5:08 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">I think so, yes.  That manually instantiates the index.<br>
<br>
Now, I guess the bigger question is, *should* this be the fix, or<br>
should we somehow transparently catch this, and pass all the<br>
_get_field_info logic into __getitem__ in the field info container?  I<br>
am torn on that front.<br>
<div><div><br>
On Tue, Apr 1, 2014 at 8:06 PM, Nathan Goldbaum <<a href="mailto:nathan12343@gmail.com" target="_blank">nathan12343@gmail.com</a>> wrote:<br>
> Hi Matt,<br>
><br>
> So the fix would be to get the field_info via _get_field_info in __call__<br>
> for the derived quantity?<br>
><br>
> -Natan<br>
><br>
><br>
> On Tue, Apr 1, 2014 at 5:04 PM, Matthew Turk <<a href="mailto:matthewturk@gmail.com" target="_blank">matthewturk@gmail.com</a>> wrote:<br>
>><br>
>> Hi Nathan,<br>
>><br>
>> This was by design -- whether that was right or not -- because I<br>
>> wanted to allow all of the objects to be created without requiring an<br>
>> index, until data was accessed.  Specifically this fails because<br>
>> TotalMass accesses field_info directly instead of via _get_field_info.<br>
>><br>
>> -Matt<br>
>><br>
>> On Tue, Apr 1, 2014 at 8:02 PM, Nathan Goldbaum<br>
>> <<a href="mailto:issues-reply@bitbucket.org" target="_blank">issues-reply@bitbucket.org</a>> wrote:<br>
>> > New issue 825: Creating an all_data object does not generate the<br>
>> > field_info object.<br>
>> ><br>
>> > <a href="https://bitbucket.org/yt_analysis/yt/issue/825/creating-an-all_data-object-does-not" target="_blank">https://bitbucket.org/yt_analysis/yt/issue/825/creating-an-all_data-object-does-not</a><br>
>> ><br>
>> > Nathan Goldbaum:<br>
>> ><br>
>> > The following script and traceback illustrates the issue:<br>
>> ><br>
>> ><br>
>> > ```<br>
>> > #!python<br>
>> ><br>
>> > import yt<br>
>> ><br>
>> > ds = yt.load('IsolatedGalaxy/galaxy0030/galaxy0030')<br>
>> ><br>
>> > ad = ds.all_data()<br>
>> ><br>
>> > print ad.quantities.total_mass()<br>
>> > ```<br>
>> ><br>
>> ><br>
>> > ```<br>
>> >   File "test.py", line 7, in <module><br>
>> >     print ad.quantities.total_mass()<br>
>> >   File<br>
>> > "/Users/goldbaum/Documents/yt-hg/yt/data_objects/derived_quantities.py",<br>
>> > line 188, in __call__<br>
>> >     fi = self.data_source.pf.field_info<br>
>> > AttributeError: 'EnzoDataset' object has no attribute 'field_info'<br>
>> ><br>
>> > ```<br>
>> ><br>
>> > Adding a call to ds.index before the call to the `total_mass` derived<br>
>> > quantity eliminates the error.<br>
>> ><br>
>> ><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>
>> 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>
><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>
</div></div></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>