arte/types/domainxy.py
def from_shape(cls, shape, pixel_size=1):
        '''Build a domain from a shape and a pixel size'''

        pixel_size = _accept_one_or_two_elements(pixel_size, 'pixel_size')

        tot_size = (shape[0] * pixel_size[0], shape[1] * pixel_size[1])

        # a shape is (rows, cols), so equivalent to (y,x)
        y = np.linspace(-(tot_size[0] - pixel_size[0]) / 2,
                        (tot_size[0] - pixel_size[0]) / 2,
                        shape[0])

        x = np.linspace(-(tot_size[1] - pixel_size[1]) / 2,
                        (tot_size[1] - pixel_size[1]) / 2,
                        shape[1])

        return cls.from_xy_vectors(x, y)
Build a domain from a shape and a pixel size
Build a domain from a shape and a pixel size
Build a domain from a shape and a pixel size
def from_shape(cls, shape, pixel_size=1):
        pixel_size = _accept_one_or_two_elements(pixel_size, 'pixel_size')
        tot_size = (shape[0] * pixel_size[0], shape[1] * pixel_size[1])
        y = np.linspace(-(tot_size[0] - pixel_size[0]) / 2,
                        (tot_size[0] - pixel_size[0]) / 2,
                        shape[0])
        x = np.linspace(-(tot_size[1] - pixel_size[1]) / 2,
                        (tot_size[1] - pixel_size[1]) / 2,
                        shape[1])
        return cls.from_xy_vectors(x, y)
def from_shape ( cls , shape , pixel_size = 1 ) : pixel_size = _accept_one_or_two_elements ( pixel_size , 'pixel_size' ) tot_size = ( shape [ 0 ] * pixel_size [ 0 ] , shape [ 1 ] * pixel_size [ 1 ] ) y = np . linspace ( - ( tot_size [ 0 ] - pixel_size [ 0 ] ) / 2 , ( tot_size [ 0 ] - pixel_size [ 0 ] ) / 2 , shape [ 0 ] ) x = np . linspace ( - ( tot_size [ 1 ] - pixel_size [ 1 ] ) / 2 , ( tot_size [ 1 ] - pixel_size [ 1 ] ) / 2 , shape [ 1 ] ) return cls . from_xy_vectors ( x , y )
Build a domain from a shape and a pixel size
Build a domain from a shape and a pixel size
'''Build a domain from a shape and a pixel size''' # a shape is (rows, cols), so equivalent to (y,x)
cls
shape
pixel_size