Exemplo n.º 1
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)
Exemplo n.º 2
0
#!/usr/bin/env python
from tamasis import *
import numpy as np
import lo
import scipy.sparse.linalg as spl

# data
pacs = PacsObservation(filename=tamasis_dir + 'tests/frames_blue.fits',
                       fine_sampling_factor=1,
                       keep_bad_detectors=False)
tod = pacs.get_tod()
# projector
projection = Projection(pacs,
                        resolution=3.2,
                        oversampling=False,
                        npixels_per_sample=6)
model = projection
# naive map
backmap = model.transpose(tod)
# transform to lo
P = lo.ndsubclass(backmap, tod, matvec=model.direct, rmatvec=model.transpose)
# priors
Dx = lo.diff(backmap.shape, axis=0, dtype=np.float64)
Dy = lo.diff(backmap.shape, axis=1, dtype=np.float64)
#Dw = lo.pywt_lo.wavedec2(backmap.shape, "haar")
# inversion
y = tod.flatten()
x = lo.iterative.acg(P, (Dx, Dy), (1e1, 1e1), y)
sol = backmap.zeros(backmap.shape)
sol[:] = x.reshape(sol.shape)
Exemplo n.º 3
0
                       fine_sampling_factor=1,
                       keep_bad_detectors=True,
                       mask_bad_line=True
                       )
tod = pacs.get_tod()
# set bad detectors to 0
bd_mask = pacs.bad_detector_mask.flatten()
for i in xrange(tod.shape[1]): tod[bd_mask, i] = 0
# compression model
C = cs(tod.shape, 8)
# compress data
ctod = C * tod.flatten()
# projector
projection = Projection(pacs, resolution=3.2, oversampling=False, npixels_per_sample=6)
model = projection
# naive map
backmap = model.transpose(tod)
# transform to lo
P = lo.ndsubclass(backmap, tod, matvec=model.direct, rmatvec=model.transpose)
# full model
A = C * P
# priors
Dx = lo.diff(backmap.shape, axis=0, dtype=np.float64)
Dy = lo.diff(backmap.shape, axis=1, dtype=np.float64)
#Dw = lo.pywt_lo.wavedec2(backmap.shape, "haar")
# inversion
y = ctod.flatten()
x, conv = lo.rls(A, (Dx, Dy), (1e1, 1e1),  y)
sol = backmap.zeros(backmap.shape)
sol[:] = x.reshape(sol.shape)