def check_otf_map(value): if not isinstance(value, list): raise v.ValidateError("expected list, found %s" % (value,)) _frame = check_frame(value[0]) scan_axis = value[1].upper() logger.debug("scan axis: %s" % (scan_axis,)) if not scan_axis in frame.axes: raise v.ValidateError("not a valid axis: %s" % (scan_axis,)) start_point = value[2].upper() if not start_point in START_POINTS: raise v.ValidateError("not a valid start point: %s" % (start_point,)) length_x = angle_parser.check_angle(value[3]) length_y = angle_parser.check_angle(value[4]) speed = v.is_float(value[5], min=0) try: spacing = angle_parser.check_angle(value[6]) except: logger.debug("OTF map specify scans per beam") spacing = v.is_float(value[6], min=1) if scan_axis == "BOTH": logger.debug("exploding into separate scans") return (OTFMapScan(_frame, start_point, _frame.lon_name, length_x, length_y, spacing, speed), OTFMapScan(_frame, start_point, _frame.lat_name, length_x, length_y, spacing, speed)) else: logger.debug("got otf map") return OTFMapScan(_frame, start_point, scan_axis, length_x, length_y, spacing, speed)
def check_skydip_scan(value): if not isinstance(value, list): raise v.ValidateError("expected list, found %s" % (value,)) start = angle_parser.check_angle(value[0]) stop = angle_parser.check_angle(value[1]) duration = v.is_integer(value[2], min=1) return SkydipScan(start, stop, duration)
def check_onoff(value): if not isinstance(value, list): raise v.ValidateError("expected list, found %s" % (value,)) duration = v.is_float(value[0], min=0) offset_frame = check_frame(value[1]) offset_lon = angle_parser.check_angle(value[2]) offset_lat = angle_parser.check_angle(value[3]) sequence = check_onoff_sequence(value[4][1:-1]) #strip [ and ] return OnOffScan(duration, offset_lon, offset_lat, offset_frame, sequence)
def check_cross_scan(value): if not isinstance(value, list): raise v.ValidateError("expected list, found %s" % (value,)) _frame = check_frame(value[0]) length = angle_parser.check_angle(value[1]) speed = v.is_float(value[2]) return CrossScan(_frame, length, speed)
def _parse_target_line(line): """ Validate and parse a line of a txt file specifying a target of the schedule """ matches = TARGET_PATTERN.match(line) if not matches: logger.warning("invalid target line: " + line) return None, None else: logger.info("parsing target line: " + line) target_args = matches.groupdict() option_string = target_args.pop('optionals') option_args = (_parse_options(option_string)) if 'vdef' in option_args \ and 'vref' in option_args \ and 'rvel' in option_args: _target_vel = Velocity(option_args['rvel'], option_args['vdef'], option_args['vref']) else: _target_vel = ZERO_VELOCITY obs_coord = frame.Coord( rich_validator.check_frame(target_args['frame']), angle_parser.check_angle(target_args['longitude']), angle_parser.check_angle(target_args['latitude'])) obs_offset_coord = frame.Coord( option_args.get("offset_frame", obs_coord.frame), option_args.get("offset_lon", VAngle(0.0)), option_args.get("offset_lat", VAngle(0.0))) obs_target = ObservedTarget( label = target_args['label'], coord = obs_coord, offset = obs_offset_coord, velocity = _target_vel, repetitions = option_args.get('repetitions', None), tsys = option_args.get('tsys', None), ) return target_args['scanmode'], target_args['backend'], obs_target
def check_raster_map(value): if not isinstance(value, list): raise v.ValidateError("expected list, found %s" % (value,)) _frame = check_frame(value[0]) scan_axis = value[1].upper() if not scan_axis in frame.axes: raise v.ValidateError("not a valid axis: %s" % (scan_axis,)) start_point = value[2].upper() if not start_point in START_POINTS: raise v.ValidateError("not a valid start point: %s" % (start_point,)) length_x = angle_parser.check_angle(value[3]) length_y = angle_parser.check_angle(value[4]) duration = v.is_float(value[5], min=0) try: spacing = angle_parser.check_angle(value[6]) except: logger.debug("RASTER map specify scans per beam") spacing = v.is_float(value[6], min=1) return RasterMapScan(_frame, start_point, scan_axis, length_x, length_y, spacing, duration)