[yt-dev] Issue #825: Creating an all_data object does not generate the field_info object. (yt_analysis/yt)

Matthew Turk matthewturk at gmail.com
Tue Apr 1 17:08:36 PDT 2014


I think so, yes.  That manually instantiates the index.

Now, I guess the bigger question is, *should* this be the fix, or
should we somehow transparently catch this, and pass all the
_get_field_info logic into __getitem__ in the field info container?  I
am torn on that front.

On Tue, Apr 1, 2014 at 8:06 PM, Nathan Goldbaum <nathan12343 at gmail.com> wrote:
> Hi Matt,
>
> So the fix would be to get the field_info via _get_field_info in __call__
> for the derived quantity?
>
> -Natan
>
>
> On Tue, Apr 1, 2014 at 5:04 PM, Matthew Turk <matthewturk at gmail.com> wrote:
>>
>> Hi Nathan,
>>
>> This was by design -- whether that was right or not -- because I
>> wanted to allow all of the objects to be created without requiring an
>> index, until data was accessed.  Specifically this fails because
>> TotalMass accesses field_info directly instead of via _get_field_info.
>>
>> -Matt
>>
>> On Tue, Apr 1, 2014 at 8:02 PM, Nathan Goldbaum
>> <issues-reply at bitbucket.org> wrote:
>> > New issue 825: Creating an all_data object does not generate the
>> > field_info object.
>> >
>> > https://bitbucket.org/yt_analysis/yt/issue/825/creating-an-all_data-object-does-not
>> >
>> > Nathan Goldbaum:
>> >
>> > The following script and traceback illustrates the issue:
>> >
>> >
>> > ```
>> > #!python
>> >
>> > import yt
>> >
>> > ds = yt.load('IsolatedGalaxy/galaxy0030/galaxy0030')
>> >
>> > ad = ds.all_data()
>> >
>> > print ad.quantities.total_mass()
>> > ```
>> >
>> >
>> > ```
>> >   File "test.py", line 7, in <module>
>> >     print ad.quantities.total_mass()
>> >   File
>> > "/Users/goldbaum/Documents/yt-hg/yt/data_objects/derived_quantities.py",
>> > line 188, in __call__
>> >     fi = self.data_source.pf.field_info
>> > AttributeError: 'EnzoDataset' object has no attribute 'field_info'
>> >
>> > ```
>> >
>> > Adding a call to ds.index before the call to the `total_mass` derived
>> > quantity eliminates the error.
>> >
>> >
>> >
>> > _______________________________________________
>> > yt-dev mailing list
>> > yt-dev at lists.spacepope.org
>> > http://lists.spacepope.org/listinfo.cgi/yt-dev-spacepope.org
>> _______________________________________________
>> yt-dev mailing list
>> yt-dev at lists.spacepope.org
>> http://lists.spacepope.org/listinfo.cgi/yt-dev-spacepope.org
>
>
>
> _______________________________________________
> 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