Changes between Version 39 and Version 40 of u/madams


Ignore:
Timestamp:
06/02/15 14:09:19 (10 years ago)
Author:
madams
Comment:

Legend:

Unmodified
Added
Removed
Modified
  • u/madams

    v39 v40  
    3939= Scripts =
    4040
    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
     47import glob
     48import numpy
     49
     50time_scaler = 0.00825*3.81360279481384188E+14*3.16888E-8*1E-6
     51mass_scaler = 0.619591607894786331E+32*5.03E-34
     52
     53# cd into the out directory                                                                                                       
     54out_dir = "./out/"
     55
     56# Accessing the *.okc files and sorts them                                                                                         
     57lst = glob.glob(out_dir + "*.okc")
     58lst.sort()
     59
     60with 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\
     62ss\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))]]
    4280
    4381- Creates post processing directories in your out directory.