Advertisement
Guest User

YT FisheyeCamera Script

a guest
Feb 6th, 2014
145
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.15 KB | None | 0 0
  1. from yt.mods import *
  2.  
  3. pf = load('DD0179/DD0179')
  4.  
  5. N = 512 # Pixels (512^2)
  6. c = (pf.domain_right_edge + pf.domain_left_edge)/2. # Center
  7. radius = (pf.domain_right_edge - pf.domain_left_edge)/2.
  8. fov = 180.0
  9.  
  10. field='Density'
  11. mi,ma = pf.h.all_data().quantities['Extrema']('Density')[0]
  12. mi,ma = np.log10(mi), np.log10(ma)
  13.  
  14. # Construct transfer function
  15. tf = ColorTransferFunction((mi-1, ma+1),nbins=1024)
  16.  
  17. # Sample transfer function with Nc gaussians.  Use col_bounds keyword to limit
  18. # the color range to the min and max values, rather than the transfer function
  19. # bounds.
  20. Nc = 5
  21. tf.add_layers(Nc,w=0.005, col_bounds = (mi,ma), alpha=np.logspace(-2,0,Nc),
  22.       colormap='RdBu_r')
  23.  
  24. # Create the camera object. Use the keyword: no_ghost=True if a lot of time is
  25. # spent creating vertex-centered data. In this case I'm running with 8
  26. # processors, and am splitting the image plane into 4 pieces and using 2
  27. # processors on each piece.
  28. cam = FisheyeCamera(c, radius, fov, N,
  29.       transfer_function = tf,
  30.       sub_samples = 5,
  31.       pf=pf)
  32.  
  33. # Take a snapshot
  34. im = cam.snapshot()
  35.  
  36. # Save the image
  37. cam.save_image('figures/fisheye_mosaic.png')
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement