<div dir="ltr"><br><div class="gmail_extra"><br><div class="gmail_quote">On Tue, Nov 28, 2017 at 3:36 AM, Андрей Парамонов <span dir="ltr"><<a href="mailto:paramon@acdlabs.ru" target="_blank">paramon@acdlabs.ru</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">Hello!<br>
<br>
I've recently discovered yt, and I found the rendering examples really encouraging. I'm now trying to visualize a large 3D dataset via volume rendering technique. I have come up with the following script that is intended to plot a part of the dataset:<br>
<br>
---<br>
<br>
import yt<br>
from yt.config import ytcfg<br>
<br>
import h5py<br>
<br>
f = h5py.File('ims-p.hdf5')<br>
intens = f['intensity'][:256,:256,:256]<br>
print(intens.shape)<br>
ds = yt.load_uniform_grid({'Intensi<wbr>ty': intens}, intens.shape)<br>
print(ds)<br>
sc = yt.create_scene(ds, ('Intensity'), lens_type = 'perspective')<br>
sc[0].set_log(True)<br>
sc[0].tfh.plot('transfer_funct<wbr>ion.png', profile_field = 'Intensity')<br>
sc.camera.resolution = 1024<br>
<br>
sc.annotate_axes(alpha = 0.1)<br>
sc.annotate_domain(ds, color = [1, 1, 1, 0.1])<br>
sc.save_annotated('<a href="http://vr_grids.pn">vr_grids.pn</a><wbr>g', sigma_clip = 4)<br>
<br>
---<br>
<br>
I get some really fascinating rendering (attached), and now I want to tweak it. I would be really happy if you could help me with the following questions:<br>
<br>
1) What is the best way to configure the camera viewpoint so the complete data cube fits into the view? </blockquote><div><br></div><div>Choose a Camera position that lies well outside the volume.<br></div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">How to quickly render the domain axes without performing the costly volume rendering (to find the "optimal" viewpoint experimentally)?<br></blockquote><div><br></div><div>You could try creating the volume rendering scene manually:<br><br></div><div>from yt.visualization.volume_rendering.api import Scene<br></div><div><br></div><div>sc = Scene()<br></div><div>sc.add_camera(data_source=ds.all_data(), lens_type='perspective')<br>sc.annotate_domain(ds)<br></div><div><br></div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
<br>
2) What is the best way to specify axes scales, so that rendered volume appears as cuboid, not cube? I want the resulting cuboid to be scaled as 3:2:2. How to specify resulting image size, e.g. how to get image of 1600x1200 pixels?<br></blockquote><div><br></div>If your data are natively cubic there isn't a way right now to skew the data along one of the axes. If your data are natively elongated along one axis then you shouldn't have to do anything special.<br><br></div><div class="gmail_quote">The camera's resolution can be a tuple:<br><br>In [9]: sc.camera.resolution<br>Out[9]: (512, 512)<br><br>In [10]: sc.camera.resolution = (1600, 1200)<br><br>In [11]: sc.camera.resolution<br>Out[11]: (1600, 1200)<br></div><div class="gmail_quote"><br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
<br>
3) In my dataset, the grid is not in fact uniform, but rather X coordinates are specified by (non-decreasing) array rettime, Y coordinates are specified by (non-decreasing) array mz. What is the best way to pass this information (to load_uniform_grid)?<br></blockquote><div><br></div><div>Right now this isn't supported. We do have support for nonuniformly spaced grids (we call this a semi structured mesh) but don't have support for volume rendering semi structured meshes using yt's AMR volume renderer, which only supports regularly spaced grids.<br></div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
<br>
4) Is it possible to use inverse transfer function model, i.e. white background?<br></blockquote><div><br></div><div>It should be but there's a bug that prevents that from working right now:<br><br><a href="https://github.com/yt-project/yt/issues/1579">https://github.com/yt-project/yt/issues/1579</a><br><br></div><div>I've been meaning to dive in and try to figure out why this isn't working anymore. Unfortunately the bug was introduced during a large refactoring of the volume rendering code that hapenned several years ago so it's tricky to figure out the exact cause.<br></div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
<br>
5) My complete dataset is rather large and doesn't readily fit into RAM. However it seems that for ray-tracing algorithm, it shouldn't be required that all data is available simultaneously. Is it possible to feed dataset by chunks?<br></blockquote><div><br></div><div>Right now the AMR KDTree data structure that is used by the volume renderer needs to keep a copy of the data in memory. If you have access to a cluster, that memory can be shared among compute nodes using MPI-based parallelism. There isn't a way to read the data in in a chunked fashion.<br></div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
<br>
Your help is greatly appreciated!<br></blockquote><div><br></div><div>Apologies to not have easy answers for many of your questions.<br></div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
<br>
Best wishes,<br>
Andrey Paramonov<span class="gmail-HOEnZb"><font color="#888888"><br>
<br>
-- <br>
This message has been scanned for viruses and<br>
dangerous content by MailScanner, and is<br>
believed to be clean.<br>
<br>
</font></span><br>______________________________<wbr>_________________<br>
yt-users mailing list<br>
<a href="mailto:yt-users@lists.spacepope.org">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/<wbr>listinfo.cgi/yt-users-<wbr>spacepope.org</a><br>
<br></blockquote></div><br></div></div>