Ejemplo n.º 1
0
del myscans  # scans do take up some space, even without the tod being read in
myinds, myscans = scanutils.read_scans(ids,
                                       myinds,
                                       actscan.ACTScan,
                                       filedb.data,
                                       dets=args.dets,
                                       downsample=config.get("downsample"))

L.info("Reading input map")
if not is_dmap: imap = enmap.read_map(args.imap)
else: imap = dmap.read_map(args.imap, bbox=mybbox, tshape=tshape, comm=comm)
dtype = "=f" if imap.dtype == np.float32 else "=d"
imap = imap.astype(dtype, copy=True)

L.info("Initializing signals")
signal_cut = mapmaking.SignalCut(myscans, imap.dtype, comm=comm)
if not is_dmap:
    signal_map = mapmaking.SignalMap(myscans, imap, comm=comm)
    precon = mapmaking.PreconMapBinned(signal_map,
                                       signal_cut,
                                       myscans, [],
                                       noise=False,
                                       hits=False)
else:
    signal_map = mapmaking.SignalDmap(myscans, mysubs, imap, sys=args.sys)
    precon = mapmaking.PreconDmapBinned(signal_map,
                                        signal_cut,
                                        myscans, [],
                                        noise=False,
                                        hits=False)
Ejemplo n.º 2
0
    root_tot = root
for out_ind in range(nouter):
    if args.individual:
        myscans = myscans_tot[out_ind:out_ind + 1]
        root = root_tot + myscans[0].entry.id + "_"

    # 1. Initialize signals
    L.info("Initializing signals")
    signals = []
    for param in signal_params:
        effname = get_effname(param)
        active_scans = apply_scan_limits(myscans, param)
        if param["type"] == "cut":
            signal = mapmaking.SignalCut(active_scans,
                                         dtype=dtype,
                                         comm=comm,
                                         name=effname,
                                         ofmt=param["ofmt"],
                                         output=param["output"] == "yes")
            signal_cut = signal
        elif param["type"] == "map":
            area = enmap.read_map(param["value"])
            area = enmap.zeros((args.ncomp, ) + area.shape[-2:], area.wcs,
                               dtype)
            signal = mapmaking.SignalMap(active_scans,
                                         area,
                                         comm=comm,
                                         name=effname,
                                         ofmt=param["ofmt"],
                                         output=param["output"] == "yes",
                                         sys=param["sys"])
        elif param["type"] == "fmap":
Ejemplo n.º 3
0
     except errors.DataMissing as e:
         L.debug("Skipped %s (%s)" % (id, str(e)))
         continue
 # Count how many scans we actually managed to read
 nscan = comm_world.allreduce(len(scans))
 if nscan == 0:
     L.debug("Skipped group %d (failed to read scans)" % gind)
     continue
 # Record which ids went into this map
 with open(proot + "ids.txt", "w") as f:
     for ind in group:
         f.write("%s\n" % ids[ind])
 # Set up mapmaking for this group
 weights = [mapmaking.FilterWindow(config.get("tod_window"))
            ] if config.get("tod_window") else []
 signal_cut = mapmaking.SignalCut(scans, dtype, comm_sub)
 signal_phase = mapmaking.SignalPhase(scans,
                                      pids=[0] * len(scans),
                                      patterns=pboxes[pid:pid + 1],
                                      array_shape=(args.nrow, args.ncol),
                                      res=daz,
                                      dtype=dtype,
                                      comm=comm_sub,
                                      cuts=signal_cut,
                                      ofmt="phase")
 signal_cut.precon = mapmaking.PreconCut(signal_cut, scans)
 signal_phase.precon = mapmaking.PreconPhaseBinned(signal_phase, signal_cut,
                                                   scans, weights)
 filters = []
 if args.dedark:
     filters.append(mapmaking.FilterDedark())
Ejemplo n.º 4
0
for ti in range(comm.rank, len(tasks), comm.size):
    si, id = tasks[ti]
    bid = id.replace(":", "_")
    L.info("Processing src %3d id %s" % (si, id))
    root = args.odir + "/src%03d_%s_" % (si, bid)
    entry = filedb.data[id]
    osys = "hor:%.6f_%.6f:cel/0_0:hor" % tuple(srcs[:2, si])
    try:
        scans = [actscan.ACTScan(entry)]
        if scans[0].nsamp == 0 or scans[0].ndet == 0:
            raise errors.DataMissing("no data in scan")
    except errors.DataMissing as e:
        print "Skipping %s: %s" % (id, str(e))
        continue
    # Signals
    signal_cut = mapmaking.SignalCut(scans, dtype=dtype, comm=tcomm)
    signal_map = mapmaking.SignalMap(scans, area, comm=tcomm, sys=osys)
    # Weights
    weights = [mapmaking.FilterWindow(config.get("tod_window"))]
    # And equation system
    eqsys = mapmaking.Eqsys(scans, [signal_cut, signal_map],
                            weights=weights,
                            dtype=dtype,
                            comm=tcomm)
    eqsys.calc_b()
    # Precons
    signal_cut.precon = mapmaking.PreconCut(signal_cut, scans)
    signal_map.precon = mapmaking.PreconMapBinned(signal_map, signal_cut,
                                                  scans, weights)

    cg = CG(eqsys.A, eqsys.b, M=eqsys.M, dot=eqsys.dot)