import argparse import os import time import auxiliary as aux import numlte as nl import pyfi as fh parser = argparse.ArgumentParser(description="Crunches a grid from Radex in a more treatable file") parser.add_argument("infile", type=str, help="Grid input File") parser.add_argument("output", type=str, help="Name of the Radex output file") args = parser.parse_args() filein = open(args.infile, 'r') fileAsList = fh.strip_off_comm(filein) filein.close() molecule = fileAsList[0] fileAsList = fh.float_file(fileAsList[1:]) colmin = fileAsList[0][0] colmax = fileAsList[0][1] ncoldens = int(fileAsList[0][2]) freqrange = [fileAsList[1][0], fileAsList[1][1]] nmin = fileAsList[2][0] nmax = fileAsList[2][1] ndens = int(fileAsList[2][2]) temps = [] for temp in fileAsList[3]: temps.append(temp)
import argparse import auxiliary as aux import numlte as nl import pyfi as fh ### Fix description parser = argparse.ArgumentParser( description="Calculates Column Densities from one input file with molecular and brightness information" ) parser.add_argument("infile", type=str, help="Input file") parser.add_argument("outfile", type=str, help="Output file") args = parser.parse_args() filein = open(args.infile, "r") fileaslist = fh.strip_off_comm(filein, "#") filein.close() values = fh.float_file(fileaslist, skip=[0, 1, 2]) fileout = open(args.outfile, "w") # real option aux.writeInfo(fileout, "MiniTex") fileout.write( "#Source[1] Molecule[2] Transition[3] Frequency(GHz)[4] Opacity[5] sig(Opacity)[6] Intensity(K)[7] sig(intensity)(K)[8] Exc. Temp.(K)[9] sig(Exc. temp.)(K)[10]" ) for i in range(len(values)): value = values[i] line = fileaslist[i] results = nl.calc_tex(value[1], value[2], value[3], value[4], value[0]) fileout.write(line[:-1] + "\t{0:.4f}\t{1:.4f}\n".format(results[0], results[1])) fileout.close()