
Dear all, Is there a simple way to create a data set with lower AMR levels? something like: ds = yt.load(fname, max_level=3) I knew that there is an example to down sample for volume rendering with AMRKDTree, but I don't know how to create a downsample data set which can be analysis and plot with SlicePlot, for example. http://yt-project.org/docs/dev/cookbook/complex_plots.html#downsampling-data... Many thanks, Kuo-Chuan

Hi Kuo-Chuan, The trick is to generate a slice data object and then use that data object to create the SlicePlot: import yt ds = yt.load('IsolatedGalaxy/galaxy0030/galaxy0030') slc = ds.slice('x', 0.5) slc.max_level = 2 plot = slc.to_pw('density') plot.show() This will generate a plot of 'density' sampled at a maximum AMR level of 2: https://i.imgur.com/e1ACv2C.png Note that all yt data objects support both a min_level and max_level attribute to control the levels at which data selection happens. Hope that helps, Nathan On Wed, Mar 21, 2018 at 10:01 AM, Kuo-Chuan Pan <astroodie@gmail.com> wrote:
Dear all,
Is there a simple way to create a data set with lower AMR levels? something like: ds = yt.load(fname, max_level=3)
I knew that there is an example to down sample for volume rendering with AMRKDTree, but I don't know how to create a downsample data set which can be analysis and plot with SlicePlot, for example. http://yt-project.org/docs/dev/cookbook/complex_plots. html#downsampling-data-for-volume-rendering
Many thanks, Kuo-Chuan _______________________________________________ yt-users mailing list -- yt-users@python.org To unsubscribe send an email to yt-users-leave@python.org

Dear Nathan, Thank you very much. This is very useful! I got an error that: AttributeError: 'AxisAlignedSlicePlot' object has no attribute 'to_pw' Another thing, when use down sample for data analysis. I find that dd = ds.all_data() print(dd[“density”].shape) Is the same as dd.max_level = 2 print(dd[“density”].shape) Do I miss anything? Many thanks, Kuo-Chuan
On Mar 21, 2018, at 12:44 PM, Nathan Goldbaum <nathan12343@gmail.com> wrote:
Hi Kuo-Chuan,
The trick is to generate a slice data object and then use that data object to create the SlicePlot:
import yt
ds = yt.load('IsolatedGalaxy/galaxy0030/galaxy0030')
slc = ds.slice('x', 0.5) slc.max_level = 2
plot = slc.to_pw('density') plot.show()
This will generate a plot of 'density' sampled at a maximum AMR level of 2:
https://i.imgur.com/e1ACv2C.png <https://urldefense.proofpoint.com/v2/url?u=https-3A__i.imgur.com_e1ACv2C.png&d=DwMFaQ&c=nE__W8dFE-shTxStwXtp0A&r=YmdhaqofMrF5BIO_XIl0Yg&m=wJ5AdaXo6IeW4xWFGIJnPtf3pLpCKM5a5knsmP9EAuo&s=vz9NUwIwSHbxIUciGE7pKpzEWejFFFR3rpQAc7OZ6b4&e=>
Note that all yt data objects support both a min_level and max_level attribute to control the levels at which data selection happens.
Hope that helps,
Nathan
On Wed, Mar 21, 2018 at 10:01 AM, Kuo-Chuan Pan <astroodie@gmail.com <mailto:astroodie@gmail.com>> wrote: Dear all,
Is there a simple way to create a data set with lower AMR levels? something like: ds = yt.load(fname, max_level=3)
I knew that there is an example to down sample for volume rendering with AMRKDTree, but I don't know how to create a downsample data set which can be analysis and plot with SlicePlot, for example. http://yt-project.org/docs/dev/cookbook/complex_plots.html#downsampling-data... <https://urldefense.proofpoint.com/v2/url?u=http-3A__yt-2Dproject.org_docs_dev_cookbook_complex-5Fplots.html-23downsampling-2Ddata-2Dfor-2Dvolume-2Drendering&d=DwMFaQ&c=nE__W8dFE-shTxStwXtp0A&r=YmdhaqofMrF5BIO_XIl0Yg&m=wJ5AdaXo6IeW4xWFGIJnPtf3pLpCKM5a5knsmP9EAuo&s=5abBAV1Wh6AXmdtdfWMO6ReF-2L9d_5_Oozb2lKxK24&e=>
Many thanks, Kuo-Chuan _______________________________________________ yt-users mailing list -- yt-users@python.org <mailto:yt-users@python.org> To unsubscribe send an email to yt-users-leave@python.org <mailto:yt-users-leave@python.org>
_______________________________________________ yt-users mailing list -- yt-users@python.org To unsubscribe send an email to yt-users-leave@python.org

This e-mail from Kuo-Chuan got delayed and he ended up replying to me off-list about it. We resolved the issue he had after noting that there's currently an issue with doing something like: dd = ds.all_data() dd['density'] dd.max_level = 2 dd['density'] The second data object access won't respect the fact that max_level has now been set to 2 because the selector object does not get updated. I think this is technically a bug that could be fixed by replacing max_level and min_level with descriptors that have a setter callback that invalidates the selector. -Nathan On Wed, Mar 21, 2018 at 12:05 PM, Kuo-Chuan Pan <pankuoch@msu.edu> wrote:
Dear Nathan,
Thank you very much. This is very useful! I got an error that:
AttributeError: 'AxisAlignedSlicePlot' object has no attribute 'to_pw'
Another thing, when use down sample for data analysis. I find that
dd = ds.all_data() print(dd[“density”].shape)
Is the same as
dd.max_level = 2 print(dd[“density”].shape)
Do I miss anything?
Many thanks, Kuo-Chuan
On Mar 21, 2018, at 12:44 PM, Nathan Goldbaum <nathan12343@gmail.com> wrote:
Hi Kuo-Chuan,
The trick is to generate a slice data object and then use that data object to create the SlicePlot:
import yt
ds = yt.load('IsolatedGalaxy/galaxy0030/galaxy0030')
slc = ds.slice('x', 0.5) slc.max_level = 2
plot = slc.to_pw('density') plot.show()
This will generate a plot of 'density' sampled at a maximum AMR level of 2:
https://i.imgur.com/e1ACv2C.png <https://urldefense.proofpoint.com/v2/url?u=https-3A__i.imgur.com_e1ACv2C.png&d=DwMFaQ&c=nE__W8dFE-shTxStwXtp0A&r=YmdhaqofMrF5BIO_XIl0Yg&m=wJ5AdaXo6IeW4xWFGIJnPtf3pLpCKM5a5knsmP9EAuo&s=vz9NUwIwSHbxIUciGE7pKpzEWejFFFR3rpQAc7OZ6b4&e=>
Note that all yt data objects support both a min_level and max_level attribute to control the levels at which data selection happens.
Hope that helps,
Nathan
On Wed, Mar 21, 2018 at 10:01 AM, Kuo-Chuan Pan <astroodie@gmail.com> wrote:
Dear all,
Is there a simple way to create a data set with lower AMR levels? something like: ds = yt.load(fname, max_level=3)
I knew that there is an example to down sample for volume rendering with AMRKDTree, but I don't know how to create a downsample data set which can be analysis and plot with SlicePlot, for example. http://yt-project.org/docs/dev/cookbook/complex_plots.html# downsampling-data-for-volume-rendering <https://urldefense.proofpoint.com/v2/url?u=http-3A__yt-2Dproject.org_docs_dev_cookbook_complex-5Fplots.html-23downsampling-2Ddata-2Dfor-2Dvolume-2Drendering&d=DwMFaQ&c=nE__W8dFE-shTxStwXtp0A&r=YmdhaqofMrF5BIO_XIl0Yg&m=wJ5AdaXo6IeW4xWFGIJnPtf3pLpCKM5a5knsmP9EAuo&s=5abBAV1Wh6AXmdtdfWMO6ReF-2L9d_5_Oozb2lKxK24&e=>
Many thanks, Kuo-Chuan _______________________________________________ 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 (3)
-
Kuo-Chuan Pan
-
Kuo-Chuan Pan
-
Nathan Goldbaum