<div dir="ltr">I've gone ahead and opened an issue on github:<div><br></div><div><a href="https://github.com/yt-project/yt/issues/1405">https://github.com/yt-project/yt/issues/1405</a><br></div><div><br></div><div>Let's move discussion about this over there.</div></div><div class="gmail_extra"><br><div class="gmail_quote">On Thu, May 18, 2017 at 1:38 PM, Nathan Goldbaum <span dir="ltr"><<a href="mailto:nathan12343@gmail.com" target="_blank">nathan12343@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><br><div class="gmail_extra"><br><div class="gmail_quote"><span class="">On Thu, May 18, 2017 at 1:24 PM, Matthew Turk <span dir="ltr"><<a href="mailto:matthewturk@gmail.com" target="_blank">matthewturk@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">Hi,<div><br></div><div>I looked into this, and one thing I thought would fix it (adding a _block_reorder attribute to ParticleOctreeSubset) didn't fix it, which surprised me. But, transposing the return value rv in OctreeSubsetBlockSlicePosition did. I thought that doing the copy in a different order would be sufficient, since we don't use memoryviews internal to the VR.</div><div><br></div><div>I'm not ready yet to submit a PR for this yet, until I understand where it's coming from. Nathan, wasn't there a recent change to the i,j,k loop order in the smoothing? </div></div></blockquote><div><br></div></span><div>Not that I remember, but I could be forgetting something.</div><span class=""><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div>Are we sure this behavior has been around for a long time?</div></div></blockquote><div><br></div></span><div>I have no idea, I haven't tried testing on an old version of yt.</div><div><div class="h5"><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div><br></div><div>-Matt</div></div><div class="m_-800268037669650447HOEnZb"><div class="m_-800268037669650447h5"><div class="gmail_extra"><br><div class="gmail_quote">On Thu, May 18, 2017 at 9:41 AM, Nathan Goldbaum <span dir="ltr"><<a href="mailto:nathan12343@gmail.com" target="_blank">nathan12343@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">Hi Dan,<div><br></div><div>Thanks for the info. I was able to reproduce the behavior you're seeing. Your script wasn't quite runnable (it still used set_size_inches, and you also forgot to save the first image). I also noticed that the difference is visible at yt's default resolution and with the ('gas', 'density') field, so in the interest of making the script simpler I used those:<br></div><div><br></div><div><a href="http://paste.yt-project.org/show/7150/" target="_blank">http://paste.yt-project.org/sh<wbr>ow/7150/</a><br></div><div><br></div><div>For anyone following along, here are the two images this script produces:</div><div><br></div><div>axis-aligned projection: <a href="http://i.imgur.com/ddKkxaC.png" target="_blank">http://i.imgur.com<wbr>/ddKkxaC.png</a></div><div><br></div><div>off-axis projection: <a href="http://i.imgur.com/mhWR2NL.png" target="_blank">http://i.imgur.com<wbr>/mhWR2NL.png</a></div><div><br></div><div>The problem gets worse when I increase over_refine_factor to 2 and set index_ptype='PartType0':</div><div><br></div><div>axis-aligned projection: <a href="http://i.imgur.com/fctKRSO.png" target="_blank">http://i.imgur.com/fctKRSO.png</a><br></div><div><br></div><div>off-axis projection: <a href="http://i.imgur.com/eAz9BNt.png" target="_blank">http://i.imgur.com<wbr>/eAz9BNt.png</a></div><div><br></div><div>I'm not sure offhand why the results are different, in principle they should be the same, although as I mentioned earlier the images are produced using very different algorithms. It's possible there's a bug in how the volume renderer is dealing with SPH particle data. The fact that the problem gets worse when the resolution of the octree increases indicates to me that this is likely a bug. I know we've had other issues in the past using the volume rendering infrastructure with SPH data.</div><div><br></div><div>Sorry to not have a more satisfactory answer. I think at this point we should probably open an issue on github to track this, I think we have good evidence that there are artifacts in SPH off-axis projections.</div><div><br></div><div>I'm currently actively working on improving yt's support for particle data of all kinds and SPH data in particular. See this page for more details: <a href="https://bitbucket.org/ngoldbaum/ytep/src/2a754cae8a5825109bad00aa9a5607abbcc4f095/source/YTEPs/YTEP-0031.rst?at=default&fileviewer=file-view-default" target="_blank">https://bitbucket.org<wbr>/ngoldbaum/ytep/src/2a754cae8a<wbr>5825109bad00aa9a5607abbcc4f095<wbr>/source/YTEPs/YTEP-0031.rst?at<wbr>=default&fileviewer=file-view-<wbr>default</a></div><div><br></div><div>Part of this will include writing a new particle-centric volume renderer which will hopefully fix this. That's definitely a more long term goal which will hopefully be done in the next few months. In the meantime someone will need to try to figure out what's introducing these artifacts we're seeing and optimally fix them somehow :)</div><span class="m_-800268037669650447m_-7849772475151883628HOEnZb"><font color="#888888"><div><br></div><div>-Nathan</div></font></span></div><div class="m_-800268037669650447m_-7849772475151883628HOEnZb"><div class="m_-800268037669650447m_-7849772475151883628h5"><div class="gmail_extra"><br><div class="gmail_quote">On Thu, May 18, 2017 at 12:54 AM, bazhaoyu_sjtu <span dir="ltr"><<a href="mailto:hudan_bazhaoyu@sjtu.edu.cn" target="_blank">hudan_bazhaoyu@sjtu.edu.cn</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div bgcolor="#FFFFFF" text="#000000">
Hi Nathan,<br>
<br>
I'm so sorry that I haven't expressed clearly.<br>
<br>
I learned your code, and replotted two images. The complete script:
<br>
<a class="m_-800268037669650447m_-7849772475151883628m_2782934632580392048m_1605509691906716800moz-txt-link-freetext" href="http://paste.yt-project.org/show/7146/" target="_blank">http://paste.yt-project.org/sh<wbr>ow/7146/</a><br>
where the 'surface brightness' is a derived field by myself.<br>
<br>
And my data 'snap_206.hdf5': <a class="m_-800268037669650447m_-7849772475151883628m_2782934632580392048m_1605509691906716800moz-txt-link-freetext" href="http://use.yt/upload/c7c0d617" target="_blank">http://use.yt/upload/c7c0d617</a><br>
<br>
Here's the two images:<br>
<div>regular projection:
<a class="m_-800268037669650447m_-7849772475151883628m_2782934632580392048m_1605509691906716800moz-txt-link-freetext" href="https://1drv.ms/i/s!Aq__4QGcEmxvh06ErW9t_0BK-LQR" target="_blank">https://1drv.ms/i/s!Aq__4QGcEm<wbr>xvh06ErW9t_0BK-LQR</a><br>
</div>
<div>off-axis projection:
<a class="m_-800268037669650447m_-7849772475151883628m_2782934632580392048m_1605509691906716800moz-txt-link-freetext" href="https://1drv.ms/i/s!Aq__4QGcEmxvh09ajn0UdatFjIil" target="_blank">https://1drv.ms/i/s!Aq__4QGcEm<wbr>xvh09ajn0UdatFjIil</a><br>
<br>
</div>
The off-axis one is still blockier. So How can I fix it? I want to
have same resolution of two figures.<br>
Thanks for you help!<br>
<br>
<br>
Regards,<br>
Dan<div><div class="m_-800268037669650447m_-7849772475151883628m_2782934632580392048h5"><br>
<br>
<br>
<div class="m_-800268037669650447m_-7849772475151883628m_2782934632580392048m_1605509691906716800moz-cite-prefix">On 05/16/2017 08:39 PM, Nathan Goldbaum
wrote:<br>
</div>
<blockquote type="cite">
<div><br>
<div class="gmail_quote">
<div>On Tue, May 16, 2017 at 6:38 AM bazhaoyu_sjtu <<a href="mailto:hudan_bazhaoyu@sjtu.edu.cn" target="_blank"></a><a class="m_-800268037669650447m_-7849772475151883628m_2782934632580392048m_1605509691906716800moz-txt-link-abbreviated" href="mailto:hudan_bazhaoyu@sjtu.edu.cn" target="_blank">hudan_bazhaoyu@sjtu.edu.cn</a>>
wrote:<br>
</div>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div bgcolor="#FFFFFF" text="#000000"> Hi Nathan,<br>
<br>
Thank you for your prompt reply!<br>
<br>
I also have two questions:<br>
<br>
1. When I tried your new script, the bug are presented
below:<br>
------------------------------<wbr>------------------------------<wbr>------------------------------<wbr>-------<br>
pz.set_size_inches(10)<br>
AttributeError: 'ProjectionPlot' object has no attribute
'set_size_inches'</div>
</blockquote>
<div><br>
</div>
<div>Oops, that should have been pz.set_figure_size(10). I
thought I fixed that it I guess I forgot to update the
email. Sorry for the confusion.</div>
<div><br>
</div>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div bgcolor="#FFFFFF" text="#000000"><br>
------------------------------<wbr>------------------------------<wbr>------------------------------<wbr>-------<br>
<br>
2. For your two images, I also found that figure's
resolution of the 'off-axis projection' is worse than the
'regular projection', for example, the 'off-axis
projection' figure has more obvious grid point. <br>
Is there any difference between two projection ways?
Because I supposed it should be same.</div>
</blockquote>
<div><br>
</div>
<div>They are generated using very different algorithms. The
axis-aligned projection is calculated based on an adaptive
quadtree while the off-axis projection is calculated using a
ray-casting volume renderer.</div>
<div><br>
</div>
<div>I agree with you that in principle they should come out
with identical-looking results for the script you provided.
It's possible that you're data is exposing a corner case
that somehow makes the off-axis projection appear blockier.
It's hard to say without more info. Please see the last
paragraph of my last message about this, if you share an
example dataset that triggers this behavior or share the
images you are seeing it will make it easier to speak
intelligently about what you are seeing.</div>
<div><br>
</div>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div bgcolor="#FFFFFF" text="#000000"><br>
<br>
Thank you again!<br>
<br>
Regards,<br>
Dan</div>
<div bgcolor="#FFFFFF" text="#000000"><br>
<br>
<br>
<br>
<br>
<br>
<div class="m_-800268037669650447m_-7849772475151883628m_2782934632580392048m_1605509691906716800m_7732289006933095013moz-cite-prefix">On
05/15/2017 09:56 PM, Nathan Goldbaum wrote:<br>
</div>
<blockquote type="cite">
<div>Hi Dan,
<div><br>
</div>
<div>I adapted your script to use a public dataset
from <a href="http://yt-project.org/data" target="_blank">yt-project.org/data</a>.
I also don't have a definition for a
surface_brightness field in my copy of yt, so I
guess you defined that elsewhere? I used 'density'.
Here's the script I ended up coming up with:</div>
<div><br>
</div>
<div><a href="http://paste.yt-project.org/show/7142/" target="_blank">http://paste.yt-project.org/sh<wbr>ow/7142/</a><br>
</div>
<div><br>
</div>
<div>(note that you can upload scripts with the "yt
pastebin" command line tool, e.g. "yt pastebin
my_script.py")</div>
<div><br>
</div>
<div>And indeed, in that case I get two images that
aren't the desired high resolution you're looking
for (although both images have the same resolution).
The issue is that yt is saving the figure to disk
through matplotlib. To control the image size in
pixels through matplotlib you need to know the
figure size in inches and the dpi (e.g. the number
of pixels per inch of figure). Here's a revised
version of the script above which saves to disk two
images with the desired 3200x3200 resolution:</div>
<div><br>
</div>
<div><a href="http://paste.yt-project.org/show/7145/" target="_blank">http://paste.yt-project.org/sh<wbr>ow/7145/</a><br>
</div>
<div><br>
</div>
<div>It also hides the axes and colorbar, since that
makes it easier to guess ahead of time what the
final image resolution will be. Here are the two
images:</div>
<div><br>
</div>
<div>regular projection: <a href="http://i.imgur.com/ialfYC4.png" target="_blank">http://i.imgur.com<wbr>/ialfYC4.png</a></div>
<div>off-axis projection: <a href="http://i.imgur.com/PcvPZ9f.png" target="_blank">http://i.imgur.com/PcvPZ9f.png</a></div>
<div><br>
</div>
<div>You can share images you make using yt using the
"yt upload_image" command, which will upload an
image stored locally to imgur. We usually suggest
using that to share images or alternatively
something like a Jupyter notebook on <a href="http://gist.github.com" target="_blank">gist.github.com</a>
to avoid clogging people's e-mail with high
resolution images.</div>
<div><br>
</div>
<div>Finally, if you don't want to mess with
matplotlib and just want the underlying images, you
can get those via the frb attribute of the plot
object. Something like:</div>
<div><br>
</div>
<div> plot = yt.ProjectionPlot(ds, 'z', ('gas',
'density'))</div>
<div> plot.set_buff_size((3200, 3200))</div>
<div><br>
</div>
<div> # image will be a 3200x3200 numpy array</div>
<div> image = plot.frb['gas', 'density']</div>
<div><br>
</div>
<div>I hope that helps clear things up. If you are
still having issues it would help if you could share
the exact yt version you are using as well as a
runnable test script that demonstrates the issue. If
you can't trigger the issue using one of the public
SPH datasets on <a href="http://yt-project.org/data" target="_blank">yt-project.org/data</a>,
you can share one of your datasets using the yt
curldrop: <a class="m_-800268037669650447m_-7849772475151883628m_2782934632580392048m_1605509691906716800m_7732289006933095013moz-txt-link-freetext" href="https://docs.hub.yt/services.html#curldrop" target="_blank">https://docs.hub.yt/<wbr>services.html#curldrop</a></div>
<div><br>
</div>
<div>-Nathan</div>
</div>
<div class="gmail_extra"><br>
<div class="gmail_quote">On Mon, May 15, 2017 at 4:40
AM, bazhaoyu_sjtu <span><<a href="mailto:hudan_bazhaoyu@sjtu.edu.cn" target="_blank"></a><a class="m_-800268037669650447m_-7849772475151883628m_2782934632580392048m_1605509691906716800moz-txt-link-abbreviated" href="mailto:hudan_bazhaoyu@sjtu.edu.cn" target="_blank">hudan_bazhaoyu@sjtu.edu.cn</a>></span>
wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hi
yt-users:<br>
<br>
I want to ask you a question about the figures'
resolution, I handled Gadget file -- hdf5.<br>
<br>
I used the 'ProjectionPlot' to plot the surface
brightness map which is integrated along the 'z'
axis, please see the figure 1; And I plot another
surface brightness map by 'OffAxisProjectionPlot'
with the normal_vector is [0, 0, 1], please see
the figure 2.<br>
<br>
# I can't upload attachments ??? #<br>
<br>
Comparing two figures, we can find the structures
of them is same, but the resolution is different!
The 'OffAxisProjectionPlot' is obviously worse
than 'ProjectionPlot', I don't know why!<br>
<br>
Below are the process I created two figures:<br>
<br>
==============================<wbr>==============================<wbr>==========<br>
import yt<br>
import numpy as np<br>
import yt.units as units<br>
import pylab<br>
<br>
fname = "snap_206.hdf5"<br>
unit_base = {'UnitLength_in_cm' : 3.08568e+21,<br>
'UnitMass_in_g' : 1.989e+43,<br>
'UnitVelocity_in_cm_per_s' : 100000}<br>
bbox_lim = 1e5 # kpc<br>
bbox = [[-bbox_lim,bbox_lim],<br>
[-bbox_lim,bbox_lim],<br>
[-bbox_lim,bbox_lim]]<br>
ds =
yt.load(fname,unit_base=unit_b<wbr>ase,bounding_box=bbox)<br>
ds.index<br>
ad= ds.all_data()<br>
<br>
<br>
## For 'ProjectionPlot' ##<br>
pz = yt.ProjectionPlot(ds, 'z', ('gas',
'surface_brightness'), 'max', width=(0.4,'Mpc'))<br>
<br>
<br>
## For 'OffAxisProjectionPlot' ##<br>
L = [0,0,1]<br>
north_vector = [0,1,0]<br>
pz = yt.OffAxisProjectionPlot(ds, L, ('gas',
'surface_brightness'), 'max', north_vector =
north_vector, width=(0.4,'Mpc'))<br>
<br>
<br>
pz.set_buff_size((3200,3200))<br>
pz.save()<br>
==============================<wbr>==============================<wbr>=============<br>
<br>
What can i do to fix this difference of resolution
between two plot ways?<br>
Thanks a lot!<br>
<br>
Regards,<br>
Dan<br>
<br>
<br>
==============================<wbr>====<br>
Department of Physics, Shanghai Jiao Tong
University<br>
800 Dongchuan Road, Minhang, Shanghai 200240, PRC<br>
E-mail : <a href="mailto:hudan_bazhaoyu@163.com" target="_blank">hudan_bazhaoyu@163.com</a><br>
<a href="mailto:hudan_bazhaoyu@sjtu.edu.cn" target="_blank">hudan_bazhaoyu@sjtu.edu.cn</a><br>
==============================<wbr>====<br>
______________________________<wbr>_________________<br>
yt-users mailing list<br>
<a href="mailto:yt-users@lists.spacepope.org" target="_blank">yt-users@lists.spacepope.org</a><br>
<a href="http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org" rel="noreferrer" target="_blank">http://lists.spacepope.org/lis<wbr>tinfo.cgi/yt-users-spacepope.o<wbr>rg</a><br>
</blockquote>
</div>
<br>
</div>
<br>
<fieldset class="m_-800268037669650447m_-7849772475151883628m_2782934632580392048m_1605509691906716800m_7732289006933095013mimeAttachmentHeader"></fieldset>
<br>
<pre>______________________________<wbr>_________________
yt-users mailing list
<a class="m_-800268037669650447m_-7849772475151883628m_2782934632580392048m_1605509691906716800m_7732289006933095013moz-txt-link-abbreviated" href="mailto:yt-users@lists.spacepope.org" target="_blank">yt-users@lists.spacepope.org</a>
<a class="m_-800268037669650447m_-7849772475151883628m_2782934632580392048m_1605509691906716800m_7732289006933095013moz-txt-link-freetext" href="http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org" target="_blank">http://lists.spacepope.org/lis<wbr>tinfo.cgi/yt-users-spacepope.o<wbr>rg</a>
</pre>
</blockquote>
<br>
</div>
______________________________<wbr>_________________<br>
yt-users mailing list<br>
<a href="mailto:yt-users@lists.spacepope.org" target="_blank">yt-users@lists.spacepope.org</a><br>
<a href="http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org" rel="noreferrer" target="_blank">http://lists.spacepope.org/lis<wbr>tinfo.cgi/yt-users-spacepope.o<wbr>rg</a><br>
</blockquote>
</div>
</div>
<br>
<fieldset class="m_-800268037669650447m_-7849772475151883628m_2782934632580392048m_1605509691906716800mimeAttachmentHeader"></fieldset>
<br>
<pre>______________________________<wbr>_________________
yt-users mailing list
<a class="m_-800268037669650447m_-7849772475151883628m_2782934632580392048m_1605509691906716800moz-txt-link-abbreviated" href="mailto:yt-users@lists.spacepope.org" target="_blank">yt-users@lists.spacepope.org</a>
<a class="m_-800268037669650447m_-7849772475151883628m_2782934632580392048m_1605509691906716800moz-txt-link-freetext" href="http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org" target="_blank">http://lists.spacepope.org/lis<wbr>tinfo.cgi/yt-users-spacepope.o<wbr>rg</a>
</pre>
</blockquote>
<br>
</div></div></div>
<br>______________________________<wbr>_________________<br>
yt-users mailing list<br>
<a href="mailto:yt-users@lists.spacepope.org" target="_blank">yt-users@lists.spacepope.org</a><br>
<a href="http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org" rel="noreferrer" target="_blank">http://lists.spacepope.org/lis<wbr>tinfo.cgi/yt-users-spacepope.o<wbr>rg</a><br>
<br></blockquote></div><br></div>
</div></div><br>______________________________<wbr>_________________<br>
yt-users mailing list<br>
<a href="mailto:yt-users@lists.spacepope.org" target="_blank">yt-users@lists.spacepope.org</a><br>
<a href="http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org" rel="noreferrer" target="_blank">http://lists.spacepope.org/lis<wbr>tinfo.cgi/yt-users-spacepope.o<wbr>rg</a><br>
<br></blockquote></div><br></div>
</div></div><br>______________________________<wbr>_________________<br>
yt-users mailing list<br>
<a href="mailto:yt-users@lists.spacepope.org" target="_blank">yt-users@lists.spacepope.org</a><br>
<a href="http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org" rel="noreferrer" target="_blank">http://lists.spacepope.org/lis<wbr>tinfo.cgi/yt-users-spacepope.<wbr>org</a><br>
<br></blockquote></div></div></div><br></div></div>
</blockquote></div><br></div>