def parse_arguments(comm, procs): log = Logger.get() parser = argparse.ArgumentParser( description="Simulate satellite boresight pointing and make a map.", fromfile_prefix_chars="@", ) add_dist_args(parser) add_pointing_args(parser) add_tidas_args(parser) add_spt3g_args(parser) add_dipole_args(parser) add_pysm_args(parser) add_mc_args(parser) add_noise_args(parser) add_todsatellite_args(parser) parser.add_argument("--outdir", required=False, default="out", help="Output directory") parser.add_argument( "--debug", required=False, default=False, action="store_true", help="Write diagnostics", ) add_madam_args(parser) add_binner_args(parser) 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=False) parser.add_argument( "--focalplane", required=False, default=None, help="Pickle file containing a dictionary of detector properties. " "The keys of this dict are the detector names, and each value is also " 'a dictionary with keys "quat" (4 element ndarray), "fwhm" ' '(float, arcmin), "fknee" (float, Hz), "alpha" (float), and "NET" ' '(float). For optional plotting, the key "color" can specify a ' "valid matplotlib color string.", ) parser.add_argument( "--gain", required=False, default=None, help="Calibrate the input timelines with a set of gains from a" "FITS file containing 3 extensions:" "HDU named DETECTORS : table with list of detector names in a column named DETECTORS" "HDU named TIME: table with common timestamps column named TIME" "HDU named GAINS: 2D image of floats with one row per detector and one column per value.", ) try: args = parser.parse_args() except SystemExit: sys.exit() if comm.world_rank == 0: log.info("\n") log.info("All parameters:") for ag in vars(args): log.info("{} = {}".format(ag, getattr(args, ag))) log.info("\n") groupsize = args.group_size if groupsize is None or groupsize <= 0: groupsize = procs # This is the 2-level toast communicator. comm = Comm(groupsize=groupsize) return args, comm, groupsize
def parse_arguments(comm): timer = Timer() timer.start() log = Logger.get() parser = argparse.ArgumentParser( description="Simulate ground-based boresight pointing. Simulate " "atmosphere and make maps for some number of noise Monte Carlos.", fromfile_prefix_chars="@", ) toast_tools.add_dist_args(parser) toast_tools.add_todground_args(parser) toast_tools.add_pointing_args(parser) toast_tools.add_polyfilter_args(parser) toast_tools.add_groundfilter_args(parser) toast_tools.add_atmosphere_args(parser) 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) toast_tools.add_mc_args(parser) so_tools.add_corotator_args(parser) so_tools.add_time_constant_args(parser) so_tools.add_demodulation_args(parser) so_tools.add_h_n_args(parser) so_tools.add_crosslinking_args(parser) so_tools.add_cadence_map_args(parser) so_tools.add_hw_args(parser) so_tools.add_so_noise_args(parser) so_tools.add_pysm_args(parser) so_tools.add_export_args(parser) toast_tools.add_debug_args(parser) so_tools.add_import_args(parser) so_tools.add_sim_sso_args(parser) so_tools.add_flag_sso_args(parser) so_tools.add_sim_hwpss_args(parser) parser.add_argument( "--no-maps", required=False, default=False, action="store_true", help="Disable all mapmaking.", ) parser.add_argument("--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: sys.exit() if len(args.bands.split(",")) != 1: # Multi frequency run. We don't support multiple copies of # scanned signal. if args.input_map: raise RuntimeError( "Multiple frequencies are not supported when scanning from a map" ) if args.weather is None: raise RuntimeError("You must provide a TOAST weather file") if comm.world_rank == 0: log.info("\n") log.info("All parameters:") for ag in vars(args): log.info("{} = {}".format(ag, getattr(args, ag))) log.info("\n") if args.group_size: comm = Comm(groupsize=args.group_size) if comm.world_rank == 0: if not os.path.isdir(args.outdir): try: os.makedirs(args.outdir) except FileExistsError: pass timer.report_clear("Parse arguments") return args, comm
def parse_arguments(comm): timer = Timer() timer.start() log = Logger.get() parser = argparse.ArgumentParser( description="Simulate ground-based boresight pointing. Simulate " "atmosphere and make maps for some number of noise Monte Carlos.", fromfile_prefix_chars="@", ) toast_tools.add_dist_args(parser) toast_tools.add_todground_args(parser) toast_tools.add_pointing_args(parser) toast_tools.add_polyfilter_args(parser) toast_tools.add_polyfilter2D_args(parser) toast_tools.add_common_mode_filter_args(parser) toast_tools.add_groundfilter_args(parser) toast_tools.add_atmosphere_args(parser) toast_tools.add_noise_args(parser) toast_tools.add_gainscrambler_args(parser) toast_tools.add_madam_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) toast_tools.add_mc_args(parser) s4_tools.add_hw_args(parser) s4_tools.add_s4_noise_args(parser) s4_tools.add_pysm_args(parser) toast_tools.add_debug_args(parser) parser.add_argument( "--no-maps", required=False, default=False, action="store_true", help="Disable all mapmaking.", ) parser.add_argument( "--skip-madam", required=False, default=False, action="store_true", help="Skip the first Madam call.", ) parser.add_argument( "--pairdiff", required=False, default=False, action="store_true", help="Pair-difference TOD and pointing.", ) parser.add_argument("--outdir", required=False, default="out", help="Output directory") try: args = parser.parse_args() except SystemExit as e: sys.exit() if len(args.bands.split(",")) != 1: # Multi frequency run. We don't support multiple copies of # scanned signal. if args.input_map: raise RuntimeError( "Multiple frequencies are not supported when scanning from a map" ) if args.simulate_atmosphere and args.weather is None: raise RuntimeError( "Cannot simulate atmosphere without a TOAST weather file") if comm.world_rank == 0: log.info("\n") log.info("All parameters:") for ag in vars(args): log.info("{} = {}".format(ag, getattr(args, ag))) log.info("\n") if args.group_size: comm = Comm(groupsize=args.group_size) if comm.world_rank == 0: os.makedirs(args.outdir, exist_ok=True) timer.report_clear("Parse arguments") return args, comm
def parse_arguments(comm): timer = Timer() timer.start() log = Logger.get() parser = argparse.ArgumentParser( description="Simulate ground-based boresight pointing. Simulate " "atmosphere and make maps for some number of noise Monte Carlos.", fromfile_prefix_chars="@", ) add_dist_args(parser) add_debug_args(parser) add_todground_args(parser) add_pointing_args(parser) add_polyfilter_args(parser) add_groundfilter_args(parser) add_atmosphere_args(parser) add_noise_args(parser) add_gainscrambler_args(parser) add_madam_args(parser) add_sky_map_args(parser) add_pysm_args(parser) add_sss_args(parser) add_tidas_args(parser) add_spt3g_args(parser) add_mc_args(parser) parser.add_argument("--outdir", required=False, default="out", help="Output directory") parser.add_argument( "--focalplane", required=False, default=None, help="Pickle file containing a dictionary of detector " "properties. The keys of this dict are the detector " "names, and each value is also a dictionary with keys " '"quat" (4 element ndarray), "fwhm" (float, arcmin), ' '"fknee" (float, Hz), "alpha" (float), and ' '"NET" (float).', ) parser.add_argument( "--freq", required=True, help="Comma-separated list of frequencies with identical focal planes." " They override the bandpasses in the focalplane for the purpose of" " scaling the atmospheric signal but not for simulating the sky signal.", ) try: args = parser.parse_args() except SystemExit: sys.exit(0) if args.tidas is not None: if not tidas_available: raise RuntimeError("TIDAS not found- cannot export") if args.spt3g is not None: if not spt3g_available: raise RuntimeError("SPT3G not found- cannot export") if len(args.freq.split(",")) != 1: # Multi frequency run. We don't support multiple copies of # scanned signal. if args.input_map: raise RuntimeError( "Multiple frequencies are not supported when scanning from a map" ) if args.simulate_atmosphere and args.weather is None: raise RuntimeError( "Cannot simulate atmosphere without a TOAST weather file") if comm.world_rank == 0: log.info("All parameters:") for ag in vars(args): log.info("{} = {}".format(ag, getattr(args, ag))) if args.group_size: comm = Comm(groupsize=args.group_size) if comm.world_rank == 0: os.makedirs(args.outdir, exist_ok=True) timer.stop() if comm.world_rank == 0: timer.report("Parsed parameters") return args, comm
def parse_arguments(comm): timer = Timer() timer.start() log = Logger.get() parser = argparse.ArgumentParser( description="Simulate ground-based boresight pointing. Simulate " "atmosphere and make maps for some number of noise Monte Carlos.", fromfile_prefix_chars="@", ) toast_tools.add_dist_args(parser) toast_tools.add_todground_args(parser) toast_tools.add_pointing_args(parser) toast_tools.add_polyfilter_args(parser) toast_tools.add_groundfilter_args(parser) toast_tools.add_noise_args(parser) toast_tools.add_sky_map_args(parser) toast_tools.add_mc_args(parser) so_tools.add_hw_args(parser) so_tools.add_so_noise_args(parser) so_tools.add_pysm_args(parser) so_tools.add_export_args(parser) toast_tools.add_debug_args(parser) parser.add_argument("--outdir", required=False, default="out", help="Output directory") parser.add_argument("--map-prefix", required=False, default="toast", help="Output map prefix") parser.add_argument( "--madam", required=False, action="store_true", help="Use libmadam to bin the signal", dest="madam", ) parser.add_argument( "--no-madam", required=False, action="store_false", help="Do not use libMadam to bin the signal", dest="madam", ) parser.set_defaults(madam=False) parser.add_argument( "--madam-conserve-memory", required=False, action="store_true", help="Stage the Madam buffer packing", dest="madam_conserve_memory", ) parser.add_argument( "--no-madam-conserve-memory", required=False, action="store_false", help="Do not stage the Madam buffer packing", dest="madam_conserve_memory", ) parser.set_defaults(madam_conserve_memory=True) parser.add_argument( "--madam-allreduce", required=False, action="store_true", help="Use the allreduce communication pattern in Madam", dest="madam_allreduce", ) parser.add_argument( "--no-madam-allreduce", required=False, action="store_false", help="Do not use the allreduce communication pattern in Madam", dest="madam_allreduce", ) parser.set_defaults(madam_allreduce=False) parser.add_argument( "--madam-concatenate-messages", required=False, action="store_true", help="Use the alltoallv commucation pattern in Madam", dest="madam_concatenate_messages", ) parser.add_argument( "--no-madam-concatenate-messages", required=False, action="store_false", help="Use the point-to-point communication pattern in Madam", dest="madam_concatenate_messages", ) parser.set_defaults(madam_concatenate_messages=True) try: args = parser.parse_args() except SystemExit as e: sys.exit() if len(args.bands.split(",")) != 1: # Multi frequency run. We don't support multiple copies of # scanned signal. if args.input_map: raise RuntimeError( "Multiple frequencies are not supported when scanning from a map" ) if comm.world_rank == 0: log.info("\n") log.info("All parameters:") for ag in vars(args): log.info("{} = {}".format(ag, getattr(args, ag))) log.info("\n") if args.group_size: comm = Comm(groupsize=args.group_size) if comm.world_rank == 0: if not os.path.isdir(args.outdir): try: os.makedirs(args.outdir) except FileExistsError: pass timer.report_clear("Parse arguments") return args, comm