parser.add_option('--fix-amp', action='store_true', default=False, help='Fix amplitude as well as phase in beamformer weights') # Set default value for any option (both standard and experiment-specific options) parser.set_defaults(description='Beamformer calibration', nd_params='off', dump_rate=1.0, mode='bc16n400M1k') # Parse the command line opts, args = parser.parse_args() # Check options and arguments and connect to KAT proxies and devices if len(args) == 0: raise ValueError("Please specify the target (and optionally calibrator) " "to observe as arguments") with verify_and_connect(opts) as kat: cbf = kat.dbe7 # Antennas and polarisations forming beamformer ants = ant_array(kat, opts.ants) pol = 'h' if opts.beamformer == 'bf0' else 'v' # Pick first target as main beamformer target target = collect_targets(kat, args[:1]).targets[0] # Determine beamformer weights if calibrator is provided if len(args) > 1: cal_target = collect_targets(kat, args[1:]).targets[0] cal_target = cal_target.add_tags('gaincal') user_logger.info('Obtaining beamformer weights on calibrator source %r' % (cal_target.name)) if not cal_target.flux_model: raise ValueError("Calibrator '%s' has no flux density model" % (cal_target.description,)) with start_session(kat, **vars(opts)) as session: session.standard_setup(**vars(opts))
else: user_logger.error('Unable to turn on delay tracking.') elif opts.no_delays and not kat.dry_run: if session.dbe.req.auto_delay('off'): user_logger.info("Turning off delay tracking.") else: user_logger.error('Unable to turn off delay tracking.') if session.dbe.req.zero_delay(): user_logger.info("Zeroed the delay values.") else: user_logger.error('Unable to zero delay values.') all_ants = session.ants # Form scanning antenna subarray (or pick the first antenna as the default scanning antenna) scan_ants = ant_array( kat, opts.scan_ants if opts.scan_ants else session.ants[0], 'scan_ants') # Assign rest of antennas to tracking antenna subarray track_ants = ant_array( kat, [ant for ant in all_ants if ant not in scan_ants], 'track_ants') # Disable noise diode by default (to prevent it firing on scan antennas only during scans) nd_params = session.nd_params session.nd_params = { 'diode': 'coupler', 'off': 0, 'on': 0, 'period': -1 } session.capture_start() start_time = time.time()
scan_ends = zip(stepping_coord, scanning_coord) if opts.scan_in_elevation else zip( -scanning_coord, -stepping_coord) # Check basic command-line options and obtain a kat object connected to the appropriate system with verify_and_connect(opts) as kat: targets = collect_targets(kat, args) # Initialise a capturing session (which typically opens an HDF5 file) with start_session(kat, **vars(opts)) as session: # Use the command-line options to set up the system session.standard_setup(**vars(opts)) all_ants = session.ants # Form scan antenna subarray (or pick the first antenna as the default scanning antenna) scan_ants = ant_array( kat, opts.scan_ants if opts.scan_ants else session.ants[0], 'scan_ants') # Disable noise diode by default (to prevent it firing on scan antennas only during scans) nd_params = session.nd_params session.nd_params = { 'diode': 'coupler', 'off': 0, 'on': 0, 'period': -1 } session.capture_start() user_logger.info("Using all antennas: %s" % (' '.join([ant.name for ant in session.ants]), )) for target in targets: # The entire sequence of commands on the same target forms a single compound scan