Пример #1
0
def uncompress(ctod, C, factor):
    uctod = tm.Tod(np.zeros((ctod.shape[0], ctod.shape[1] * factor)))
    y0, t = lo.sparse.spl.cgs(C.T * C, C.T * ctod.flatten())
    uctod[:] = y0.reshape(uctod.shape)
    return uctod
Пример #2
0
def compress(tod, C, factor):
    ctod = (C * tod.flatten())
    ctod = ctod.reshape((tod.shape[0] ,tod.shape[1] / factor))
    ctod = tm.Tod(ctod, mask=np.zeros(ctod.shape, dtype=np.int8))
    ctod.nsamples = [ns / factor for ns in tod.nsamples]
    return ctod
Пример #3
0
#header['NAXIS1'] = 192
#header['NAXIS2'] = 192
#header['CRPIX1'] = 96
#header['CRPIX2'] = 96
header.update('CDELT1', resolution / 3600)
header.update('CDELT2', resolution / 3600)
# data
tod = pacs.get_tod()
y = tod.flatten()
# remove bad pixels (by updating mask !)
#tod = remove_bad_pixels(tod)
# compress data
factor = 8
C = csh.cs(tod.shape, factor=8)
ctod = (C * tod.flatten()).reshape((tod.shape[0], tod.shape[1] / factor))
ctod = tm.Tod(ctod)
ctod.nsamples = [ns / factor for ns in tod.nsamples]
# uncompress for deglitching
uctod = tod.copy(tod.shape)
y0, t = lo.spl.cgs(C.T * C, C.T * ctod.flatten())
uctod[:] = y0.reshape(tod.shape)
#uctod[:] = (C.T * ctod.flatten()).reshape(tod.shape)

# deglitching
projection = tm.Projection(pacs,
                           header=header,
                           resolution=3.,
                           npixels_per_sample=6)
uctod.mask = tm.deglitch_l2mad(uctod, projection)
#ctod = compression.direct(uctod)
# model
Пример #4
0
def compress(tod, C, factor):
    ctod = (C * tod.flatten())
    ctod = ctod.reshape((tod.shape[0], tod.shape[1] / factor))
    ctod = tm.Tod(ctod)
    ctod.nsamples = [ns / factor for ns in tod.nsamples]
    return ctod
Пример #5
0
def uncompress(ctod, C, factor):
    uctod = tm.Tod(np.zeros((ctod.shape[0], ctod.shape[1] * factor)))
    y0, t = spl.cgs(C.T * C, C.T * ctod.flatten())
    uctod[:] = y0.reshape(uctod.shape)
    uctod.nsamples = [ns * factor for ns in ctod.nsamples]
    return uctod