Exemplo n.º 1
0
 def raster(self, ftype, component, quick=True):
     """ ftype is amongst 'gas', 'star', those with has an sml  """
     field = self.F[ftype]
     result = zeros(dtype='f4', shape=(self.shape[0], self.shape[1]))
     ccode.rasterize(field,
                     result,
                     component,
                     xrange=self.cut[0],
                     yrange=self.cut[1],
                     zrange=self.cut[2],
                     quick=quick)
     return result
Exemplo n.º 2
0
 def wraster(self, ftype, component, weightcomponent, quick=True):
   field = self.F[ftype]
   old = field[component].copy()
   try:
     if len(field[component].shape) == 1:
       field[component][:] *= field[weightcomponent][:]
     else:
       field[component][:,0] *= field[weightcomponent][:]
       field[component][:,1] *= field[weightcomponent][:]
       field[component][:,2] *= field[weightcomponent][:]
   
     result = zeros(dtype='f4', shape = (self.shape[0], self.shape[1]))
     mass = zeros(dtype='f4', shape = (self.shape[0], self.shape[1]))
     ccode.rasterize(field, [mass, result], [weightcomponent, component], xrange=self.cut[0], yrange=self.cut[1], zrange=self.cut[2], quick=quick)
     return result, mass
   except Exception as e:
     raise e
   finally:
     field[component] = old
Exemplo n.º 3
0
    def wraster(self, ftype, component, weightcomponent, quick=True):
        field = self.F[ftype]
        old = field[component].copy()
        try:
            if len(field[component].shape) == 1:
                field[component][:] *= field[weightcomponent][:]
            else:
                field[component][:, 0] *= field[weightcomponent][:]
                field[component][:, 1] *= field[weightcomponent][:]
                field[component][:, 2] *= field[weightcomponent][:]

            result = zeros(dtype='f4', shape=(self.shape[0], self.shape[1]))
            mass = zeros(dtype='f4', shape=(self.shape[0], self.shape[1]))
            ccode.rasterize(field, [mass, result],
                            [weightcomponent, component],
                            xrange=self.cut[0],
                            yrange=self.cut[1],
                            zrange=self.cut[2],
                            quick=quick)
            return result, mass
        except Exception as e:
            raise e
        finally:
            field[component] = old
Exemplo n.º 4
0
 def raster(self, ftype, component, quick=True):
   """ ftype is amongst 'gas', 'star', those with has an sml  """
   field = self.F[ftype]
   result = zeros(dtype='f4', shape = (self.shape[0], self.shape[1]))
   ccode.rasterize(field, result, component, xrange=self.cut[0], yrange=self.cut[1], zrange=self.cut[2], quick=quick)
   return result