from IntegralFlashData import IntegralFlashData import numpy as np from collections import OrderedDict import sys av = sys.argv impa = '24' if len(av) == 2: impa = str(int(av[1])) pbi = [2, 4, 6, 8, 12, 16, 20] pbir = [str(p) for p in pbi] pref = 'profile75_mpole-' suff = '_r-35e6_a-' + impa + 'e5.dat' ifd = IntegralFlashData() # Make a dictionary for the data ifdata = OrderedDict([]) pfmt = OrderedDict([]) for i in xrange(0, len(pbir)): p = pbir[i] iname = pref + p + suff ifd.readInts(iname) ifd.orderData() # Compute the binding energy and add it to the integrals data = ifd.getArrayData() data['E_binding'] = data['E_internal+kinetic'] + data['E_grav'] ifd.data = data ifd.saveOrderedData() ifd.clrArrayData()
from IntegralFlashData import IntegralFlashData import numpy as np from scipy import interpolate import matplotlib.pyplot as plt from collections import OrderedDict import sys pbi = range(1,31) N = len(pbi) pref = 'Realization_' suff = '_ordered.dat' ifd = IntegralFlashData() # Make a dictionary for the data ifdata = OrderedDict([]) headers = [] shortheaders = [] for i in xrange(0,N): p = pbi[i] iname = pref + '{0:03}'.format(p) + suff ifd.readInts(iname) # ifd.orderData() ifdata[p] = ifd.getArrayData() if i==0: headers = ifdata[p].keys() shortheaders = [hj.replace(' > ','>').replace(' ','_') for hj in headers] ifd.clrArrayData() ## Calculate and write the median # Get the range of time points for each dataset and interpolate only on the datasets where we have information t_min_vec = [d['time'][0] for k,d in ifdata.iteritems()]
from IntegralFlashData import IntegralFlashData import numpy as np from scipy import interpolate import matplotlib.pyplot as plt from collections import OrderedDict import sys pbi = range(1, 31) N = len(pbi) pref = 'Realization_' suff = '_ordered.dat' ifd = IntegralFlashData() # Make a dictionary for the data ifdata = OrderedDict([]) headers = [] shortheaders = [] for i in xrange(0, N): p = pbi[i] iname = pref + '{0:03}'.format(p) + suff ifd.readInts(iname) # ifd.orderData() ifdata[p] = ifd.getArrayData() if i == 0: headers = ifdata[p].keys() shortheaders = [ hj.replace(' > ', '>').replace(' ', '_') for hj in headers ] ifd.clrArrayData() ## Calculate and write the mean
import matplotlib.pyplot as plt import matplotlib.lines as mlines import matplotlib as mpl from collections import OrderedDict import re import sys import os import glob as glob # matplotlib rc parameters #mpl.rcParams['font.size'] = 14.0 annotation_font_size = 20 # Common objects ifd = IntegralFlashData() headers = [] shortheaders = [] stats_co = OrderedDict([]) stats_cone = OrderedDict([]) which_stats = ['mean','median','min','max','std'] # Store the current directory this_dir = os.getcwd() ## Read in the CO integral stats #realz_dir = '/home/eugene/400k/analysis/cf_brendan' # absolute path realz_dir = '/home/eugene/simulations/flash_runs/hybrid-cone/hddt/v3/profile75/ign_true/400k/analysis/cf_brendan_pbIgnRho-7.2' prefix = '' suffix = '.dat' os.chdir(realz_dir)
from collections import OrderedDict import numpy as np import matplotlib.pyplot as plt import matplotlib.lines as mlines from IntegralFlashData import IntegralFlashData #intdataname_co = 'hybrid_ddt_time_detp_firsts.dat' intdataname_co = 'co_ddt_time_est_E_internal_firsts.dat' intdataname_cone = 'hybrid_ddt_time_est_E_internal_firsts.dat' ifd = IntegralFlashData() ifd.readInts(intdataname_co) ifd.GramsToMsun() co_data = ifd.getArrayData() ifd.clrArrayData() ifd.readInts(intdataname_cone) ifd.GramsToMsun() cone_data = ifd.getArrayData() ifd.clrArrayData() # Get averages and standard deviations for the plot co_average_mass = np.average(co_data['mass with dens > 2e7']) print 'co ave mass: ' + str(co_average_mass) co_std_mass = np.std(co_data['mass with dens > 2e7']) cone_average_mass = np.average(cone_data['mass with dens > 2e7']) print 'cone ave mass: ' + str(cone_average_mass) cone_std_mass = np.std(cone_data['mass with dens > 2e7']) co_average_time = np.average(co_data['time']) print 'co ave time: ' + str(co_average_time) co_std_time = np.std(co_data['time']) cone_average_time = np.average(cone_data['time'])
ifdata = OrderedDict([]) pfmt = OrderedDict([]) # Store the current directory this_dir = os.getcwd() ## Read in the CO integrals #realz_dir = '/home/dwillcox/400k/analysis/cf_brendan' # absolute path realz_dir = '/home/eugene/simulations/flash_runs/hybrid-cone/hddt/v3/profile75/ign_true/400k/analysis/cf_brendan_pbIgnRho-7.2' #pref = 'Realization_' pref = '400k_Tc7e8_co_wd_R' suff = '_ordered.dat' os.chdir(realz_dir) # Make a dictionary for the data ifd = IntegralFlashData() headers = [] shortheaders = [] rflist = glob.glob(pref + '*' + suff) N = len(rflist) print 'Found this many CO files: ' + str(N) cpick = ColorPicker() colors = cpick.pickColors(N) first = True for fn in rflist: print fn ni = int(fn.replace(pref,'').replace(suff,'')) ifd.readInts(fn) ifd.GramsToMsun() ifdk = 'co_' + str(ni)
from collections import OrderedDict import numpy as np import matplotlib.pyplot as plt import matplotlib.lines as mlines from IntegralFlashData import IntegralFlashData # intdataname_co = 'hybrid_ddt_time_detp_firsts.dat' intdataname_co = "co_ddt_time_est_E_internal_firsts.dat" intdataname_cone = "hybrid_ddt_time_est_E_internal_firsts.dat" ifd = IntegralFlashData() ifd.readInts(intdataname_co) ifd.GramsToMsun() co_data = ifd.getArrayData() ifd.clrArrayData() ifd.readInts(intdataname_cone) ifd.GramsToMsun() cone_data = ifd.getArrayData() ifd.clrArrayData() # Get averages and standard deviations for the plot co_average_mass = np.average(co_data["mass with dens > 2e7"]) print "co ave mass: " + str(co_average_mass) co_std_mass = np.std(co_data["mass with dens > 2e7"]) cone_average_mass = np.average(cone_data["mass with dens > 2e7"]) print "cone ave mass: " + str(cone_average_mass) cone_std_mass = np.std(cone_data["mass with dens > 2e7"]) co_average_time = np.average(co_data["time"]) print "co ave time: " + str(co_average_time) co_std_time = np.std(co_data["time"]) cone_average_time = np.average(cone_data["time"])
import matplotlib.pyplot as plt import matplotlib.lines as mlines import matplotlib as mpl from collections import OrderedDict import re import sys import os import glob as glob # matplotlib rc parameters #mpl.rcParams['font.size'] = 14.0 annotation_font_size = 20 # Common objects ifd = IntegralFlashData() headers = [] shortheaders = [] stats_co = OrderedDict([]) stats_cone = OrderedDict([]) which_stats = ['mean', 'median', 'min', 'max', 'std'] # Store the current directory this_dir = os.getcwd() ## Read in the CO integral stats #realz_dir = '/home/eugene/400k/analysis/cf_brendan' # absolute path realz_dir = '/home/eugene/simulations/flash_runs/hybrid-cone/hddt/v3/profile75/ign_true/400k/analysis/cf_brendan_pbIgnRho-7.2' prefix = '' suffix = '.dat' os.chdir(realz_dir)
ifdata = OrderedDict([]) pfmt = OrderedDict([]) # Store the current directory this_dir = os.getcwd() ## Read in the CO integrals #realz_dir = '/home/dwillcox/400k/analysis/cf_brendan' # absolute path realz_dir = '/home/eugene/simulations/flash_runs/hybrid-cone/hddt/v3/profile75/ign_true/400k/analysis/cf_brendan_pbIgnRho-7.2' #pref = 'Realization_' pref = '400k_Tc7e8_co_wd_R' suff = '_ordered.dat' os.chdir(realz_dir) # Make a dictionary for the data ifd = IntegralFlashData() headers = [] shortheaders = [] rflist = glob.glob(pref + '*' + suff) N = len(rflist) print 'Found this many CO files: ' + str(N) cpick = ColorPicker() colors = cpick.pickColors(N) first = True for fn in rflist: print fn ni = int(fn.replace(pref, '').replace(suff, '')) ifd.readInts(fn) ifd.GramsToMsun() ifdk = 'co_' + str(ni)
from IntegralFlashData import IntegralFlashData import numpy as np from collections import OrderedDict import sys av = sys.argv impa = '24' if len(av)==2: impa = str(int(av[1])) pbi = [2, 4, 6, 8, 12, 16, 20] pbir = [str(p) for p in pbi] pref = 'profile75_mpole-' suff = '_r-35e6_a-' + impa + 'e5.dat' ifd = IntegralFlashData() # Make a dictionary for the data ifdata = OrderedDict([]) pfmt = OrderedDict([]) for i in xrange(0,len(pbir)): p = pbir[i] iname = pref + p + suff ifd.readInts(iname) ifd.orderData() ifd.saveOrderedData() ifd.clrArrayData()
# Don: 12/11/2015: just fixed re expression for dir_re to permit finding amplitude 6 files # bringing the total number of integral files to the correct number of 35. import os import re import csv from collections import OrderedDict ## Custom imports from IntegralFlashData import IntegralFlashData ## Setup dir_re = re.compile('\A.*/ignMPoleA-([0-9]{1,2})e5\Z') fil_re = re.compile( '\Aprofile75_mpole-([0-9]{1,2})_r-35e6_a-([0-9]{1,2})e5_ordered.dat\Z') ifd = IntegralFlashData() data = [] # data_entry={} def getData(f, ifd=ifd): ifd.readInts(f) ifd.GramsToMsun() dat = ifd.getArrayData() ifd.clrArrayData() return dat # Collect integrals from each file for root, dirs, files in os.walk(os.getcwd()): print 'in directory: ' + root
from IntegralFlashData import IntegralFlashData import numpy as np import matplotlib.pyplot as plt from collections import OrderedDict import sys import bisect import glob as glob ifd = IntegralFlashData() if len(sys.argv)==1: print 'Please supply a list of input files to process!' exit() ifnames = sys.argv[1:] N = len(ifnames) min_time = 0.25 # Make a dictionary for the data ifdata = OrderedDict([]) dettimes = OrderedDict([]) headers = [] shortheaders = [] for i in xrange(0,N): iname = ifnames[i] inum = iname.split('-')[1].split('.')[0] intdatname = glob.glob('profile75_mpole-'+inum+'*_ordered.dat') ifd.readInts(intdatname[0]) ifdata[inum] = ifd.getArrayData() if i==0: headers = ifdata[inum].keys()