from bgpe.util.stellarpop import n_component from pystarlight.util.redenninglaws import calc_redlaw from bgpe.io.hdf5util import inithdf5, read_filterhdf5 from numpy.lib.recfunctions import drop_fields, merge_arrays, rename_fields from bgpe.io.readfilterset import readfilterset import cosmocalc from pystarlight.util.constants import L_sun from bgpe.util.cosmo import zcor from bgpe.photometry.syntphot import spec2filterset import os #logging import logging from bgpe.core.log import setConsoleLevel setConsoleLevel(logging.CRITICAL) def argparser(): ''' Defines the input and help options of the program... ''' parser = argparse.ArgumentParser(description='Convert STARLIGHT-SDSS input + output + table output to a hdf5 library database.') parser.add_argument('-B', metavar='BaseFile.txt', type=str, nargs=1, help='Input base file given on STARLIGHT standards. See STARLIGHT manual for details.', required=True) parser.add_argument('-Bd', metavar='/path/to/base_directory', type=str, nargs=1, help='The directory where Base files are stored', required=True) # parser.add_argument('-si', metavar='/path/to/sdss_directory', type=str, nargs=1, # help='The directory where SDSS Input .txt files are stored', required=True) # parser.add_argument('-st', metavar='/path/to/tables_directory', type=str, nargs=1, # help='The directory where output Tables are stored', required=True)
parser.add_argument('-dz', metavar='0.01', type=float, nargs=1, help='Delta redshift', required=True) parser.add_argument('-v', '-v', action='count') parser.add_argument('--version', action='version', version='%s version %s' % (_bgpe_name_, _bgpe_version_)) args = parser.parse_args() return args if __name__ == '__main__': t0 = time.time() # To measure execution times. args = argparser() #logging from bgpe.core.log import setConsoleLevel setConsoleLevel(logging.DEBUG) log = logging.getLogger('bgpe.starlight2photdb') # 0 - Main definitions in_dir = args.si[0] out_dir = args.so[0] tables_dir = args.st[0] aux = np.loadtxt(args.i[0], dtype = np.str).T infiles = aux[0] outfiles = aux[1] el_file = '%s/sample.F%s.%s.f.lines.dat.BS.bz2' % (tables_dir, args.d[0], args.sa[0]) syn01_file = '%s/sample.F%s.%s.f.Starlight.SYN01.tab.BS.bz2' % (tables_dir, args.d[0], args.sa[0]) syn02_file = '%s/sample.F%s.%s.f.Starlight.SYN02.tab.BS.bz2' % (tables_dir, args.d[0], args.sa[0]) syn03_file = '%s/sample.F%s.%s.f.Starlight.SYN03.tab.BS.bz2' % (tables_dir, args.d[0], args.sa[0]) syn04_file = '%s/sample.F%s.%s.f.Starlight.SYN04.tab.BS.bz2' % (tables_dir, args.d[0], args.sa[0])