Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add TOAST MapMaker and FilterBin support to toast_so_sim.py #102

Merged
merged 1 commit into from
Feb 2, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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