#!/usr/bin/env python
""""
ACTION
 - Reads in ile output.  Outputs flat ascii file, compatible with tools that parse lalinference output
EXAMPLES
  gsiscp ldas-jobs.ligo.caltech.edu:~pankow/param_est/data/zero_noise_mdc/unpin_single/zero_noise_tref_unpinned.xml.gz 
  python convert_output_format_ile2inference zero_noise_tref_unpinned.xml.gz  | more



"""


import sys
from optparse import OptionParser
import numpy as np
from igwn_ligolw import utils, table, lsctables, ligolw
try:
    import h5py
except:
    print(" - no h5py - ")


# Contenthandlers : argh
#   - http://software.ligo.org/docs/glue/
lsctables.use_in(ligolw.LIGOLWContentHandler)

def mc(m1,m2):
    return np.power(m1*m2, 3./5.)/np.power(m1+m2, 1./5.)
def eta(m1,m2):
    return m1*m2/(np.power(m1+m2, 2))


optp = OptionParser()
optp.add_option("--fref",default=20,type=float,help="Reference frequency. Depending on approximant and age of implementation, may be ignored")
optp.add_option("--export-extra-spins",action='store_true',help="Reference frequency. Depending on approximant and age of implementation, may be ignored")
optp.add_option("--export-tides",action='store_true',help="Include tidal parameters")
optp.add_option("--export-cosmology",action='store_true',help="Include source frame masses and redshift")
optp.add_option("--export-weights",action='store_true',help="Include a field 'weights' equal to L p/ps")
optp.add_option("--export-eccentricity", action="store_true", help="Include eccentricity")
optp.add_option("--with-cosmology",default="Planck15",help="Specific cosmology to use")
optp.add_option("--use-interpolated-cosmology",action='store_true',help="Specific cosmology to use")
optp.add_option("--convention",default="RIFT",help="RIFT|LI")
opts, args = optp.parse_args()

print("Input: ", ' '.join(args))
print("Output: ", 'stdout')
