YTSurfaceBase.
export_obj
(filename, transparency=1.0, dist_fac=None, color_field=None, emit_field=None, color_map='algae', color_log=True, emit_log=True, plot_index=None, color_field_max=None, color_field_min=None, emit_field_max=None, emit_field_min=None)[source]¶This exports the surface to the OBJ format, suitable for visualization in many different programs (e.g., Blender). NOTE: this exports an .obj file and an .mtl file, both with the general ‘filename’ as a prefix. The .obj file points to the .mtl file in its header, so if you move the 2 files, make sure you change the .obj header to account for this. ALSO NOTE: the emit_field needs to be a combination of the other 2 fields used to have the emissivity track with the color.
Parameters: | filename : string
transparency : float
dist_fac : float
color_field : string
emit_field : string
color_map : string
color_log : bool
emit_log : bool
plot_index : integer
color_field_max : float
color_field_min : float
emit_field_max : float
emit_field_min : float
|
---|
Examples
>>> sp = ds.sphere("max", (10, "kpc"))
>>> trans = 1.0
>>> distf = 3.1e18*1e3 # distances into kpc
>>> surf = ds.surface(sp, "density", 5e-27)
>>> surf.export_obj("my_galaxy", transparency=trans, dist_fac = distf)
>>> sp = ds.sphere("max", (10, "kpc"))
>>> mi, ma = sp.quantities.extrema('temperature')[0]
>>> rhos = [1e-24, 1e-25]
>>> trans = [0.5, 1.0]
>>> distf = 3.1e18*1e3 # distances into kpc
>>> for i, r in enumerate(rhos):
... surf = ds.surface(sp,'density',r)
... surf.export_obj("my_galaxy", transparency=trans[i],
... color_field='temperature', dist_fac = distf,
... plot_index = i, color_field_max = ma,
... color_field_min = mi)
>>> sp = ds.sphere("max", (10, "kpc"))
>>> rhos = [1e-24, 1e-25]
>>> trans = [0.5, 1.0]
>>> distf = 3.1e18*1e3 # distances into kpc
>>> def _Emissivity(field, data):
... return (data['density']*data['density']*np.sqrt(data['temperature']))
>>> ds.add_field("emissivity", function=_Emissivity, units=r"g*K/cm**6")
>>> for i, r in enumerate(rhos):
... surf = ds.surface(sp,'density',r)
... surf.export_obj("my_galaxy", transparency=trans[i],
... color_field='temperature', emit_field = 'emissivity',
... dist_fac = distf, plot_index = i)