[yt-users] adding quantities to halo catalogs (Britton Smith)

Nathan Goldbaum nathan12343 at gmail.com
Wed Jun 24 15:28:29 PDT 2015


On Wed, Jun 24, 2015 at 3:22 PM, Professor Maller <amaller at citytech.cuny.edu
> wrote:

> Hi Britton,
>
> Thanks for the help.  I'm getting an error trying to use
> halo.data_container.
>      14 hc.add_callback("sphere",factor=1.0)
>      15 def _gas_mass(halo):
> ---> 16     return
> halo.data_container.quantities.total_quantity("cell_mass")
>      17
>      18 add_quantity("gas_mass",_gas_mass)
>
> AttributeError: 'Halo' object has no attribute 'data_container'
>
> 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
>
> data_ds = yt.load('Enzo_64/RD0006/RedshiftOutput0006')
> halos_ds = yt.load('rockstar_halos/halos_0.0.bin')
>
> def _gas_mass(halo):
>     return halo.data_container.quantities.total_quantity("cell_mass")
>

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.


>
> add_quantity("gas_mass",_gas_mass)
>
> # Instantiate a catalog using those two paramter files
> hc = HaloCatalog(data_ds=data_ds, halos_ds=halos_ds)
>
> hc.add_callback("sphere",factor=1.0)
> hc.add_quantity("gas_mass")
> hc.create()
>
> Any help would be appreciated.
>
> Thanks,
>
> Ari
>
> _______________________________________________
> yt-users mailing list
> yt-users at lists.spacepope.org
> http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.spacepope.org/pipermail/yt-users-spacepope.org/attachments/20150624/c4747e5e/attachment.html>


More information about the yt-users mailing list