import fcntl
import os
import os.path
import sys
import shutil
import platform
import argparse
import flare
import flare_submit
import astropy.units as units
from astropy.cosmology import Planck15 as cosmo
import math
import numpy
import subprocess
import time
import string

#This script controls runs for a multidimensional parameter space survey, 
#The survey compares Fisher v Bayes, mergers v not and higher-modes v 22 only. 
#Progress is recorded and new runs are issued based on a status list file

#First step is setting up the parameter cases:
Ms=[ "1e2", "1e4", "1e6" ] 
qs=[ "2", "8" ]
incs=[ "12", "03", "02" ]
zs=[ "1", "4", "20" ]
#Corresponding distances from astropy.cosmology.Planck15, in Mpc
lum_dist={"1":6791.811049825756, "4":36697.04066923789, "20":230421.93422332808}
modes=[ "lm2", "all" ]
wfs= [ "full", "insp" ]
#orientation: ref (lambda=3pi/4,phi0=pi/3,pol=pi/3,beta=pi/3)
codes=[ "b", "p" ]

print "run_control invoked with args: ",sys.argv
#parse ars
parser = argparse.ArgumentParser(description="Control runs for parameter space survey");
parser.add_argument('name',help="The basename for the status list")