Quadruple Precision Enzo
Hi, I’m trying to access particle data in a dump from ENZO (compiled with particles-128), e.g. the particle_position_x field, but keep getting an error saying that the float128 type is not valid. Do I have to do something special to access float128’s? Is this a (known) bug? Is there a workaround? Best Al
This may have worked at some point but I don’t think we have tests for it so it’s not terribly surprising support for this broke at some point (if it ever worked). If you can share a smallish data file we can add to yt-project.org/data for testing and debugging purposes we could probably fix whatever issue you’re running into and add tests to make sure it doesn’t break going forward. On Thu, Feb 28, 2019 at 11:09 PM Al Zamora <alvarozamora@stanford.edu> wrote:
Hi,
I’m trying to access particle data in a dump from ENZO (compiled with particles-128), e.g. the particle_position_x field, but keep getting an error saying that the float128 type is not valid. Do I have to do something special to access float128’s? Is this a (known) bug? Is there a workaround?
Best
Al _______________________________________________ yt-users mailing list -- yt-users@python.org To unsubscribe send an email to yt-users-leave@python.org
Hello all, I have two questions: 1. When executing the script below, and printing out the scene object (output summarized below script), it shows two sources in the scene object. They're named 'source_00' and 'source_01' and they appear to contain the same information. Does this mean I have somehow accidentally created two sources when only one would suffice? 2. Is there a way to render text inside a volume rendering rather than on top? I'd like to put text in the plot in the 3D coordinate space rather than the flattened 2D space and place it so that it rotates and moves with the camera. Take care, Andrew -- Andrew W. Steiner Joint Faculty Asst. Prof. at UTK/ORNL https://neutronstars.utk.edu/ ------------------------------------------------------------------- import yt import numpy as np import h5py import math # Generate the data, a sum of two Gaussians centered at (0.4,0.3,0.2) # and (0.4,0.3,0.8). grid=128 arr=np.zeros(shape=(grid,grid,grid)) width=0.3 for i in range(0,grid): x=i/127 for j in range(0,grid): y=j/127 for k in range(0,grid): z=k/127 arr[i][j][k]=(math.exp(-(x-0.4)**2/width**2-(y-0.3)**2/width**2- (z-0.2)**2/width**2)+ math.exp(-(x-0.4)**2/width**2-(y-0.3)**2/width**2- (z-0.8)**2/width**2)) # Create the data structure data=dict(density=arr) bbox=np.array([[0.0,1.0],[0.0,1.0],[0.0,1.0]]) ds=yt.load_uniform_grid(data,arr.shape,length_unit='cm', bbox=bbox,periodicity=(False,False,False), unit_system='cgs') # Create the scene sc=yt.create_scene(ds,'density') source=sc[0] source.log_field=False tf_min=0.49 tf_max=0.51 tf=yt.ColorTransferFunction((tf_min,tf_max),grey_opacity=False) tf.map_to_colormap(tf_min,tf_max,scale=1.0,colormap='algae') source.set_transfer_function(tf) sc.add_source(source) # Create the camera cam=sc.add_camera() # Define the width of the image cam.width=1.5*ds.domain_width[0] # Specify the position and focus of the camera cam.position=[0.2,0.3,0.1] cam.focus=ds.domain_center # Print out some of the details print('-------------------------------------------------------------------') print('Scene:') print(sc) print('-------------------------------------------------------------------') # Draw the edges of the computational domain sc.annotate_domain(ds,color=[1,1,1,0.01]) sc.save('temp.png',sigma_clip=1.0) # End of python script ------------------------------------------------------------------- Scene: <Scene Object>: Sources: source_00: <Volume Source>:YTRegion (UniformGridData): , center=[0.5 0.5 0.5] cm, left_edge=[0. 0. 0.] cm, right_edge=[1. 1. 1.] cm transfer_function:<Color Transfer Function Object>: x_bounds:[0.49, 0.51] nbins:256 features: ('map_to_colormap', 'start(x):0.49', 'stop(x):0.51', 'value(y): 1') source_01: <Volume Source>:YTRegion (UniformGridData): , center=[0.5 0.5 0.5] cm, left_edge=[0. 0. 0.] cm, right_edge=[1. 1. 1.] cm transfer_function:<Color Transfer Function Object>: x_bounds:[0.49, 0.51] nbins:256 features: ('map_to_colormap', 'start(x):0.49', 'stop(x):0.51', 'value(y): 1') Camera: ...etc...
yt.create_scene initializes a source, if you don't want that you can either pop off the source it creates after create_scene finishes or you can do what create_scene does manually: from yt.visualization.volume_rendering.scene import Scene sc = Scene() # create source sc.add_source(source) sc,add_camera(data_object, lens_type=lens_type) Right now we don't have a way to compose text in 3D in the scene. -Nathan On Sun, Mar 3, 2019 at 7:25 PM Steiner, Andrew (Andrew W. Steiner) < awsteiner@utk.edu> wrote:
Hello all,
I have two questions:
1. When executing the script below, and printing out the scene object (output summarized below script), it shows two sources in the scene object. They're named 'source_00' and 'source_01' and they appear to contain the same information. Does this mean I have somehow accidentally created two sources when only one would suffice?
2. Is there a way to render text inside a volume rendering rather than on top? I'd like to put text in the plot in the 3D coordinate space rather than the flattened 2D space and place it so that it rotates and moves with the camera.
Take care, Andrew -- Andrew W. Steiner Joint Faculty Asst. Prof. at UTK/ORNL https://neutronstars.utk.edu/
------------------------------------------------------------------- import yt import numpy as np import h5py import math
# Generate the data, a sum of two Gaussians centered at (0.4,0.3,0.2) # and (0.4,0.3,0.8). grid=128 arr=np.zeros(shape=(grid,grid,grid)) width=0.3 for i in range(0,grid): x=i/127 for j in range(0,grid): y=j/127 for k in range(0,grid): z=k/127
arr[i][j][k]=(math.exp(-(x-0.4)**2/width**2-(y-0.3)**2/width**2- (z-0.2)**2/width**2)+
math.exp(-(x-0.4)**2/width**2-(y-0.3)**2/width**2- (z-0.8)**2/width**2))
# Create the data structure data=dict(density=arr) bbox=np.array([[0.0,1.0],[0.0,1.0],[0.0,1.0]]) ds=yt.load_uniform_grid(data,arr.shape,length_unit='cm', bbox=bbox,periodicity=(False,False,False), unit_system='cgs')
# Create the scene sc=yt.create_scene(ds,'density')
source=sc[0]
source.log_field=False
tf_min=0.49 tf_max=0.51 tf=yt.ColorTransferFunction((tf_min,tf_max),grey_opacity=False) tf.map_to_colormap(tf_min,tf_max,scale=1.0,colormap='algae') source.set_transfer_function(tf)
sc.add_source(source)
# Create the camera cam=sc.add_camera() # Define the width of the image cam.width=1.5*ds.domain_width[0] # Specify the position and focus of the camera cam.position=[0.2,0.3,0.1] cam.focus=ds.domain_center
# Print out some of the details
print('-------------------------------------------------------------------') print('Scene:') print(sc)
print('-------------------------------------------------------------------')
# Draw the edges of the computational domain sc.annotate_domain(ds,color=[1,1,1,0.01])
sc.save('temp.png',sigma_clip=1.0)
# End of python script -------------------------------------------------------------------
Scene: <Scene Object>: Sources: source_00: <Volume Source>:YTRegion (UniformGridData): , center=[0.5 0.5 0.5] cm, left_edge=[0. 0. 0.] cm, right_edge=[1. 1. 1.] cm transfer_function:<Color Transfer Function Object>: x_bounds:[0.49, 0.51] nbins:256 features: ('map_to_colormap', 'start(x):0.49', 'stop(x):0.51', 'value(y): 1')
source_01: <Volume Source>:YTRegion (UniformGridData): , center=[0.5 0.5 0.5] cm, left_edge=[0. 0. 0.] cm, right_edge=[1. 1. 1.] cm transfer_function:<Color Transfer Function Object>: x_bounds:[0.49, 0.51] nbins:256 features: ('map_to_colormap', 'start(x):0.49', 'stop(x):0.51', 'value(y): 1')
Camera: ...etc...
_______________________________________________ yt-users mailing list -- yt-users@python.org To unsubscribe send an email to yt-users-leave@python.org
Ah I see thank you very much Nathan. Take care, Andrew On 3/3/19 8:34 PM, Nathan Goldbaum wrote:
yt.create_scene initializes a source, if you don't want that you can either pop off the source it creates after create_scene finishes or you can do what create_scene does manually:
from yt.visualization.volume_rendering.scene import Scene
sc = Scene()
# create source
sc.add_source(source) sc,add_camera(data_object, lens_type=lens_type)
Right now we don't have a way to compose text in 3D in the scene.
-Nathan
On Sun, Mar 3, 2019 at 7:25 PM Steiner, Andrew (Andrew W. Steiner) < awsteiner@utk.edu> wrote:
Hello all,
I have two questions:
1. When executing the script below, and printing out the scene object (output summarized below script), it shows two sources in the scene object. They're named 'source_00' and 'source_01' and they appear to contain the same information. Does this mean I have somehow accidentally created two sources when only one would suffice?
2. Is there a way to render text inside a volume rendering rather than on top? I'd like to put text in the plot in the 3D coordinate space rather than the flattened 2D space and place it so that it rotates and moves with the camera.
Take care, Andrew -- Andrew W. Steiner Joint Faculty Asst. Prof. at UTK/ORNL https://neutronstars.utk.edu/
------------------------------------------------------------------- import yt import numpy as np import h5py import math
# Generate the data, a sum of two Gaussians centered at (0.4,0.3,0.2) # and (0.4,0.3,0.8). grid=128 arr=np.zeros(shape=(grid,grid,grid)) width=0.3 for i in range(0,grid): x=i/127 for j in range(0,grid): y=j/127 for k in range(0,grid): z=k/127
arr[i][j][k]=(math.exp(-(x-0.4)**2/width**2-(y-0.3)**2/width**2- (z-0.2)**2/width**2)+
math.exp(-(x-0.4)**2/width**2-(y-0.3)**2/width**2- (z-0.8)**2/width**2))
# Create the data structure data=dict(density=arr) bbox=np.array([[0.0,1.0],[0.0,1.0],[0.0,1.0]]) ds=yt.load_uniform_grid(data,arr.shape,length_unit='cm', bbox=bbox,periodicity=(False,False,False), unit_system='cgs')
# Create the scene sc=yt.create_scene(ds,'density')
source=sc[0]
source.log_field=False
tf_min=0.49 tf_max=0.51 tf=yt.ColorTransferFunction((tf_min,tf_max),grey_opacity=False) tf.map_to_colormap(tf_min,tf_max,scale=1.0,colormap='algae') source.set_transfer_function(tf)
sc.add_source(source)
# Create the camera cam=sc.add_camera() # Define the width of the image cam.width=1.5*ds.domain_width[0] # Specify the position and focus of the camera cam.position=[0.2,0.3,0.1] cam.focus=ds.domain_center
# Print out some of the details
print('-------------------------------------------------------------------') print('Scene:') print(sc)
print('-------------------------------------------------------------------')
# Draw the edges of the computational domain sc.annotate_domain(ds,color=[1,1,1,0.01])
sc.save('temp.png',sigma_clip=1.0)
# End of python script -------------------------------------------------------------------
Scene: <Scene Object>: Sources: source_00: <Volume Source>:YTRegion (UniformGridData): , center=[0.5 0.5 0.5] cm, left_edge=[0. 0. 0.] cm, right_edge=[1. 1. 1.] cm transfer_function:<Color Transfer Function Object>: x_bounds:[0.49, 0.51] nbins:256 features: ('map_to_colormap', 'start(x):0.49', 'stop(x):0.51', 'value(y): 1')
source_01: <Volume Source>:YTRegion (UniformGridData): , center=[0.5 0.5 0.5] cm, left_edge=[0. 0. 0.] cm, right_edge=[1. 1. 1.] cm transfer_function:<Color Transfer Function Object>: x_bounds:[0.49, 0.51] nbins:256 features: ('map_to_colormap', 'start(x):0.49', 'stop(x):0.51', 'value(y): 1')
Camera: ...etc...
_______________________________________________ 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
-- Andrew W. Steiner Joint Faculty Asst. Prof. at UTK/ORNL https://neutronstars.utk.edu/
participants (3)
-
Al Zamora
-
Nathan Goldbaum
-
Steiner, Andrew (Andrew W. Steiner)