Commits

Sam Skillman committed 2c5e547

Modifying how ImageArray gets used in the various cameras

Comments (0)

Files changed (1)

yt/visualization/volume_rendering/camera.py

         self._setup_box_properties(width, self.center, self.orienter.unit_vectors)
     def new_image(self):
         image = np.zeros((self.resolution[0], self.resolution[1], 3), dtype='float64', order='C')
-        return ImageArray(image)
+        return image
 
     def get_sampler_args(self, image):
         rotp = np.concatenate([self.orienter.inv_mat.ravel('F'), self.back_center.ravel()])
     def initialize_source(self):
         return self.volume.initialize_source()
 
+    def get_information(self):
+        info_dict = {'fields':self.fields, 'type':'rendering', 
+                     'east_vector':self.orienter.unit_vectors[0],
+                     'north_vector':self.orienter.unit_vectors[1],
+                     'normal_vector':self.orienter.unit_vectors[2],
+                     'width':self.width, 'dataset':self.pf.fullpath}
+        return info_dict
+
     def snapshot(self, fn = None, clip_ratio = None, double_check = False,
                  num_threads = 0):
         r"""Ray-cast the camera.
         args = self.get_sampler_args(image)
         sampler = self.get_sampler(args)
         self.initialize_source()
-        image = self._render(double_check, num_threads, image, sampler)
+        image = ImageArray(self._render(double_check, num_threads, 
+                                        image, sampler),
+                           info=self.get_information())
         self.save_image(fn, clip_ratio, image)
         return image
 
 
     def new_image(self):
         image = np.zeros((12 * self.nside ** 2, 1, 3), dtype='float64', order='C')
-        return ImageArray(image)
+        return image
 
     def get_sampler_args(self, image):
         nv = 12 * self.nside ** 2
         args = self.get_sampler_args(image)
         sampler = self.get_sampler(args)
         self.volume.initialize_source()
-        image = self._render(double_check, num_threads, image, sampler)
+        image = ImageArray(self._render(double_check, num_threads, 
+                                        image, sampler),
+                           info=self.get_information())
         self.save_image(fn, clim, image, label = label)
         return image
 
 
     def new_image(self):
         image = np.zeros((self.resolution**2,1,3), dtype='float64', order='C')
-        return ImageArray(image)
+        return image
         
     def get_sampler_args(self, image):
         vp = arr_fisheye_vectors(self.resolution, self.fov)
 
         if self.image is not None:
             del self.image
+        image = ImageArray(image,
+                           info=self.get_information())
         self.image = image
-       
         return image
 
     def save_image(self, fn, clip_ratio=None):
 
         self.initialize_source()
 
-        image = self._render(double_check, num_threads, image, sampler)
+        image = ImageArray(self._render(double_check, num_threads, 
+                                        image, sampler),
+                           info=self.get_information())
 
         self.save_image(fn, clip_ratio, image)