<div dir="ltr"><br><div class="gmail_extra"><br><div class="gmail_quote">On Wed, Jun 24, 2015 at 3:22 PM, Professor Maller <span dir="ltr"><<a href="mailto:amaller@citytech.cuny.edu" target="_blank">amaller@citytech.cuny.edu</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 class="gmail_extra"><div class="gmail_quote">Hi Britton,</div><div class="gmail_quote"><br></div><div class="gmail_quote">Thanks for the help.  I'm getting an error trying to use halo.data_container.</div><div class="gmail_quote"><div class="gmail_quote">     14 hc.add_callback("sphere",factor=1.0)</div><div class="gmail_quote">     15 def _gas_mass(halo):</div><div class="gmail_quote">---> 16     return halo.data_container.quantities.total_quantity("cell_mass")</div><div class="gmail_quote">     17 </div><div class="gmail_quote">     18 add_quantity("gas_mass",_gas_mass)</div><div class="gmail_quote"><br></div><div class="gmail_quote">AttributeError: 'Halo' object has no attribute 'data_container'</div><div class="gmail_quote"><br></div><div class="gmail_quote">I've made my code very simple and am using the example data to debug this. I'm just trying to get the total gas mass for now</div><div class="gmail_quote"><br></div><div class="gmail_quote"><div class="gmail_quote">data_ds = yt.load('Enzo_64/RD0006/RedshiftOutput0006')</div><div class="gmail_quote">halos_ds = yt.load('rockstar_halos/halos_0.0.bin')</div><div class="gmail_quote"><br></div><div class="gmail_quote">def _gas_mass(halo):</div><div class="gmail_quote">    return halo.data_container.quantities.total_quantity("cell_mass")</div></div></div></div></div></blockquote><div><br></div><div>Looking at the code, I think this should be "halo.data_object". You can see the code for the halo_sphere callback in yt/analysis_modules/halo_analysis/halo_callbacks.py, which might be helpful to look at when debugging issues like this.</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div class="gmail_extra"><div class="gmail_quote"><div class="gmail_quote"><div class="gmail_quote"><br></div><div class="gmail_quote">add_quantity("gas_mass",_gas_mass)</div><div class="gmail_quote"><br></div><div class="gmail_quote"># Instantiate a catalog using those two paramter files</div><div class="gmail_quote">hc = HaloCatalog(data_ds=data_ds, halos_ds=halos_ds)</div><div class="gmail_quote"><br></div><div class="gmail_quote">hc.add_callback("sphere",factor=1.0)</div><div class="gmail_quote">hc.add_quantity("gas_mass")</div><div class="gmail_quote">hc.create()</div><div class="gmail_quote"><br></div><div class="gmail_quote">Any help would be appreciated.</div><div class="gmail_quote"><br></div><div class="gmail_quote">Thanks,</div><div class="gmail_quote"><br></div><div class="gmail_quote">Ari</div></div></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" rel="noreferrer" target="_blank">http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org</a><br>
<br></blockquote></div><br></div></div>