This failure is happening because the MeshSource only works with unstructured mesh data. It will not work with your RAMSES AMR data.
Your best bet for volume rendering RAMSES data is to first deposit the data onto a uniform resolution mesh, reaload that data using yt.load_uniform_grid, and volume render the reloaded dataset.
We currently do not support volume rendering RAMSES data. We realize this is something that a lot of users want but unfortunately do not have funded developer time right now for working on fixing that situation.
Apologies for the trouble, hopefully this makes more sense now.
-Nathan
On Mon, Jan 7, 2019 at 4:30 AM Vadlamani Samhitha < vadlamani.samhitha@gmail.com> wrote:
Hi, I'm trying to make a movie by depositing particles on to the mesh:
import yt
from yt.visualization.volume_rendering.api import MeshSource
from yt.units import Myr
import yt.visualization.eps_writer as eps
from yt.data_objects.particle_filters import add_particle_filter
import pylab as plt
plt.switch_backend('agg')
def star_filter(pfilter,data):
age = data["all", "particle_age"] filter = age.in_units('Myr') > 0 return filter
add_particle_filter("new_stars", function=star_filter, filtered_type= "all", requires=["particle_age"])
ini=19
fin=21
CMAP = 'hot'
VMIN = 1e3
VMAX = 1e10
for x in range(ini, fin):
filename=
"/lunarc/nobackup/users/samvad/FINAL-50-0.5/output/output_%0*d/info_%0*d.txt" % (5,x,5,x)
ds=yt.load(filename) time = ds.current_time ds.add_particle_filter("new_stars") ms =MeshSource(ds, ('deposit', 'new_stars_density')) sc.add_camera(ds) camera_position = ds.arr([0, 0, 0], 'code_length') cam.focus = ds.domain_center north_vector = ds.arr([0, 0, 0], 'dimensionless') cam.width = ds.arr([ 400, 400, 400], 'kpc') cam.resolution = (800, 800)
cam.set_position(camera_position, north_vector)
# actually make the image here im = ms.render(cam, cmap=CMAP, color_bounds=(VMIN, VMAX)) plt.clf() fig = plt.gcf() ax = plt.gca() ax.imshow(im, interpolation='nearest', origin='lower') p = ax.imshow(ms.data, visible=False, cmap=CMAP, vmin=VMIN,
vmax=VMAX)
cb = fig.colorbar(p) cb.set_label(field_name[1]) ax.text(25, 750, 'time = %.2e' % time, color='k')
ax.axes.get_xaxis().set_visible(False)
plt.savefig('movie_frames/test_%.3d' % x)
But ending up with error:
Traceback (most recent call last):
File "movie_new_stars.py", line 32, in <module>
ms =MeshSource(ds, ('deposit', 'new_stars_density'))
File "/home/samvad/yt-conda/lib/python3.6/site-packages/yt/visualization/volume_rendering/render_source.py", line 536, in __init__
self.build_volume_embree()
File "/home/samvad/yt-conda/lib/python3.6/site-packages/yt/visualization/volume_rendering/render_source.py", line 593, in build_volume_embree
mesh_id = int(ftype[-1]) - 1
ValueError: invalid literal for int() with base 10: 't'
Any leads on this are highly appreciated.
yt-users mailing list -- yt-users@python.org To unsubscribe send an email to yt-users-leave@python.org