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

Nathan Goldbaum nathan12343 at gmail.com
Tue Apr 1 17:06:47 PDT 2014


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
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.spacepope.org/pipermail/yt-dev-spacepope.org/attachments/20140401/73731020/attachment.htm>


More information about the yt-dev mailing list