#!/usr/bin/env python
import argparse
from datetime import datetime
from velplot import make_figure

parser = argparse.ArgumentParser(prog='velplot',description='Velocity plot for quasar absorption line systems.')
parser.add_argument("fortfile", help='Input fort.13 model.')
parser.add_argument("--atom",metavar='',default='./atom.dat',help='Path to a custom atom.dat')
parser.add_argument("--cont",action='store_true',help='Consider continuum FITS file')
parser.add_argument("--details",action='store_true',help='Plot individual Voigt profiles')
parser.add_argument("--dispersion",metavar='',default=0.01,type=float,help='Spectral velocity dispersion for high-resolution individual Voigt profiles (in km/s)')
parser.add_argument("--dv",metavar='',type=float,help='Custom velocity range for plotting (in km/s)')
parser.add_argument("--error",action='store_true',help='Run VPFIT only once to get error estimates')
parser.add_argument("--extra",metavar='',help='Add vertical line to identify specific region. Multiple velocities can be specified by using the colon symbol (:) to separate the values')
parser.add_argument("--fit",action='store_true',help='Run VPFIT and embed final results in fort.13')
parser.add_argument("--getwave",action='store_true',help='Get wavelength array from the spectrum')
parser.add_argument("--header",metavar='',help='List of transition IDs for each fitting region (default: embedded in the fort file)')
parser.add_argument("--illcond",action='store_true',help='Run VPFIT with ill-conditioning')
parser.add_argument("--nores",action='store_true',help='Do not plot the residuals')
parser.add_argument("--output",metavar='',default=(datetime.now()).strftime('%y%m%d-%H%M%S'),help='Give custom output filename (default: date-time in yyyymmdd-HHMMSS format)')
parser.add_argument("--show",action='store_true',help='Flag whether the figure is shown using Python interface')
parser.add_argument("--unscale",action='store_true',help='Do not correct the data, instead distort the model')
parser.add_argument("--version",metavar='',default='vpfit',help='Path to a custom vpfit executable')
parser.add_argument("--vpsetup",metavar='',default='./vp_setup.dat',help='Path to a custom vp_setup.dat (default: in current repository)')
parser.add_argument("--zmid",metavar='',type=float,help='Central redshift to plot transitions')
args = parser.parse_args()

make_figure(args.fortfile,args.atom,args.details,args.dispersion,args.dv,args.error,
            args.extra,args.fit,args.getwave,args.header,args.illcond,args.nores,
            args.output,args.show,args.unscale,args.version,args.vpsetup,args.zmid,args.cont)
