New issue 1322: Adding several sources to VR doesn't work https://bitbucket.org/yt_analysis/yt/issues/1322/adding-several-sources-to-v...
I'm currently having the problem that when I want to add another source to any Scene, it only shows the last added source and the others disappear. To make things clearer, I'm trying to plot 3D FLASH hdf5 files and want to get a plot like here on page 5, with some entropy rendering but the neutron star in the center as marble defined by density=1e11: http://iopscience.iop.org/article/10.1088/0004-637X/799/1/5/pdf...
I can get both pictures the way I want them separately, but when having two sc.add_source statements it only shows the last one and drops the first one. Also, I can't reproduce this example with the very same code (only with a FLASH file from me): http://yt-project.org/doc/cookbook/complex_plots.html#cookbook-vol-points... As soon as sc.add_source(points) is commented in, the Volume Rendering from create_scene disappears.
Looking at sc.sources or sc.get_source shows all sources correctly, they just don't appear in the image.
Please see my code below.
Other question I have in mind: Is it possible to add a normal bar-scale like in annotate_scale to see how big everything in the current image is? Just a simple 1D bar with its corresponding length...
Thanks for any help!
#!python import yt from yt.visualization.volume_rendering.api import Scene, VolumeSource, OpaqueSource, PointSource, LineSource from yt.units import cm, m, km filePath = "/work/scratch/aj19ugij/3D/test/ccsn3d_hdf5_chk_0271" ds = yt.load(filePath) #sc = yt.create_scene(ds, lens_type='perspective') sc = Scene() PNS = VolumeSource(ds,field='density') PNS_bounds = (10**(10.99), 10**(11.01)) PNS.set_log(True) PNS_tf = yt.ColorTransferFunction(np.log10(PNS_bounds)) PNS_tf.add_gaussian(10,1,[1,1,1,0.3]) # PNS contour PNS.tfh.tf = PNS_tf PNS.tfh.bounds = PNS_bounds ENT = VolumeSource(ds,field='entr') ENT_bounds = (0,10) ENT.set_log(False) ENT_tf = yt.ColorTransferFunction(ENT_bounds) ENT_tf.add_gaussian(8,1,[0.4,1,0.4,0.3]) ENT.tfh.tf = ENT_tf ENT.tfh.bounds = ENT_bounds sc.add_source(PNS,keyname='PNS') #sc = PNS # Makes no difference either sc.add_source(ENT) sc.add_source(PNS) #vertices = np.random.random([1000, 3])*100*km #colors = np.random.random([1000, 4]) #points = PointSource(vertices,colors=colors) #sc.add_source(points) #source.tfh.plot('transfer_function.png', profile_field='density') cam = sc.add_camera(ds, lens_type='perspective') cam.resolution = [400, 400] cam.position = ds.arr([300, 300, 300], 'km') cam.switch_orientation() #sc.save('rendering.png', sigma_clip=6) sc.render() sc