Skip to content

Commit

Permalink
add TOAST MapMaker and FilterBin support to toast_so_sim.py (#102)
Browse files Browse the repository at this point in the history
  • Loading branch information
keskitalo authored Feb 2, 2021
1 parent 916ce1a commit f560e31
Show file tree
Hide file tree
Showing 3 changed files with 92 additions and 31 deletions.
119 changes: 89 additions & 30 deletions pipelines/toast_so_sim.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,8 @@ def parse_arguments(comm):
toast_tools.add_noise_args(parser)
toast_tools.add_gainscrambler_args(parser)
toast_tools.add_madam_args(parser)
toast_tools.add_mapmaker_args(parser)
toast_tools.add_filterbin_args(parser)
toast_tools.add_sky_map_args(parser)
toast_tools.add_sss_args(parser)
toast_tools.add_tidas_args(parser)
Expand Down Expand Up @@ -104,6 +106,22 @@ def parse_arguments(comm):
"--outdir", required=False, default="out", help="Output directory"
)

parser.add_argument(
"--madam",
required=False,
action="store_true",
help="Use libmadam for map-making",
dest="use_madam",
)
parser.add_argument(
"--no-madam",
required=False,
action="store_false",
help="Do not use libmadam for map-making [default]",
dest="use_madam",
)
parser.set_defaults(use_madam=True)

try:
args = parser.parse_args()
except SystemExit as e:
Expand Down Expand Up @@ -165,9 +183,9 @@ def main():

args, comm = parse_arguments(comm)

# Initialize madam parameters

madampars = toast_tools.setup_madam(args)
if args.use_madam:
# Initialize madam parameters
madampars = toast_tools.setup_madam(args)

if args.import_dir is not None:
schedules = None
Expand Down Expand Up @@ -320,20 +338,47 @@ def main():

# Bin and destripe maps

toast_tools.apply_madam(
args,
comm,
data,
madampars,
outpath,
detweights,
totalname,
time_comms=time_comms,
telescope_data=telescope_data,
first_call=(mc == firstmc),
)
if args.use_madam:
toast_tools.apply_madam(
args,
comm,
data,
madampars,
outpath,
detweights,
totalname,
time_comms=time_comms,
telescope_data=telescope_data,
first_call=(mc == firstmc),
)
else:
toast_tools.apply_mapmaker(
args,
comm,
data,
outpath,
totalname,
time_comms=time_comms,
telescope_data=telescope_data,
first_call=(mc == firstmc),
)

memreport("after madam", comm.comm_world)
memreport("after destriper", comm.comm_world)

if (
args.filterbin_ground_order is not None
or args.filterbin_poly_order is not None
):
toast_tools.apply_filterbin(
args,
comm,
data,
outpath,
totalname,
time_comms=time_comms,
telescope_data=telescope_data,
first_call=(mc == firstmc),
)

if args.apply_polyfilter or args.apply_groundfilter or args.demodulate:

Expand All @@ -357,20 +402,34 @@ def main():

# Bin maps

toast_tools.apply_madam(
args,
comm,
data,
madampars,
outpath,
detweights,
totalname,
time_comms=time_comms,
telescope_data=telescope_data,
first_call=args.demodulate,
extra_prefix="filtered",
bin_only=True,
)
if args.use_madam:
toast_tools.apply_madam(
args,
comm,
data,
madampars,
outpath,
detweights,
totalname,
time_comms=time_comms,
telescope_data=telescope_data,
first_call=args.demodulate,
extra_prefix="filtered",
bin_only=True,
)
else:
toast_tools.apply_mapmaker(
args,
comm,
data,
outpath,
totalname,
time_comms=time_comms,
telescope_data=telescope_data,
first_call=False,
extra_prefix="filtered",
bin_only=True,
)

memreport("after filter & bin", comm.comm_world)

Expand Down
1 change: 1 addition & 0 deletions sotodlib/toast/pipeline_tools/crosslinking.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# Copyright (c) 2020 Simons Observatory.
# Full license can be found in the top level "LICENSE" file.

import argparse

import numpy as np

Expand Down
3 changes: 2 additions & 1 deletion sotodlib/toast/pipeline_tools/hardware.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,8 @@ def add_hw_args(parser):
"--tube_slots",
required=True,
help="Comma-separated list of optics tube slots: c1 (UHF), i5 (UHF), "
" i6 (MF), i1 (MF), i3 (MF), i4 (MF), o6 (LF). "
" i6 (MF), i1 (MF), i3 (MF), i4 (MF), o6 (LF),"
" ST1 (MF), ST2 (MF), ST3 (UHF), ST4 (LF)."
"Length of list must equal --bands",
)
return
Expand Down

0 comments on commit f560e31

Please sign in to comment.