| 41 | | [[CollapsibleStart(Post Processing Submissions)]] |
| | 41 | |
| | 42 | [[CollapsibleStart(.okc to .csv Converter (python))]] |
| | 43 | {{{ |
| | 44 | #!/usr/bin/env python |
| | 45 | # ^ program.py not python program.py |
| | 46 | |
| | 47 | import glob |
| | 48 | import numpy |
| | 49 | |
| | 50 | time_scaler = 0.00825*3.81360279481384188E+14*3.16888E-8*1E-6 |
| | 51 | mass_scaler = 0.619591607894786331E+32*5.03E-34 |
| | 52 | |
| | 53 | # cd into the out directory |
| | 54 | out_dir = "./out/" |
| | 55 | |
| | 56 | # Accessing the *.okc files and sorts them |
| | 57 | lst = glob.glob(out_dir + "*.okc") |
| | 58 | lst.sort() |
| | 59 | |
| | 60 | with open("./s15_rawsink_data_scaled.csv", "w") as sink_f: |
| | 61 | sink_f.write("Time" + "," + "Core 1 Mass" + "," + "Core 2 Mass" + "," + "Core 3 Mass" + ","+ "Core 4 Mass" + "," + "Core 5 Ma\ |
| | 62 | ss\n") |
| | 63 | |
| | 64 | for i in range(0,len(lst)): |
| | 65 | with open(lst[i]) as f: |
| | 66 | okc_lines = f.readlines() |
| | 67 | noparams, nosinks, noparams_mm = [int(x) for x in okc_lines[0].split()] |
| | 68 | sinkdata =[float(y[3]) for y in [x.split() for x in okc_lines[-nosinks:]]] |
| | 69 | sink_f.write(str(i*time_scaler) + ",") |
| | 70 | for j in sinkdata: |
| | 71 | sink_f.write(str(j*mass_scaler) + ",") |
| | 72 | for j in range(0,5-len(sinkdata)): |
| | 73 | sink_f.write("0.0" + ",") |
| | 74 | sink_f.write("\n") |
| | 75 | }}} |
| | 76 | [[CollapsibleEnd]] |
| | 77 | |
| | 78 | |
| | 79 | [[CollapsibleStart(Post Processing Submissions (bash))]] |