ACCESSING DATA AS IT IS
Hi, I would like to access data from Ramses as it is because I would want to divide my selected region into subgrids and compute some quantity locally in those subgrids. However, using all_data or ds.r would rearrange the information as it flattens the data (please correct me if I got this wrong). Is there a way in yt, where I can simply access the 3D data as it is and divide into subcubes? Thank you.
Hi, So the most straightforward way to do something like this is to make a derived field that requests ghost zones. Unfortunately that won't work with RAMSES data at the moment due to https://github.com/yt-project/yt/issues/1051. Also for Octree AMR data there isn't really a good way to get at individual octs or to search the octree directly. That said, an approach that might work practically for your use case would be generate a uniform resolution grid using the covering_grid or arbitrary_grid data objects, and then calculate the velocity dispersion or whatever other statistic you're looking for that needs a stencil on the AMR data after it's been interpolated onto a uniform resolution grid. Sorry to not have a nicer answer for you, it's possible someone else might have other ideas. -Nathan On Mon, Oct 22, 2018 at 11:54 PM Vadlamani Samhitha < vadlamani.samhitha@gmail.com> wrote:
Hi,
I would like to access data from Ramses as it is because I would want to divide my selected region into subgrids and compute some quantity locally in those subgrids. However, using all_data or ds.r would rearrange the information as it flattens the data (please correct me if I got this wrong). Is there a way in yt, where I can simply access the 3D data as it is and divide into subcubes? Thank you. _______________________________________________ yt-users mailing list -- yt-users@python.org To unsubscribe send an email to yt-users-leave@python.org
Hi, I'm using the following lines to access the data with 8 AMR levels (min level=7 ; max level = 15) and I have an issue:
dd=ds.covering_grid(level=7, left_edge=[((com_x_1.value-30), "kpc" ),((com_y_1.value-30), "kpc"),((com_z_1.value-30), "kpc")], dims=ds.domain_dimensions * 2**7)
print(dd["velocity_x"].shape) error:
dd=ds.covering_grid(level=7, left_edge=[((com_x_1.value-30), "kpc"),((com_y_1.value-30), "kpc"),((com_z_1.value-30), "kpc")], dims=ds.domain_dimensions * 2**7)
File "/home/samvad/yt-conda/lib/python3.6/site-packages/yt/data_objects/construction_data_containers.py", line 542, in __init__ self.left_edge = self._sanitize_edge(left_edge) File "/home/samvad/yt-conda/lib/python3.6/site-packages/yt/data_objects/construction_data_containers.py", line 604, in _sanitize_edge return self.ds.arr(edge, edge_units) File "/home/samvad/yt-conda/lib/python3.6/site-packages/yt/units/yt_array.py", line 500, in __new__ obj = np.asarray(input_array, dtype=dtype).view(cls) File "/home/samvad/yt-conda/lib/python3.6/site-packages/numpy/core/numeric.py", line 492, in asarray return array(a, dtype, copy=False, order=order) ValueError: could not convert string to float: 'kpc'
Is this not how I specify the limits in physical units? I also tried to add
a right_edge argument but that doesn't seem to work as well. Is there a way
I can specify both left_edge and right_edge to bound the data?
On Tue, Oct 23, 2018 at 4:00 PM Nathan Goldbaum
Hi,
So the most straightforward way to do something like this is to make a derived field that requests ghost zones.
Unfortunately that won't work with RAMSES data at the moment due to https://github.com/yt-project/yt/issues/1051. Also for Octree AMR data there isn't really a good way to get at individual octs or to search the octree directly.
That said, an approach that might work practically for your use case would be generate a uniform resolution grid using the covering_grid or arbitrary_grid data objects, and then calculate the velocity dispersion or whatever other statistic you're looking for that needs a stencil on the AMR data after it's been interpolated onto a uniform resolution grid.
Sorry to not have a nicer answer for you, it's possible someone else might have other ideas.
-Nathan
On Mon, Oct 22, 2018 at 11:54 PM Vadlamani Samhitha < vadlamani.samhitha@gmail.com> wrote:
Hi,
I would like to access data from Ramses as it is because I would want to divide my selected region into subgrids and compute some quantity locally in those subgrids. However, using all_data or ds.r would rearrange the information as it flattens the data (please correct me if I got this wrong). Is there a way in yt, where I can simply access the 3D data as it is and divide into subcubes? Thank you. _______________________________________________ yt-users mailing list -- yt-users@python.org To unsubscribe send an email to yt-users-leave@python.org
_______________________________________________ yt-users mailing list -- yt-users@python.org To unsubscribe send an email to yt-users-leave@python.org
Try applying the units before you pass the data in, e.g.: from yt.units import kpc left_edge = [1,2,3]*kpc If you want to specify explicit left and right edges you should probably be using the arbitrary_grid data object, which takes right_edge as a keyword argument. The covering_grid interpolates data in a manner that is “locked” to the original AMR hierarchy, so it doesn’t let you soecify a right edge, instead you specify the integer dimensions of the grid. On Wed, Oct 24, 2018 at 1:26 AM Vadlamani Samhitha < vadlamani.samhitha@gmail.com> wrote:
Hi, I'm using the following lines to access the data with 8 AMR levels (min level=7 ; max level = 15) and I have an issue:
dd=ds.covering_grid(level=7, left_edge=[((com_x_1.value-30), "kpc" ),((com_y_1.value-30), "kpc"),((com_z_1.value-30), "kpc")], dims=ds.domain_dimensions * 2**7)
print(dd["velocity_x"].shape)
error:
dd=ds.covering_grid(level=7, left_edge=[((com_x_1.value-30), "kpc"),((com_y_1.value-30), "kpc"),((com_z_1.value-30), "kpc")], dims=ds.domain_dimensions * 2**7)
File "/home/samvad/yt-conda/lib/python3.6/site-packages/yt/data_objects/construction_data_containers.py", line 542, in __init__
self.left_edge = self._sanitize_edge(left_edge)
File "/home/samvad/yt-conda/lib/python3.6/site-packages/yt/data_objects/construction_data_containers.py", line 604, in _sanitize_edge
return self.ds.arr(edge, edge_units)
File "/home/samvad/yt-conda/lib/python3.6/site-packages/yt/units/yt_array.py", line 500, in __new__
obj = np.asarray(input_array, dtype=dtype).view(cls)
File "/home/samvad/yt-conda/lib/python3.6/site-packages/numpy/core/numeric.py", line 492, in asarray
return array(a, dtype, copy=False, order=order)
ValueError: could not convert string to float: 'kpc'
Is this not how I specify the limits in physical units? I also tried to add a right_edge argument but that doesn't seem to work as well. Is there a way I can specify both left_edge and right_edge to bound the data?
On Tue, Oct 23, 2018 at 4:00 PM Nathan Goldbaum
wrote: Hi,
So the most straightforward way to do something like this is to make a derived field that requests ghost zones.
Unfortunately that won't work with RAMSES data at the moment due to https://github.com/yt-project/yt/issues/1051. Also for Octree AMR data there isn't really a good way to get at individual octs or to search the octree directly.
That said, an approach that might work practically for your use case would be generate a uniform resolution grid using the covering_grid or arbitrary_grid data objects, and then calculate the velocity dispersion or whatever other statistic you're looking for that needs a stencil on the AMR data after it's been interpolated onto a uniform resolution grid.
Sorry to not have a nicer answer for you, it's possible someone else might have other ideas.
-Nathan
On Mon, Oct 22, 2018 at 11:54 PM Vadlamani Samhitha < vadlamani.samhitha@gmail.com> wrote:
Hi,
I would like to access data from Ramses as it is because I would want to divide my selected region into subgrids and compute some quantity locally in those subgrids. However, using all_data or ds.r would rearrange the information as it flattens the data (please correct me if I got this wrong). Is there a way in yt, where I can simply access the 3D data as it is and divide into subcubes? Thank you. _______________________________________________ yt-users mailing list -- yt-users@python.org To unsubscribe send an email to yt-users-leave@python.org
_______________________________________________ yt-users mailing list -- yt-users@python.org To unsubscribe send an email to yt-users-leave@python.org
_______________________________________________ yt-users mailing list -- yt-users@python.org To unsubscribe send an email to yt-users-leave@python.org
participants (2)
-
Nathan Goldbaum
-
Vadlamani Samhitha