Example #1
0
n_p1 = 360 / inc  # number of phi1 samples for FZ
n_P = (90 / inc) + 1  # number of Phi samples for FZ
n_p2 = 60 / inc  # number of phi2 samples for FZ

n_tot = n_max**3  # total number of orientations

# create file for pre-database outputs
f_nhp = h5py.File('var_extract_%s.hdf5' % str(tnum).zfill(2), 'w')
a = 0.0050  # start for en range
b = 0.0085  # end for en range
N = 10  # number of nodes
en_inc = 0.0001  # en increment
envec = np.arange(0.0001, 0.0100, en_inc)
ai = np.int64(np.round(a / en_inc)) - 1  # index for start of en range
bi = np.int64(np.round(b / en_inc)) - 1  # index for end of en range
sample_indx = lagr.chebyshev_nodes(a, b, ai, en_inc, N) + ai
xnode = envec[sample_indx]  # en values for nodes of lagrange interpolation
print xnode

var_set = f_nhp.create_dataset("var_set", (n_max, n_max, n_max, N))

# Read Simulation info from "sim" file
filename = 'sim_Ti64_tensor_%s.txt' % str(tnum).zfill(2)

f = open(filename, "r")

linelist = f.readlines()

stmax = linelist[1].split()[4:7]

test_no = np.zeros([n_tot], dtype='int8')
n_P = (90 / inc) + 1  # number of Phi samples for FZ
n_p2 = 60 / inc  # number of phi2 samples for FZ
n_en_guess = 10  # desired number of en samples

# n_eul is the number of orientations in the sampled db input set
n_eul = n_p1 * n_P * n_p2

# here we determine the sampling for en based on the roots of the
# chebyshev polynomial
a = 0.0050  # start for en range
b = 0.0085  # end for en range
en_inc = 0.0001  # en increment
et_norm = np.linspace(.0001, .0100, 100)
ai = np.int64(np.round(a / en_inc)) - 1  # index for start of en range
bi = np.int64(np.round(b / en_inc)) - 1  # index for end of en range
sample_indx = lagr.chebyshev_nodes(a, b, ai, en_inc, n_en_guess)
n_en = sample_indx.size

# xnode: en values for nodes of lagrange interpolation
xnode = et_norm[sample_indx + ai]
print xnode

nvec = np.array([n_th, n_p1, n_P, n_p2, n_en])
print "nvec: %s" % str(nvec)

# create file for pre-database outputs
f_nhp = h5py.File('var_extract_%s.hdf5' % str(tnum).zfill(2), 'w')
var_set = f_nhp.create_dataset("var_set", (n_eul * n_en, 6))

# Read Simulation info from "sim" file
filename = 'sim_Ti64_tensor_%s.txt' % str(tnum).zfill(2)