How yt deals with AMR grids and data objects

Dear yt-users
I am attempting to make a tool that will sample the properties of a RAMSES galactic disk simulation. The tools needs to be able to work on different scales going from very large (10kpc) to the very small (2x the size of the smallest cell ~140pc). So far I have achieved this using data objects and calling required property/Quantities that I need. On large scales this works very well, however on small scales I have run into the issue that only part of cells are within in my data object. While this is to be expected it is presenting so interesting results. From what I can tell if the centre of the cell is in my data object yt treats the cell as if the whole cell is within my data object but if the centre is missed it treats it as if the whole cell is absent from the data object, I’m looking for a median between these extremes.
My question is is there a way to get yt to only take into account the proportion of the cell in side my data object?
Also if the cell only has small corner in my data object is there away to get yt to fetch the properties of that cell (say the density and cell volume) and then multiply these values by the proportion of the cell that is in my object?
Thank you in advance for you help
Kearn

Hi Kearn,
Maybe, I'm misunderstanding you, but it sounds like you are trying to map different layers of the RAMSES AMR to a new grid. Then analyse the new grid?
For example, grab the 5 highest levels of refinement in a 20kpc region around the highest density then remap these into a simple Y x Y x Y grid, afterwards properties can be analyzed on the simpler grid. If this sounds analogous to what your're asking for we should chat, because I'm working on this as well.
Alex
On Mon, Dec 16, 2013 at 7:23 AM, k.grisdale@surrey.ac.uk wrote:
Dear yt-users
I am attempting to make a tool that will sample the properties of a RAMSES galactic disk simulation. The tools needs to be able to work on different scales going from very large (10kpc) to the very small (2x the size of the smallest cell ~140pc). So far I have achieved this using data objects and calling required property/Quantities that I need. On large scales this works very well, however on small scales I have run into the issue that only part of cells are within in my data object. While this is to be expected it is presenting so interesting results. From what I can tell if the centre of the cell is in my data object yt treats the cell as if the whole cell is within my data object but if the centre is missed it treats it as if the whole cell is absent from the data object, I’m looking for a median between these extremes.
My question is is there a way to get yt to only take into account the proportion of the cell in side my data object?
Also if the cell only has small corner in my data object is there away to get yt to fetch the properties of that cell (say the density and cell volume) and then multiply these values by the proportion of the cell that is in my object?
Thank you in advance for you help
Kearn _______________________________________________ yt-users mailing list yt-users@lists.spacepope.org http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org

Hi Alex,
I don’t think I explained my self well before. What I am trying to do is create a tool that will allow me to randomly sample a galactic disk to explore the effects of turbulence on different scales. I am aiming to map RAMSES grid to a new grid, more just get a large sample of data points from random locations in a galaxy at each scale size. Sorry if thats not very clear
Kearn On 16 Dec 2013, at 15:39, Alex Bogert <bogart.alex@gmail.commailto:bogart.alex@gmail.com> wrote:
Hi Kearn,
Maybe, I'm misunderstanding you, but it sounds like you are trying to map different layers of the RAMSES AMR to a new grid. Then analyse the new grid?
For example, grab the 5 highest levels of refinement in a 20kpc region around the highest density then remap these into a simple Y x Y x Y grid, afterwards properties can be analyzed on the simpler grid. If this sounds analogous to what your're asking for we should chat, because I'm working on this as well.
Alex
On Mon, Dec 16, 2013 at 7:23 AM, <k.grisdale@surrey.ac.ukmailto:k.grisdale@surrey.ac.uk> wrote: Dear yt-users
I am attempting to make a tool that will sample the properties of a RAMSES galactic disk simulation. The tools needs to be able to work on different scales going from very large (10kpc) to the very small (2x the size of the smallest cell ~140pc). So far I have achieved this using data objects and calling required property/Quantities that I need. On large scales this works very well, however on small scales I have run into the issue that only part of cells are within in my data object. While this is to be expected it is presenting so interesting results. From what I can tell if the centre of the cell is in my data object yt treats the cell as if the whole cell is within my data object but if the centre is missed it treats it as if the whole cell is absent from the data object, I’m looking for a median between these extremes.
My question is is there a way to get yt to only take into account the proportion of the cell in side my data object?
Also if the cell only has small corner in my data object is there away to get yt to fetch the properties of that cell (say the density and cell volume) and then multiply these values by the proportion of the cell that is in my object?
Thank you in advance for you help
Kearn _______________________________________________ yt-users mailing list yt-users@lists.spacepope.orgmailto:yt-users@lists.spacepope.org http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org
_______________________________________________ yt-users mailing list yt-users@lists.spacepope.orgmailto:yt-users@lists.spacepope.org http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org

Hi Kearn,
On Mon, Dec 16, 2013 at 10:23 AM, k.grisdale@surrey.ac.uk wrote:
Dear yt-users
I am attempting to make a tool that will sample the properties of a RAMSES galactic disk simulation. The tools needs to be able to work on different scales going from very large (10kpc) to the very small (2x the size of the smallest cell ~140pc). So far I have achieved this using data objects and calling required property/Quantities that I need. On large scales this works very well, however on small scales I have run into the issue that only part of cells are within in my data object. While this is to be expected it is presenting so interesting results. From what I can tell if the centre of the cell is in my data object yt treats the cell as if the whole cell is within my data object but if the centre is missed it treats it as if the whole cell is absent from the data object, I’m looking for a median between these extremes.
You're right, the cell centers are used for selecting data points in yt.
My question is is there a way to get yt to only take into account the proportion of the cell in side my data object?
Usually they're taken into account via CellVolume weighting or something along those lines.
Also if the cell only has small corner in my data object is there away to get yt to fetch the properties of that cell (say the density and cell volume) and then multiply these values by the proportion of the cell that is in my object?
The data selection won't find the cell, unfortunately, so it might be somewhat tricky to do it using the standard setup. I'd say you might be interested in using a covering grid, which will expand all of the cells into some higher resolution; this will enable them to be cut up and subselected. The format for this is:
cg = pf.h.covering_grid(some_level, left_edge, dimensions)
This will use "some_level" to determine the dx (with respect to level 0) and dimensions and left edge to describe the extent. No interpolation will be conducted. You can then select it and operate on it as you like, and it will have the dict-like querying that other objects do.
-Matt
Thank you in advance for you help
Kearn _______________________________________________ yt-users mailing list yt-users@lists.spacepope.org http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org

As a quick follow up, Alex, the covering grid does *exactly* what you want.
j
On Mon, Dec 16, 2013 at 10:48 AM, Matthew Turk matthewturk@gmail.comwrote:
Hi Kearn,
On Mon, Dec 16, 2013 at 10:23 AM, k.grisdale@surrey.ac.uk wrote:
Dear yt-users
I am attempting to make a tool that will sample the properties of a
RAMSES galactic disk simulation. The tools needs to be able to work on different scales going from very large (10kpc) to the very small (2x the size of the smallest cell ~140pc). So far I have achieved this using data objects and calling required property/Quantities that I need. On large scales this works very well, however on small scales I have run into the issue that only part of cells are within in my data object. While this is to be expected it is presenting so interesting results. From what I can tell if the centre of the cell is in my data object yt treats the cell as if the whole cell is within my data object but if the centre is missed it treats it as if the whole cell is absent from the data object, I’m looking for a median between these extremes.
You're right, the cell centers are used for selecting data points in yt.
My question is is there a way to get yt to only take into account the
proportion of the cell in side my data object?
Usually they're taken into account via CellVolume weighting or something along those lines.
Also if the cell only has small corner in my data object is there away
to get yt to fetch the properties of that cell (say the density and cell volume) and then multiply these values by the proportion of the cell that is in my object?
The data selection won't find the cell, unfortunately, so it might be somewhat tricky to do it using the standard setup. I'd say you might be interested in using a covering grid, which will expand all of the cells into some higher resolution; this will enable them to be cut up and subselected. The format for this is:
cg = pf.h.covering_grid(some_level, left_edge, dimensions)
This will use "some_level" to determine the dx (with respect to level 0) and dimensions and left edge to describe the extent. No interpolation will be conducted. You can then select it and operate on it as you like, and it will have the dict-like querying that other objects do.
-Matt
Thank you in advance for you help
Kearn _______________________________________________ yt-users mailing list yt-users@lists.spacepope.org http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org
yt-users mailing list yt-users@lists.spacepope.org http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org

Yes, I misunderstood what Kern was looking for. I'm trying to do the mapping in "real-time" on the video card. Mimicking something similar to yt's covering grid.
On Mon, Dec 16, 2013 at 7:50 AM, j s oishi jsoishi@gmail.com wrote:
As a quick follow up, Alex, the covering grid does *exactly* what you want.
j
On Mon, Dec 16, 2013 at 10:48 AM, Matthew Turk matthewturk@gmail.comwrote:
Hi Kearn,
On Mon, Dec 16, 2013 at 10:23 AM, k.grisdale@surrey.ac.uk wrote:
Dear yt-users
I am attempting to make a tool that will sample the properties of a
RAMSES galactic disk simulation. The tools needs to be able to work on different scales going from very large (10kpc) to the very small (2x the size of the smallest cell ~140pc). So far I have achieved this using data objects and calling required property/Quantities that I need. On large scales this works very well, however on small scales I have run into the issue that only part of cells are within in my data object. While this is to be expected it is presenting so interesting results. From what I can tell if the centre of the cell is in my data object yt treats the cell as if the whole cell is within my data object but if the centre is missed it treats it as if the whole cell is absent from the data object, I’m looking for a median between these extremes.
You're right, the cell centers are used for selecting data points in yt.
My question is is there a way to get yt to only take into account the
proportion of the cell in side my data object?
Usually they're taken into account via CellVolume weighting or something along those lines.
Also if the cell only has small corner in my data object is there away
to get yt to fetch the properties of that cell (say the density and cell volume) and then multiply these values by the proportion of the cell that is in my object?
The data selection won't find the cell, unfortunately, so it might be somewhat tricky to do it using the standard setup. I'd say you might be interested in using a covering grid, which will expand all of the cells into some higher resolution; this will enable them to be cut up and subselected. The format for this is:
cg = pf.h.covering_grid(some_level, left_edge, dimensions)
This will use "some_level" to determine the dx (with respect to level 0) and dimensions and left edge to describe the extent. No interpolation will be conducted. You can then select it and operate on it as you like, and it will have the dict-like querying that other objects do.
-Matt
Thank you in advance for you help
Kearn _______________________________________________ yt-users mailing list yt-users@lists.spacepope.org http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org
yt-users mailing list yt-users@lists.spacepope.org http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org
yt-users mailing list yt-users@lists.spacepope.org http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org

Hi Matt,
Thanks for your reply.
I will give the covering grid a good. Is there some why I can visualise the grid to inspect the cell sizes or a way to get the size of search cell to make sure that it is doing what I want? (I tried the .annotate_grids() command on a project but this just produced an error)
Thanks again for the help
Kearn On 16 Dec 2013, at 15:48, Matthew Turk matthewturk@gmail.com wrote:
Hi Kearn,
On Mon, Dec 16, 2013 at 10:23 AM, k.grisdale@surrey.ac.uk wrote:
Dear yt-users
I am attempting to make a tool that will sample the properties of a RAMSES galactic disk simulation. The tools needs to be able to work on different scales going from very large (10kpc) to the very small (2x the size of the smallest cell ~140pc). So far I have achieved this using data objects and calling required property/Quantities that I need. On large scales this works very well, however on small scales I have run into the issue that only part of cells are within in my data object. While this is to be expected it is presenting so interesting results. From what I can tell if the centre of the cell is in my data object yt treats the cell as if the whole cell is within my data object but if the centre is missed it treats it as if the whole cell is absent from the data object, I’m looking for a median between these extremes.
You're right, the cell centers are used for selecting data points in yt.
My question is is there a way to get yt to only take into account the proportion of the cell in side my data object?
Usually they're taken into account via CellVolume weighting or something along those lines.
Also if the cell only has small corner in my data object is there away to get yt to fetch the properties of that cell (say the density and cell volume) and then multiply these values by the proportion of the cell that is in my object?
The data selection won't find the cell, unfortunately, so it might be somewhat tricky to do it using the standard setup. I'd say you might be interested in using a covering grid, which will expand all of the cells into some higher resolution; this will enable them to be cut up and subselected. The format for this is:
cg = pf.h.covering_grid(some_level, left_edge, dimensions)
This will use "some_level" to determine the dx (with respect to level 0) and dimensions and left edge to describe the extent. No interpolation will be conducted. You can then select it and operate on it as you like, and it will have the dict-like querying that other objects do.
-Matt
Thank you in advance for you help
Kearn _______________________________________________ yt-users mailing list yt-users@lists.spacepope.org http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org
yt-users mailing list yt-users@lists.spacepope.org http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org

Hi Kearn,
You can manually plot it with matplotlib's imshow command. To verify sizes and positions, "CellVolume", "x", "y", and "z" are all accessible fields.
-Matt
On Mon, Dec 16, 2013 at 11:05 AM, k.grisdale@surrey.ac.uk wrote:
Hi Matt,
Thanks for your reply.
I will give the covering grid a good. Is there some why I can visualise the grid to inspect the cell sizes or a way to get the size of search cell to make sure that it is doing what I want? (I tried the .annotate_grids() command on a project but this just produced an error)
Thanks again for the help
Kearn On 16 Dec 2013, at 15:48, Matthew Turk matthewturk@gmail.com wrote:
Hi Kearn,
On Mon, Dec 16, 2013 at 10:23 AM, k.grisdale@surrey.ac.uk wrote:
Dear yt-users
I am attempting to make a tool that will sample the properties of a RAMSES galactic disk simulation. The tools needs to be able to work on different scales going from very large (10kpc) to the very small (2x the size of the smallest cell ~140pc). So far I have achieved this using data objects and calling required property/Quantities that I need. On large scales this works very well, however on small scales I have run into the issue that only part of cells are within in my data object. While this is to be expected it is presenting so interesting results. From what I can tell if the centre of the cell is in my data object yt treats the cell as if the whole cell is within my data object but if the centre is missed it treats it as if the whole cell is absent from the data object, I’m looking for a median between these extremes.
You're right, the cell centers are used for selecting data points in yt.
My question is is there a way to get yt to only take into account the proportion of the cell in side my data object?
Usually they're taken into account via CellVolume weighting or something along those lines.
Also if the cell only has small corner in my data object is there away to get yt to fetch the properties of that cell (say the density and cell volume) and then multiply these values by the proportion of the cell that is in my object?
The data selection won't find the cell, unfortunately, so it might be somewhat tricky to do it using the standard setup. I'd say you might be interested in using a covering grid, which will expand all of the cells into some higher resolution; this will enable them to be cut up and subselected. The format for this is:
cg = pf.h.covering_grid(some_level, left_edge, dimensions)
This will use "some_level" to determine the dx (with respect to level 0) and dimensions and left edge to describe the extent. No interpolation will be conducted. You can then select it and operate on it as you like, and it will have the dict-like querying that other objects do.
-Matt
Thank you in advance for you help
Kearn _______________________________________________ yt-users mailing list yt-users@lists.spacepope.org http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org
yt-users mailing list yt-users@lists.spacepope.org http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org
yt-users mailing list yt-users@lists.spacepope.org http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org
participants (4)
-
Alex Bogert
-
j s oishi
-
k.grisdale@surrey.ac.uk
-
Matthew Turk