Hello yt users, I would like to know how data is arranged on yt arrays given a data container. For example, if I have a disk data container ds=yt.load(snap) disk=ds.disk(center,normal,(radi,'pc'),(height,'pc')) And I want to obtain the density: dens=disk['dens'] Lets say that gives me a YT.array of shape (4000,). What I would like to know is how the 3D density is storage into this 1D array, for example if the density is storage first along the 'x' axis, then the 'y' axis, and finally the 'z' axis, e.g. : for i in range(x_dims): for j in range(y_dims): for k in range(z_dims): disk['dens'] = density_inside_disk[i,j,k] I don't know where to find that information in the yt source code. Do you know that? I'm not sure if the array disk.icoords provides that information. Cheers,
Hi Guido, The *order* inside that container will be essentially a combination of resolution, IO, etc -- so, basically, not terribly consistent. Within a given data container, the arrays will always be laid out in the same order -- temp and density will be the same order, for instance. You can find out the spatial coordinates by looking at "x", "y", "z", and also .fcoords , but it sounds like what you might want is to reorder it into a 3D array. You can do this by creating a covering grid, but it will include things that are not in the disk object. Hope that helps! -Matt On Fri, Oct 4, 2019 at 3:02 PM Guido Granda Muñoz <guidogranda@gmail.com> wrote:
Hello yt users, I would like to know how data is arranged on yt arrays given a data container. For example, if I have a disk data container
ds=yt.load(snap) disk=ds.disk(center,normal,(radi,'pc'),(height,'pc'))
And I want to obtain the density:
dens=disk['dens']
Lets say that gives me a YT.array of shape (4000,). What I would like to know is how the 3D density is storage into this 1D array, for example if the density is storage first along the 'x' axis, then the 'y' axis, and finally the 'z' axis, e.g. :
for i in range(x_dims): for j in range(y_dims): for k in range(z_dims): disk['dens'] = density_inside_disk[i,j,k]
I don't know where to find that information in the yt source code. Do you know that? I'm not sure if the array disk.icoords provides that information.
Cheers, _______________________________________________ yt-users mailing list -- yt-users@python.org To unsubscribe send an email to yt-users-leave@python.org
Hello Matt, Thank you that information helps. My goal is to compute the magnetic tension in a the data container, the magnetic tension is defined this way: T_{B} = 1/4*pi * (B dot_product Nabla) B Where B in the magnetic field vector and Nabla is the usual differential operator. To compute this quantity I have to estimate partial derivatives of the three components of the magnetic field along each of the three axes. I plan to use the centred partial derivative method. Therefore, for the outermost cells of the data container I'll need information about neighbour cells, which are in fact outside it. So, I guess that what you mentioned, creating a covering grid, is the right approach. How can I create a covering grid ? Cheers,
Hi Guido, You can also do this using a derived field, where you specify the ValidateSpatial option. Th examples in the docs do this for things like divergence/gradient, and that will also calculate the extra zones necessary. On Sun, Oct 6, 2019 at 6:35 PM Guido Granda Muñoz <guidogranda@gmail.com> wrote:
Hello Matt, Thank you that information helps. My goal is to compute the magnetic tension in a the data container, the magnetic tension is defined this way:
T_{B} = 1/4*pi * (B dot_product Nabla) B
Where B in the magnetic field vector and Nabla is the usual differential operator. To compute this quantity I have to estimate partial derivatives of the three components of the magnetic field along each of the three axes.
I plan to use the centred partial derivative method. Therefore, for the outermost cells of the data container I'll need information about neighbour cells, which are in fact outside it. So, I guess that what you mentioned, creating a covering grid, is the right approach. How can I create a covering grid ?
Cheers, _______________________________________________ yt-users mailing list -- yt-users@python.org To unsubscribe send an email to yt-users-leave@python.org
participants (2)
-
Guido Granda Muñoz
-
Matthew Turk