Skip to content

Commit

Permalink
add 'mc' keyword to sky signal simulation tools
Browse files Browse the repository at this point in the history
  • Loading branch information
keskitalo committed Nov 8, 2019
1 parent 73dc46f commit e95b7c6
Showing 1 changed file with 8 additions and 7 deletions.
15 changes: 8 additions & 7 deletions src/toast/pipeline_tools/sky_signal.py
Original file line number Diff line number Diff line change
Expand Up @@ -251,7 +251,7 @@ def apply_conviqt(args, comm, data, cache_prefix="signal", verbose=True):

@function_timer
def scan_sky_signal(
args, comm, data, cache_prefix="signal", verbose=True, pixels="pixels",
args, comm, data, cache_prefix="signal", verbose=True, pixels="pixels", mc=0,
):
""" Scan sky signal from a map.
Expand All @@ -266,13 +266,11 @@ def scan_sky_signal(
if comm.world_rank == 0 and verbose:
log.info("Scanning input map")

npix = 12 * args.nside ** 2

# Scan the sky signal
if comm.world_rank == 0 and not os.path.isfile(args.input_map):
raise RuntimeError("Input map does not exist: {}".format(args.input_map))
distmap = DistPixels(data, nnz=3, dtype=np.float32, pixels=pixels,)
distmap.read_healpix_fits(args.input_map)
distmap = DistPixels(data, nnz=3, dtype=np.float32, pixels=pixels)
distmap.read_healpix_fits(args.input_map.format(mc))
scansim = OpSimScan(distmap=distmap, out=cache_prefix)
scansim.exec(data)

Expand All @@ -286,7 +284,7 @@ def scan_sky_signal(

@function_timer
def simulate_sky_signal(
args, comm, data, focalplanes, cache_prefix, verbose=False, pixels="pixels",
args, comm, data, focalplanes, cache_prefix, verbose=False, pixels="pixels", mc=0,
):
""" Use PySM to simulate smoothed sky signal.
Expand All @@ -295,13 +293,16 @@ def simulate_sky_signal(
return None
timer = Timer()
timer.start()
fn_cmb = args.pysm_precomputed_cmb_K_CMB
if fn_cmb is not None:
fn_cmb = fn_cmb.format(mc)
# Convolve a signal TOD from PySM
op_sim_pysm = OpSimPySM(
data,
comm=getattr(comm, "comm_" + args.pysm_mpi_comm),
out=cache_prefix,
pysm_model=args.pysm_model.split(","),
pysm_precomputed_cmb_K_CMB=args.pysm_precomputed_cmb_K_CMB,
pysm_precomputed_cmb_K_CMB=fn_cmb,
focalplanes=focalplanes,
apply_beam=args.pysm_apply_beam,
coord=args.coord,
Expand Down

0 comments on commit e95b7c6

Please sign in to comment.