[yt-users] adding quantities to halo catalogs

Professor Maller amaller at citytech.cuny.edu
Thu Jun 25 09:02:21 PDT 2015


Hi Nathan,

halo.data_object... does indeed work.

Thanks for the help,

Ari

On Thu, Jun 25, 2015 at 11:31 AM, <yt-users-request at lists.spacepope.org>
wrote:

> Send yt-users mailing list submissions to
>         yt-users at lists.spacepope.org
>
> To subscribe or unsubscribe via the World Wide Web, visit
>         http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org
> or, via email, send a message with subject or body 'help' to
>         yt-users-request at lists.spacepope.org
>
> You can reach the person managing the list at
>         yt-users-owner at lists.spacepope.org
>
> When replying, please edit your Subject line so it is more specific
> than "Re: Contents of yt-users digest..."
>
>
> Today's Topics:
>
>    1. Re: adding quantities to halo catalogs (Britton Smith)
>       (Professor Maller)
>    2. Re: adding quantities to halo catalogs (Britton Smith)
>       (Nathan Goldbaum)
>    3. Re: convert arbitrary particle based quantities to
>       cloud-in-cell mesh (Britton Smith)
>    4. Re: convert arbitrary particle based quantities to
>       cloud-in-cell mesh (Nathan Goldbaum)
>
>
> ----------------------------------------------------------------------
>
> Message: 1
> Date: Wed, 24 Jun 2015 18:22:36 -0400
> From: Professor Maller <amaller at citytech.cuny.edu>
> To: yt-users at lists.spacepope.org
> Subject: Re: [yt-users] adding quantities to halo catalogs (Britton
>         Smith)
> Message-ID:
>         <CACCSjdP92HhV0X+p1B_LtZ556UgbZnFUvYXuRE=+
> n-n55w1Kmg at mail.gmail.com>
> Content-Type: text/plain; charset="utf-8"
>
> 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")
>
> 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
> -------------- next part --------------
> An HTML attachment was scrubbed...
> URL: <
> http://lists.spacepope.org/pipermail/yt-users-spacepope.org/attachments/20150624/d663e663/attachment-0001.htm
> >
>
> ------------------------------
>
> Message: 2
> Date: Wed, 24 Jun 2015 15:28:29 -0700
> From: Nathan Goldbaum <nathan12343 at gmail.com>
> To: Discussion of the yt analysis package
>         <yt-users at lists.spacepope.org>
> Subject: Re: [yt-users] adding quantities to halo catalogs (Britton
>         Smith)
> Message-ID:
>         <CAJXewOnrqCSmYcKv3A-tcnXnmzip22OD8s0KUCotXZ=
> 5zKTYmw at mail.gmail.com>
> Content-Type: text/plain; charset="utf-8"
>
> 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-0001.htm
> >
>
> ------------------------------
>
> Message: 3
> Date: Thu, 25 Jun 2015 10:54:43 +0100
> From: Britton Smith <brittonsmith at gmail.com>
> To: Discussion of the yt analysis package
>         <yt-users at lists.spacepope.org>
> Subject: Re: [yt-users] convert arbitrary particle based quantities to
>         cloud-in-cell mesh
> Message-ID:
>         <CABfs61nm=UCqsA=
> 38zS4_Jv+-LvDcKdi7d3BS34J-scCLFJg8Q at mail.gmail.com>
> Content-Type: text/plain; charset="utf-8"
>
> Hi Brendan,
>
> I would have a look in the yt source in yt/fields/particle_fields.py at the
> field functions like particle_mass and particle_cic.  They are good
> examples of just how the deposited fields are done.  In addition, there is
> a field function, _get_density_weighted_deposit_field, for doing
> mass-weighted deposited fields.  I think this is exactly what you're
> looking for.  In fact, it seems that mass-weighted velocity fields already
> exist as something like ("deposit", "<PTYPE>_sum_velocity_x") or
> ("deposit", "<PTYPE>_nn_velocity_x").  If you have multiple particle types
> for stars and such, they should already be defined with these fields.  This
> should give you a template for implementing any other fields of this type.
>
> Britton
>
> On Wed, Jun 24, 2015 at 12:28 PM, Brendan Griffen <
> brendan.f.griffen at gmail.com> wrote:
>
> > Hi,
> >
> > I'm looking to convert particle based quantities into a uniform grid
> based
> > quantity (arepo data is input). So say I have a collection of gas
> elements
> > with some density rho and x,y,z positions. I want to construct an 256^3
> > mesh representing the cells in a mesh.
> >
> > x,y,z,rho --> cic mesh where the values at i,j,k is the smoothed density
> > are created by the cic algorithm
> >
> > Now, generalising this more, can I have rho to be any quantity? So now
> say
> > I have star particles which similarly have x,y,z but I want to distribute
> > their luminosity. Again, I want to do it for say the gas velocity field
> as
> > well. Is there any general functionality for converting particle
> quantities
> > to mesh quantites in yt with the deposit all_cic functionality? I have a
> > basic code for just x,y,z particle data and distributing that based on
> > density to a cic (see below)
> >
> > ad = pf.all_data()
> > level = int(math.log(ndim,2))
> > cg = pf.covering_grid(level=level,
> left_edge=[0,0,0],dims=[ndim,ndim,ndim])
> > arr = cg['deposit', 'all_cic'],
> >
> > but I'm not sure what to do for the other variables. Any help is
> > appreciated in advance.
> >
> > Thanks.
> > Brendan
> >
> > _______________________________________________
> > 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/20150625/39d7044c/attachment-0001.htm
> >
>
> ------------------------------
>
> Message: 4
> Date: Thu, 25 Jun 2015 08:31:48 -0700
> From: Nathan Goldbaum <nathan12343 at gmail.com>
> To: Discussion of the yt analysis package
>         <yt-users at lists.spacepope.org>
> Subject: Re: [yt-users] convert arbitrary particle based quantities to
>         cloud-in-cell mesh
> Message-ID:
>         <
> CAJXewOkuA2QTS+qas+VsEzKLD_ZUvh-ie88n-NjvQqRtPCkWpA at mail.gmail.com>
> Content-Type: text/plain; charset="utf-8"
>
> In the latest dev version of yt, there is a ds.add_deposited_particle_field
> function attached to all dataset instances that automates the workflow
> Britton suggests.
>
> On Thursday, June 25, 2015, Britton Smith <brittonsmith at gmail.com> wrote:
>
> > Hi Brendan,
> >
> > I would have a look in the yt source in yt/fields/particle_fields.py at
> > the field functions like particle_mass and particle_cic.  They are good
> > examples of just how the deposited fields are done.  In addition, there
> is
> > a field function, _get_density_weighted_deposit_field, for doing
> > mass-weighted deposited fields.  I think this is exactly what you're
> > looking for.  In fact, it seems that mass-weighted velocity fields
> already
> > exist as something like ("deposit", "<PTYPE>_sum_velocity_x") or
> > ("deposit", "<PTYPE>_nn_velocity_x").  If you have multiple particle
> types
> > for stars and such, they should already be defined with these fields.
> This
> > should give you a template for implementing any other fields of this
> type.
> >
> > Britton
> >
> > On Wed, Jun 24, 2015 at 12:28 PM, Brendan Griffen <
> > brendan.f.griffen at gmail.com
> > <javascript:_e(%7B%7D,'cvml','brendan.f.griffen at gmail.com');>> wrote:
> >
> >> Hi,
> >>
> >> I'm looking to convert particle based quantities into a uniform grid
> >> based quantity (arepo data is input). So say I have a collection of gas
> >> elements with some density rho and x,y,z positions. I want to construct
> an
> >> 256^3 mesh representing the cells in a mesh.
> >>
> >> x,y,z,rho --> cic mesh where the values at i,j,k is the smoothed density
> >> are created by the cic algorithm
> >>
> >> Now, generalising this more, can I have rho to be any quantity? So now
> >> say I have star particles which similarly have x,y,z but I want to
> >> distribute their luminosity. Again, I want to do it for say the gas
> >> velocity field as well. Is there any general functionality for
> converting
> >> particle quantities to mesh quantites in yt with the deposit all_cic
> >> functionality? I have a basic code for just x,y,z particle data and
> >> distributing that based on density to a cic (see below)
> >>
> >> ad = pf.all_data()
> >> level = int(math.log(ndim,2))
> >> cg = pf.covering_grid(level=level,
> >> left_edge=[0,0,0],dims=[ndim,ndim,ndim])
> >> arr = cg['deposit', 'all_cic'],
> >>
> >> but I'm not sure what to do for the other variables. Any help is
> >> appreciated in advance.
> >>
> >> Thanks.
> >> Brendan
> >>
> >> _______________________________________________
> >> yt-users mailing list
> >> yt-users at lists.spacepope.org
> >> <javascript:_e(%7B%7D,'cvml','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/20150625/4d579ff3/attachment.htm
> >
>
> ------------------------------
>
> Subject: Digest Footer
>
> _______________________________________________
> yt-users mailing list
> yt-users at lists.spacepope.org
> http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org
>
>
> ------------------------------
>
> End of yt-users Digest, Vol 88, Issue 55
> ****************************************
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.spacepope.org/pipermail/yt-users-spacepope.org/attachments/20150625/f08b708a/attachment.htm>


More information about the yt-users mailing list