#!/usr/bin/env python

import argparse
from refstis.weekdark import make_weekdark

#-------------------------------------------------------------------------------

def parse_args():
    '''
    Parse command line arguments.  Returns args object.
    '''

    parser = argparse.ArgumentParser()

    parser.add_argument('files',
                        nargs='*',
                        help='input files to turn into reference file')

    parser.add_argument('-o',
                        dest='outname',
                        type=str,
                        default='basebias.fits',
                        help='output name for the reference file')

    parser.add_argument('-b',
                        dest='biasname',
                        type=str,
                        default=None,
                        help='Bias file for calibration.')

    parser.add_argument('-d',
                        dest='darkname',
                        type=str,
                        default='',
                        help='base dark file for calibration.')

    return parser.parse_args()

#-------------------------------------------------------------------------------

if __name__ == "__main__":
    args = parse_args()
    make_weekdark(args.files,
                  args.outname,
                  args.darkname,
                  thebiasfile=args.biasname)
