<div dir="ltr"><div>Hi Nathan,</div><div><br></div>halo.data_object... does indeed work.  <div><br></div><div>Thanks for the help,</div><div><br></div><div>Ari<br><div class="gmail_extra"><br><div class="gmail_quote">On Thu, Jun 25, 2015 at 11:31 AM,  <span dir="ltr"><<a href="mailto:yt-users-request@lists.spacepope.org" target="_blank">yt-users-request@lists.spacepope.org</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Send yt-users mailing list submissions to<br>
        <a href="mailto:yt-users@lists.spacepope.org">yt-users@lists.spacepope.org</a><br>
<br>
To subscribe or unsubscribe via the World Wide Web, visit<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>
or, via email, send a message with subject or body 'help' to<br>
        <a href="mailto:yt-users-request@lists.spacepope.org">yt-users-request@lists.spacepope.org</a><br>
<br>
You can reach the person managing the list at<br>
        <a href="mailto:yt-users-owner@lists.spacepope.org">yt-users-owner@lists.spacepope.org</a><br>
<br>
When replying, please edit your Subject line so it is more specific<br>
than "Re: Contents of yt-users digest..."<br>
<br>
<br>
Today's Topics:<br>
<br>
   1. Re: adding quantities to halo catalogs (Britton Smith)<br>
      (Professor Maller)<br>
   2. Re: adding quantities to halo catalogs (Britton Smith)<br>
      (Nathan Goldbaum)<br>
   3. Re: convert arbitrary particle based quantities to<br>
      cloud-in-cell mesh (Britton Smith)<br>
   4. Re: convert arbitrary particle based quantities to<br>
      cloud-in-cell mesh (Nathan Goldbaum)<br>
<br>
<br>
----------------------------------------------------------------------<br>
<br>
Message: 1<br>
Date: Wed, 24 Jun 2015 18:22:36 -0400<br>
From: Professor Maller <<a href="mailto:amaller@citytech.cuny.edu">amaller@citytech.cuny.edu</a>><br>
To: <a href="mailto:yt-users@lists.spacepope.org">yt-users@lists.spacepope.org</a><br>
Subject: Re: [yt-users] adding quantities to halo catalogs (Britton<br>
        Smith)<br>
Message-ID:<br>
        <CACCSjdP92HhV0X+p1B_LtZ556UgbZnFUvYXuRE=+<a href="mailto:n-n55w1Kmg@mail.gmail.com">n-n55w1Kmg@mail.gmail.com</a>><br>
Content-Type: text/plain; charset="utf-8"<br>
<br>
Hi Britton,<br>
<br>
Thanks for the help.  I'm getting an error trying to use<br>
halo.data_container.<br>
     14 hc.add_callback("sphere",factor=1.0)<br>
     15 def _gas_mass(halo):<br>
---> 16     return<br>
halo.data_container.quantities.total_quantity("cell_mass")<br>
     17<br>
     18 add_quantity("gas_mass",_gas_mass)<br>
<br>
AttributeError: 'Halo' object has no attribute 'data_container'<br>
<br>
I've made my code very simple and am using the example data to debug this.<br>
I'm just trying to get the total gas mass for now<br>
<br>
data_ds = yt.load('Enzo_64/RD0006/RedshiftOutput0006')<br>
halos_ds = yt.load('rockstar_halos/halos_0.0.bin')<br>
<br>
def _gas_mass(halo):<br>
    return halo.data_container.quantities.total_quantity("cell_mass")<br>
<br>
add_quantity("gas_mass",_gas_mass)<br>
<br>
# Instantiate a catalog using those two paramter files<br>
hc = HaloCatalog(data_ds=data_ds, halos_ds=halos_ds)<br>
<br>
hc.add_callback("sphere",factor=1.0)<br>
hc.add_quantity("gas_mass")<br>
hc.create()<br>
<br>
Any help would be appreciated.<br>
<br>
Thanks,<br>
<br>
Ari<br>
-------------- next part --------------<br>
An HTML attachment was scrubbed...<br>
URL: <<a href="http://lists.spacepope.org/pipermail/yt-users-spacepope.org/attachments/20150624/d663e663/attachment-0001.htm" rel="noreferrer" target="_blank">http://lists.spacepope.org/pipermail/yt-users-spacepope.org/attachments/20150624/d663e663/attachment-0001.htm</a>><br>
<br>
------------------------------<br>
<br>
Message: 2<br>
Date: Wed, 24 Jun 2015 15:28:29 -0700<br>
From: Nathan Goldbaum <<a href="mailto:nathan12343@gmail.com">nathan12343@gmail.com</a>><br>
To: Discussion of the yt analysis package<br>
        <<a href="mailto:yt-users@lists.spacepope.org">yt-users@lists.spacepope.org</a>><br>
Subject: Re: [yt-users] adding quantities to halo catalogs (Britton<br>
        Smith)<br>
Message-ID:<br>
        <CAJXewOnrqCSmYcKv3A-tcnXnmzip22OD8s0KUCotXZ=<a href="mailto:5zKTYmw@mail.gmail.com">5zKTYmw@mail.gmail.com</a>><br>
Content-Type: text/plain; charset="utf-8"<br>
<br>
On Wed, Jun 24, 2015 at 3:22 PM, Professor Maller <<a href="mailto:amaller@citytech.cuny.edu">amaller@citytech.cuny.edu</a><br>
> wrote:<br>
<br>
> Hi Britton,<br>
><br>
> Thanks for the help.  I'm getting an error trying to use<br>
> halo.data_container.<br>
>      14 hc.add_callback("sphere",factor=1.0)<br>
>      15 def _gas_mass(halo):<br>
> ---> 16     return<br>
> halo.data_container.quantities.total_quantity("cell_mass")<br>
>      17<br>
>      18 add_quantity("gas_mass",_gas_mass)<br>
><br>
> AttributeError: 'Halo' object has no attribute 'data_container'<br>
><br>
> I've made my code very simple and am using the example data to debug this.<br>
> I'm just trying to get the total gas mass for now<br>
><br>
> data_ds = yt.load('Enzo_64/RD0006/RedshiftOutput0006')<br>
> halos_ds = yt.load('rockstar_halos/halos_0.0.bin')<br>
><br>
> def _gas_mass(halo):<br>
>     return halo.data_container.quantities.total_quantity("cell_mass")<br>
><br>
<br>
Looking at the code, I think this should be "halo.data_object". You can see<br>
the code for the halo_sphere callback in<br>
yt/analysis_modules/halo_analysis/halo_callbacks.py, which might be helpful<br>
to look at when debugging issues like this.<br>
<br>
<br>
><br>
> add_quantity("gas_mass",_gas_mass)<br>
><br>
> # Instantiate a catalog using those two paramter files<br>
> hc = HaloCatalog(data_ds=data_ds, halos_ds=halos_ds)<br>
><br>
> hc.add_callback("sphere",factor=1.0)<br>
> hc.add_quantity("gas_mass")<br>
> hc.create()<br>
><br>
> Any help would be appreciated.<br>
><br>
> Thanks,<br>
><br>
> Ari<br>
><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>
><br>
-------------- next part --------------<br>
An HTML attachment was scrubbed...<br>
URL: <<a href="http://lists.spacepope.org/pipermail/yt-users-spacepope.org/attachments/20150624/c4747e5e/attachment-0001.htm" rel="noreferrer" target="_blank">http://lists.spacepope.org/pipermail/yt-users-spacepope.org/attachments/20150624/c4747e5e/attachment-0001.htm</a>><br>
<br>
------------------------------<br>
<br>
Message: 3<br>
Date: Thu, 25 Jun 2015 10:54:43 +0100<br>
From: Britton Smith <<a href="mailto:brittonsmith@gmail.com">brittonsmith@gmail.com</a>><br>
To: Discussion of the yt analysis package<br>
        <<a href="mailto:yt-users@lists.spacepope.org">yt-users@lists.spacepope.org</a>><br>
Subject: Re: [yt-users] convert arbitrary particle based quantities to<br>
        cloud-in-cell mesh<br>
Message-ID:<br>
        <CABfs61nm=UCqsA=<a href="mailto:38zS4_Jv%2B-LvDcKdi7d3BS34J-scCLFJg8Q@mail.gmail.com">38zS4_Jv+-LvDcKdi7d3BS34J-scCLFJg8Q@mail.gmail.com</a>><br>
Content-Type: text/plain; charset="utf-8"<br>
<br>
Hi Brendan,<br>
<br>
I would have a look in the yt source in yt/fields/particle_fields.py at the<br>
field functions like particle_mass and particle_cic.  They are good<br>
examples of just how the deposited fields are done.  In addition, there is<br>
a field function, _get_density_weighted_deposit_field, for doing<br>
mass-weighted deposited fields.  I think this is exactly what you're<br>
looking for.  In fact, it seems that mass-weighted velocity fields already<br>
exist as something like ("deposit", "<PTYPE>_sum_velocity_x") or<br>
("deposit", "<PTYPE>_nn_velocity_x").  If you have multiple particle types<br>
for stars and such, they should already be defined with these fields.  This<br>
should give you a template for implementing any other fields of this type.<br>
<br>
Britton<br>
<br>
On Wed, Jun 24, 2015 at 12:28 PM, Brendan Griffen <<br>
<a href="mailto:brendan.f.griffen@gmail.com">brendan.f.griffen@gmail.com</a>> wrote:<br>
<br>
> Hi,<br>
><br>
> I'm looking to convert particle based quantities into a uniform grid based<br>
> quantity (arepo data is input). So say I have a collection of gas elements<br>
> with some density rho and x,y,z positions. I want to construct an 256^3<br>
> mesh representing the cells in a mesh.<br>
><br>
> x,y,z,rho --> cic mesh where the values at i,j,k is the smoothed density<br>
> are created by the cic algorithm<br>
><br>
> Now, generalising this more, can I have rho to be any quantity? So now say<br>
> I have star particles which similarly have x,y,z but I want to distribute<br>
> their luminosity. Again, I want to do it for say the gas velocity field as<br>
> well. Is there any general functionality for converting particle quantities<br>
> to mesh quantites in yt with the deposit all_cic functionality? I have a<br>
> basic code for just x,y,z particle data and distributing that based on<br>
> density to a cic (see below)<br>
><br>
> ad = pf.all_data()<br>
> level = int(math.log(ndim,2))<br>
> cg = pf.covering_grid(level=level, left_edge=[0,0,0],dims=[ndim,ndim,ndim])<br>
> arr = cg['deposit', 'all_cic'],<br>
><br>
> but I'm not sure what to do for the other variables. Any help is<br>
> appreciated in advance.<br>
><br>
> Thanks.<br>
> Brendan<br>
><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>
><br>
-------------- next part --------------<br>
An HTML attachment was scrubbed...<br>
URL: <<a href="http://lists.spacepope.org/pipermail/yt-users-spacepope.org/attachments/20150625/39d7044c/attachment-0001.htm" rel="noreferrer" target="_blank">http://lists.spacepope.org/pipermail/yt-users-spacepope.org/attachments/20150625/39d7044c/attachment-0001.htm</a>><br>
<br>
------------------------------<br>
<br>
Message: 4<br>
Date: Thu, 25 Jun 2015 08:31:48 -0700<br>
From: Nathan Goldbaum <<a href="mailto:nathan12343@gmail.com">nathan12343@gmail.com</a>><br>
To: Discussion of the yt analysis package<br>
        <<a href="mailto:yt-users@lists.spacepope.org">yt-users@lists.spacepope.org</a>><br>
Subject: Re: [yt-users] convert arbitrary particle based quantities to<br>
        cloud-in-cell mesh<br>
Message-ID:<br>
        <<a href="mailto:CAJXewOkuA2QTS%2Bqas%2BVsEzKLD_ZUvh-ie88n-NjvQqRtPCkWpA@mail.gmail.com">CAJXewOkuA2QTS+qas+VsEzKLD_ZUvh-ie88n-NjvQqRtPCkWpA@mail.gmail.com</a>><br>
Content-Type: text/plain; charset="utf-8"<br>
<br>
In the latest dev version of yt, there is a ds.add_deposited_particle_field<br>
function attached to all dataset instances that automates the workflow<br>
Britton suggests.<br>
<br>
On Thursday, June 25, 2015, Britton Smith <<a href="mailto:brittonsmith@gmail.com">brittonsmith@gmail.com</a>> wrote:<br>
<br>
> Hi Brendan,<br>
><br>
> I would have a look in the yt source in yt/fields/particle_fields.py at<br>
> the field functions like particle_mass and particle_cic.  They are good<br>
> examples of just how the deposited fields are done.  In addition, there is<br>
> a field function, _get_density_weighted_deposit_field, for doing<br>
> mass-weighted deposited fields.  I think this is exactly what you're<br>
> looking for.  In fact, it seems that mass-weighted velocity fields already<br>
> exist as something like ("deposit", "<PTYPE>_sum_velocity_x") or<br>
> ("deposit", "<PTYPE>_nn_velocity_x").  If you have multiple particle types<br>
> for stars and such, they should already be defined with these fields.  This<br>
> should give you a template for implementing any other fields of this type.<br>
><br>
> Britton<br>
><br>
> On Wed, Jun 24, 2015 at 12:28 PM, Brendan Griffen <<br>
> <a href="mailto:brendan.f.griffen@gmail.com">brendan.f.griffen@gmail.com</a><br>
> <javascript:_e(%7B%7D,'cvml','<a href="mailto:brendan.f.griffen@gmail.com">brendan.f.griffen@gmail.com</a>');>> wrote:<br>
><br>
>> Hi,<br>
>><br>
>> I'm looking to convert particle based quantities into a uniform grid<br>
>> based quantity (arepo data is input). So say I have a collection of gas<br>
>> elements with some density rho and x,y,z positions. I want to construct an<br>
>> 256^3 mesh representing the cells in a mesh.<br>
>><br>
>> x,y,z,rho --> cic mesh where the values at i,j,k is the smoothed density<br>
>> are created by the cic algorithm<br>
>><br>
>> Now, generalising this more, can I have rho to be any quantity? So now<br>
>> say I have star particles which similarly have x,y,z but I want to<br>
>> distribute their luminosity. Again, I want to do it for say the gas<br>
>> velocity field as well. Is there any general functionality for converting<br>
>> particle quantities to mesh quantites in yt with the deposit all_cic<br>
>> functionality? I have a basic code for just x,y,z particle data and<br>
>> distributing that based on density to a cic (see below)<br>
>><br>
>> ad = pf.all_data()<br>
>> level = int(math.log(ndim,2))<br>
>> cg = pf.covering_grid(level=level,<br>
>> left_edge=[0,0,0],dims=[ndim,ndim,ndim])<br>
>> arr = cg['deposit', 'all_cic'],<br>
>><br>
>> but I'm not sure what to do for the other variables. Any help is<br>
>> appreciated in advance.<br>
>><br>
>> Thanks.<br>
>> Brendan<br>
>><br>
>> _______________________________________________<br>
>> yt-users mailing list<br>
>> <a href="mailto:yt-users@lists.spacepope.org">yt-users@lists.spacepope.org</a><br>
>> <javascript:_e(%7B%7D,'cvml','<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>
>><br>
><br>
-------------- next part --------------<br>
An HTML attachment was scrubbed...<br>
URL: <<a href="http://lists.spacepope.org/pipermail/yt-users-spacepope.org/attachments/20150625/4d579ff3/attachment.htm" rel="noreferrer" target="_blank">http://lists.spacepope.org/pipermail/yt-users-spacepope.org/attachments/20150625/4d579ff3/attachment.htm</a>><br>
<br>
------------------------------<br>
<br>
Subject: Digest Footer<br>
<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>
<br>
------------------------------<br>
<br>
End of yt-users Digest, Vol 88, Issue 55<br>
****************************************<br>
</blockquote></div><br></div></div></div>