Beispiel #1
0
def reduce_rawfile(args, leftover_args=[], existdb=None):
    if args.rawfile is not None:
        notify.print_info("Loading rawfile %s" % args.rawfile, 1)
        args.rawfile_id = load_rawfile.load_rawfile(args.rawfile, existdb)
    elif args.rawfile_id is None:
        # Neither a rawfile, nor a rawfile_id was provided
        raise errors.BadInputError("Either a rawfile, or a rawfile_id "
                                   "_must_ be provided!")
 
    if args.parfile is not None:
        notify.print_info("Loading parfile %s" % args.parfile, 1)
        args.parfile_id = load_parfile.load_parfile(args.parfile, existdb=existdb)
        
    if args.template is not None:
        notify.print_info("Loading template %s" % args.template, 1)
        args.template_id = load_template.load_template(args.template,
                                                       existdb=existdb)

    rawfile_info = rawfiles_general.get_rawfile_info(args.rawfile_id, existdb=existdb)

    if args.use_parfile:
        if args.parfile_id is None:
            args.parfile_id = parfiles_general.get_master_parfile(
                                                rawfile_info['pulsar_id'])[0]
            if args.parfile_id is None:
                raise errors.NoMasterError("A master parfile is required "
                                           "in the database if no parfile is "
                                           "provided on the command line.")
    else:
        args.parfile_id = None
 
    if args.template_id is None:
        args.template_id = templates_general.get_master_template(
                                                rawfile_info['pulsar_id'],
                                                rawfile_info['obssystem_id'],
                                                existdb=existdb)[0]
        if args.template_id is None:
            raise errors.NoMasterError("A master template is required "
                                       "in the database if no template is "
                                       "provided on the command line.")
 
    notify.print_info("Using the following IDs:\n"
                      "    rawfile_id: %s\n"
                      "    parfile_id: %s\n"
                      "    template_id: %s" %
                      (args.rawfile_id, args.parfile_id, args.template_id), 1)
    
    # Load manipulator
    manip = manipulators.load_manipulator(args.manip_name)
    manip.parse_args(leftover_args) 
    # Run pipeline core
    pipeline_core(manip, args.rawfile_id, args.parfile_id,
                  args.template_id, existdb)
Beispiel #2
0
def main():
    manip = manipulators.load_manipulator(args.manip_name)
    manip.parse_args(leftover_args)
    manip.run(args.infiles, outname=args.outfile)