Exemplo n.º 1
0
 def as_cube(self):
     self.load_pixelmap()
     result = cube()
     try:
         p_ima = c_eclipse.pixelmap_2_image(self.p_pmap)
         result.p_cube = c_eclipse.cube_from_image(p_ima)
     except:
         raise EclipseError, 'Error copying pixelmap to cube'
     return result
Exemplo n.º 2
0
 def median_average(self):
     self.load_cube()
     p_ima = c_eclipse.cube_avg_median(self.p_cube)
     if p_ima is None:
         raise EclipseError, 'median average failed'
     result = cube()
     result.p_cube = c_eclipse.cube_from_image(p_ima)
     if result.p_cube is None:
         raise EclipseError, 'median average failed'
     return result
Exemplo n.º 3
0
    def generate_random_lorentz(self, dispersion, mean):
        '''Generate a cube with lorentzian distributed noise'''

        p_ima = c_eclipse.image_gen_random_lorentz(self.xsize, self.ysize,
                                                   dispersion, mean)
        if p_ima == 'NULL':
            raise EclipseError, 'Error generating random cube'
        result = cube()
        result.p_cube = c_eclipse.cube_from_image(p_ima)
        return result
Exemplo n.º 4
0
 def sum_cube_to_image(self):
     self.load_cube()
     p_ima = c_eclipse.cube_avg_sum(self.p_cube)
     if p_ima is None:
         raise EclipseError, 'cube sum failed'
     result = cube()
     result.p_cube = c_eclipse.cube_from_image(p_ima)
     if result.p_cube is None:
         raise EclipseError, 'cube sum failed'
     return result
Exemplo n.º 5
0
    def generate_random_gauss(self, dispersion, mean):
        '''Generate a cube with noise distributed normally around mean,
        with rms dispersion'''

        p_ima = c_eclipse.image_gen_random_gauss(self.xsize, self.ysize,
                                                 dispersion, mean)
        if p_ima == 'NULL':
            raise EclipseError, 'Error generating random cube'
        result = cube()
        result.p_cube = c_eclipse.cube_from_image(p_ima)
        return result
Exemplo n.º 6
0
    def generate_random_uniform(self, min_pix, max_pix):
        '''Generate a cube with noise uniformly distributed
        betwwen min_pix and max_pix'''

        p_ima = c_eclipse.image_gen_random_uniform(self.xsize, self.ysize,
                                                   min_pix, max_pix)
        if p_ima == 'NULL':
            raise EclipseError, 'Error generating random cube'
        result = cube()
        result.p_cube = c_eclipse.cube_from_image(p_ima)
        return result
Exemplo n.º 7
0
    def time_stdev_on_cube(self):
        self.load_cube()

        p_ima = c_eclipse.cube_stdev_z(self.p_cube)
        if p_ima is None:
            raise EclipseError, 'time_stdev_on_cube failed'
        result = cube()
        result.p_cube = c_eclipse.cube_from_image(p_ima)
        if result.p_cube is None:
            raise EclipseError, 'time_stdev_on_cube failed'
        return result
Exemplo n.º 8
0
    def average_with_rejection(self, low_reject, high_reject):
        '''Average the planes in the cube

        low_reject, and high_reject give the number lowest and highest pixels
        to reject for the average of each pixel'''
        self.load_cube()
        p_ima = c_eclipse.cube_avg_reject(self.p_cube, low_reject, high_reject)
        if p_ima is None:
            raise EclipseError, 'average with rejection failed'
        result = cube()
        result.p_cube = c_eclipse.cube_from_image(p_ima)
        if result.p_cube is None:
            raise EclipseError, 'average with rejection failed'
        return result
Exemplo n.º 9
0
    def generate_poly2d(self,
                        c=0.0,
                        c_x=0.0,
                        c_y=0.0,
                        c_xx=0.0,
                        c_xy=0.0,
                        c_yy=0.0):
        '''Generate an image from a 2d polynomial

        ima(x,y) = c+c_x*x+c_y*y+c_xx*x*x+c_xy*x*y+c_yy*y*y
        '''
        p_ima = c_eclipse.image_gen_poly2d(self.xsize, self.ysize,
                                           [c_xx, c_yy, c_xy, c_x, c_y, c])
        if p_ima == 'NULL':
            raise EclipseError, 'Error generating cube from 2D poly'
        result = cube()
        result.p_cube = c_eclipse.cube_from_image(p_ima)
        return result