Exemple #1
0
 def __init__(self, data_header, cube_header, ng=1, **kwargs):
     self.data_header = data_header
     self.map_header = cube_header
     xout = dataarray_from_header(data_header)
     xout[:] = 0
     xin = fa.fitsarray_from_header(cube_header)
     xin.header = dict(xin.header)
     xin[:] = 0
     self.xin = xin
     self.xout = xout
     def matvec(x):
         y = dataarray_from_header(data_header)
         y[:] = 0
         for i in xrange(ng):
             yi = y[..., i::ng]
             yi.header = y.header[i::ng]
             projector4d(yi, x, **kwargs)
         del yi
         return y
     def rmatvec(x):
         y = fa.fitsarray_from_header(cube_header)
         y[:] = 0
         for i in xrange(ng):
             xi = x[..., i::ng]
             xi.header = xi.header[i::ng]
             backprojector4d(xi, y, **kwargs)
         del xi
         return y
     lo.NDSOperator.__init__(self, xin=xin, xout=xout, matvec=matvec, rmatvec=rmatvec, dtype=xout.dtype)
Exemple #2
0
 def __init__(self, data_header, cube_header, **kwargs):
     self.data_header = data_header
     self.map_header = dict(cube_header)
     xin = fa.fitsarray_from_header(cube_header)
     xin.header = dict(xin.header)
     xin[:] = 0
     xout = dataarray_from_header(data_header)
     xout[:] = 0
     self.xin = xin
     self.xout = xout
     shapein = xin.shape
     shapeout = xout.shape
     def matvec(x):
         x = fa.InfoArray(data=x, header=dict(cube_header))
         y = xout
         y[:] = 0.
         projector(y, x, **kwargs)
         return y
     def rmatvec(x):
         x = fa.InfoArray(data=x, header=data_header)
         y = xin
         y[:] = 0.
         backprojector(x, y, **kwargs)
         return y
     lo.NDSOperator.__init__(self, shapein, shapeout, xin=xin, xout=xout,
                            matvec=matvec, rmatvec=rmatvec, dtype=xout.dtype)
Exemple #3
0
 def matvec(x):
     y = dataarray_from_header(data_header)
     y[:] = 0
     for i in xrange(ng):
         yi = y[..., i::ng]
         yi.header = y.header[i::ng]
         projector4d(yi, x, **kwargs)
     del yi
     return y
Exemple #4
0
def siddon_lo(data_header, cube_header, obstacle=None):
    """
    A linear operator performing projection and backprojection using
    Siddon.
    """
    data = dataarray_from_header(data_header)
    data[:] = 0
    cube = fa.fitsarray_from_header(cube_header)
    cube[:] = 0
    def matvec(x):
        y = dataarray_from_header(data_header)
        y[:] = 0
        projector(y, x, obstacle=obstacle)
        return y
    def rmatvec(x):
        y = fa.fitsarray_from_header(cube_header)
        y[:] = 0
        backprojector(x, y, obstacle=obstacle)
        return y
    return lo.ndsubclass(cube, data, matvec=matvec, rmatvec=rmatvec, dtype=data.dtype)
Exemple #5
0
 def matvec(x):
     y = dataarray_from_header(data_header)
     y[:] = 0
     projector4d(y, x, obstacle=obstacle)
     return y