# generate our signal only sim split = sph_tools.alm2map(alms_beamed, template[sv]) # compute the alms of the sim master_alms[sv, ar, "nofilter"] = sph_tools.get_alms( split, window_tuple, niter, lmax, dtype=sim_alm_dtype) # apply the k-space filter binary = so_map.read_map("%s/binary_%s_%s.fits" % (window_dir, sv, ar)) norm, split = data_analysis_utils.get_filtered_map( split, binary, filter[sv], weighted_filter=ks_f["weighted"]) # compute the alms of the filtered sim master_alms[sv, ar, "filter"] = sph_tools.get_alms(split, window_tuple, niter, lmax, dtype=sim_alm_dtype) master_alms[sv, ar, "filter"] /= (split.data.shape[1] * split.data.shape[2])**norm print(scenario, sv, ar, time.time() - t0)
print("%s split of survey: %s, array %s"%(nsplit[sv], sv, ar)) t = time.time() for k, map in enumerate(maps): if win_T.pixel == "CAR": split = so_map.read_map(map, geometry=win_T.data.geometry) if d["src_free_maps"] == True: point_source_map = so_map.read_map(map.replace(".fits", "_model.fits")) point_source_mask = so_map.read_map(d["ps_mask"]) split = data_analysis_utils.get_coadded_map(split, point_source_map, point_source_mask) if d["use_kspace_filter"]: print("apply kspace filter on %s" %map) binary = so_map.read_map("%s/binary_%s_%s.fits" % (window_dir, sv, ar)) split = data_analysis_utils.get_filtered_map( split, binary, vk_mask=d["vk_mask"], hk_mask=d["hk_mask"], normalize=False) elif win_T.pixel == "HEALPIX": split = so_map.read_map(map) split.data *= cal if d["remove_mean"] == True: split = data_analysis_utils.remove_mean(split, window_tuple, ncomp) #split.plot(file_name="%s/split_%d_%s_%s" % (plot_dir, k, sv, ar), color_range=[250, 100, 100]) master_alms[sv, ar, k] = sph_tools.get_alms(split, window_tuple, niter, lmax) if d["use_kspace_filter"]: # there is an extra normalisation for the FFT/IFFT bit # note that we apply it here rather than at the FFT level because correcting the alm is faster than correcting the maps master_alms[sv, ar, k] /= (split.data.shape[1]*split.data.shape[2])
if point_source_map_name == map: raise ValueError( "No model map is provided! Check map names!") point_source_map = so_map.read_map(point_source_map_name) point_source_mask = so_map.read_map(d["ps_mask_%s_%s" % (sv, ar)]) split = data_analysis_utils.get_coadded_map( split, point_source_map, point_source_mask) if ks_f["apply"]: print("apply kspace filter on %s" % map) binary = so_map.read_map("%s/binary_%s_%s.fits" % (window_dir, sv, ar)) norm, split = data_analysis_utils.get_filtered_map( split, binary, filter[sv], inv_pixwin_lxly=inv_pixwin_lxly, weighted_filter=ks_f["weighted"]) else: print("WARNING: no kspace filter is applied") if deconvolve_pixwin: binary = so_map.read_map("%s/binary_%s_%s.fits" % (window_dir, sv, ar)) norm, split = data_analysis_utils.deconvolve_pixwin_CAR( split, binary, inv_pixwin_lxly) elif window_tuple[0].pixel == "HEALPIX": split = so_map.read_map(map) split.data *= cal