convert arbitrary particle based quantities to cloudincell mesh
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
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 massweighted deposited fields. I think this is exactly what you're looking for. In fact, it seems that massweighted 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@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
_______________________________________________ ytusers mailing list ytusers@lists.spacepope.org http://lists.spacepope.org/listinfo.cgi/ytusersspacepope.org
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
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 massweighted deposited fields. I think this is exactly what you're looking for. In fact, it seems that massweighted 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@gmail.com javascript:_e(%7B%7D,'cvml','brendan.f.griffen@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
_______________________________________________ ytusers mailing list ytusers@lists.spacepope.org javascript:_e(%7B%7D,'cvml','ytusers@lists.spacepope.org'); http://lists.spacepope.org/listinfo.cgi/ytusersspacepope.org
Hi Nathan,
Is there an example of how one might do this for say an array which
contains particle based x,y,z (for an arepo cell) and some arbitrary other
quantity of the same length (e.g. HI density, velocity magnitudes etc.)?
Seems like you can only do it if you've loaded the data through yt. I
wanted to load in the quantities using my tools as numpy arrays then feed
that into the deposition.
Thanks.
Brendan
On Thu, Jun 25, 2015 at 11:31 AM, Nathan Goldbaum
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
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 massweighted deposited fields. I think this is exactly what you're looking for. In fact, it seems that massweighted 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@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
_______________________________________________ ytusers mailing list ytusers@lists.spacepope.org http://lists.spacepope.org/listinfo.cgi/ytusersspacepope.org
_______________________________________________ ytusers mailing list ytusers@lists.spacepope.org http://lists.spacepope.org/listinfo.cgi/ytusersspacepope.org
Hi Brendan, The CIC deposition routines *themselves* are subject to change and not necessarily API stable. You can try using them and the raw routines, but they may be subject to changes. Matt On Wed, Aug 19, 2015 at 1:02 PM, Brendan Griffen < brendan.f.griffen@gmail.com> wrote:
Hi Nathan,
Is there an example of how one might do this for say an array which contains particle based x,y,z (for an arepo cell) and some arbitrary other quantity of the same length (e.g. HI density, velocity magnitudes etc.)? Seems like you can only do it if you've loaded the data through yt. I wanted to load in the quantities using my tools as numpy arrays then feed that into the deposition.
Thanks. Brendan
On Thu, Jun 25, 2015 at 11:31 AM, Nathan Goldbaum
wrote: 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
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 massweighted deposited fields. I think this is exactly what you're looking for. In fact, it seems that massweighted 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@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
_______________________________________________ ytusers mailing list ytusers@lists.spacepope.org http://lists.spacepope.org/listinfo.cgi/ytusersspacepope.org
_______________________________________________ ytusers mailing list ytusers@lists.spacepope.org http://lists.spacepope.org/listinfo.cgi/ytusersspacepope.org
_______________________________________________ ytusers mailing list ytusers@lists.spacepope.org http://lists.spacepope.org/listinfo.cgi/ytusersspacepope.org
And maybe you need to clarify what you mean by "loading the data using my
tools". Are you ever creating a yt Dataset object? If not, then Matt's
proviso about using yt's internal APIs applies. If you're creating a fake
in memory yt dataset using e.g. load_particles, then you should be able to
use 'add_deposited_particle_field` as I suggested in my email above.
On Wed, Aug 19, 2015 at 1:08 PM, Matthew Turk
Hi Brendan,
The CIC deposition routines *themselves* are subject to change and not necessarily API stable. You can try using them and the raw routines, but they may be subject to changes.
Matt
On Wed, Aug 19, 2015 at 1:02 PM, Brendan Griffen < brendan.f.griffen@gmail.com> wrote:
Hi Nathan,
Is there an example of how one might do this for say an array which contains particle based x,y,z (for an arepo cell) and some arbitrary other quantity of the same length (e.g. HI density, velocity magnitudes etc.)? Seems like you can only do it if you've loaded the data through yt. I wanted to load in the quantities using my tools as numpy arrays then feed that into the deposition.
Thanks. Brendan
On Thu, Jun 25, 2015 at 11:31 AM, Nathan Goldbaum
wrote: 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
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 massweighted deposited fields. I think this is exactly what you're looking for. In fact, it seems that massweighted 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@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
_______________________________________________ ytusers mailing list ytusers@lists.spacepope.org http://lists.spacepope.org/listinfo.cgi/ytusersspacepope.org
_______________________________________________ ytusers mailing list ytusers@lists.spacepope.org http://lists.spacepope.org/listinfo.cgi/ytusersspacepope.org
_______________________________________________ ytusers mailing list ytusers@lists.spacepope.org http://lists.spacepope.org/listinfo.cgi/ytusersspacepope.org
_______________________________________________ ytusers mailing list ytusers@lists.spacepope.org http://lists.spacepope.org/listinfo.cgi/ytusersspacepope.org
participants (4)

Brendan Griffen

Britton Smith

Matthew Turk

Nathan Goldbaum