yt.visualization.volume_rendering.camera.
MosaicFisheyeCamera
(center, radius, fov, resolution, focal_center=None, transfer_function=None, fields=None, sub_samples=5, log_fields=None, volume=None, ds=None, l_max=None, no_ghost=False, nimx=1, nimy=1, procs_per_wg=None, rotation=None)[source]¶A fisheye lens camera, taking adantage of image plane decomposition for parallelism.
The camera represents the eye of an observer, which will be used to generate ray-cast volume renderings of the domain. In this case, the rays are defined by a fisheye lens
Parameters: | center : array_like
radius : float
resolution : int
volume : yt.extensions.volume_rendering.AMRKDTree, optional
fields : list of fields, optional
log_fields : list of bool, optional
sub_samples : int, optional
ds : ~yt.data_objects.api.Dataset
l_max: int, optional :
no_ghost: bool, optional :
nimx: int, optional :
nimy: int, optional :
procs_per_wg: int, optional :
|
---|
Notes
The product of nimx*nimy*procs_per_wg must be equal to or less than the total number of mpi processes.
Unlike the non-Mosaic camera, this will only return each sub-image to the root processor of each sub-image workgroup in order to save memory. To save the final image, one must then call MosaicFisheyeCamera.save_image(‘filename’)
Examples
>>> from yt.mods import *
>>> ds = load('DD1717')
>>> N = 512 # Pixels (1024^2)
>>> c = (ds.domain_right_edge + ds.domain_left_edge)/2. # Center
>>> radius = (ds.domain_right_edge - ds.domain_left_edge)/2.
>>> fov = 180.0
>>> field='Density'
>>> mi,ma = ds.all_data().quantities['Extrema']('Density')[0]
>>> mi,ma = np.log10(mi), np.log10(ma)
# You may want to comment out the above lines and manually set the min and max # of the log of the Density field. For example: # mi,ma = -30.5,-26.5
# Another good place to center the camera is close to the maximum density. # v,c = ds.find_max(‘Density’) # c -= 0.1*radius
# Construct transfer function >>> tf = ColorTransferFunction((mi-1, ma+1),nbins=1024)
# Sample transfer function with Nc gaussians. Use col_bounds keyword to limit # the color range to the min and max values, rather than the transfer function # bounds. >>> Nc = 5 >>> tf.add_layers(Nc,w=0.005, col_bounds = (mi,ma), alpha=np.logspace(-2,0,Nc), >>> colormap=’RdBu_r’) >>> # Create the camera object. Use the keyword: no_ghost=True if a lot of time is # spent creating vertex-centered data. In this case I’m running with 8 # processors, and am splitting the image plane into 4 pieces and using 2 # processors on each piece. >>> cam = MosaicFisheyeCamera(c, radius, fov, N, >>> transfer_function = tf, >>> sub_samples = 5, >>> ds=ds, >>> nimx=2,nimy=2,procs_per_wg=2)
# Take a snapshot >>> im = cam.snapshot()
# Save the image >>> cam.save_image(‘fisheye_mosaic.png’)
Attributes
Methods