vtk.read_meas(el, ns_cal, set_id_cal, step, comp, tensor_ID, dir_cal, wrt_file) ## Gather data from validation vtk files dir_val = 'val_basal' vtk.read_euler(el, ns_val, set_id_val, step, dir_val, wrt_file, 0) for comp in compl: vtk.read_meas(el, ns_val, set_id_val, step, comp, tensor_ID, dir_val, wrt_file) ## Convert the orientations from the calibration datasets from bunge euler angles ## to GSH coefficients gsh.euler_to_gsh(el, H, ns_cal, set_id_cal, step, wrt_file) ## Convert the orientations from the validation datasets from bunge euler angles ## to GSH coefficients gsh.euler_to_gsh(el, H, ns_val, set_id_val, step, wrt_file) ## Generate the fftn of the calibration microstructure function msf.micr_func(el, H, ns_cal, set_id_cal, step, wrt_file) ## Generate the fftn of the validation microstructure function msf.micr_func(el, H, ns_val, set_id_val, step, wrt_file) ## Perform the calibration for comp in compl: calibration.calibration_procedure(el, H, ns_cal, set_id_cal, step, comp, wrt_file)
ns_cal = 40 ns_val = 10 set_id_val = 'val' set_id_cal = 'cal' wrt_file = 'log_file.txt' X_cal = X[0:ns_cal, ...] X_val = X[ns_cal:, ...] y_cal = y[0:ns_cal, ...] y_val = y[ns_cal:, ...] # take fft of response fields y_fft_cal = np.fft.fftn(y_cal, axes=[1, 2, 3]) y_fft_val = np.fft.fftn(y_val, axes=[1, 2, 3]) # Convert the orientations from the calibration datasets from bunge euler # angles to GSH coefficients M_cal = gsh.euler_to_gsh(X_cal, el, H, ns_cal, set_id_cal, wrt_file) # Convert the orientations from the validation datasets from bunge euler # angles to GSH coefficients M_val = gsh.euler_to_gsh(X_val, el, H, ns_val, set_id_val, wrt_file) # Perform the calibration infl_coef = calibration.calibration_procedure(M_cal, y_fft_cal, el, H, ns_cal, wrt_file) # Perform the validation y_mks = validation.validation(M_val, infl_coef, el, wrt_file) results.results(infl_coef, y_val, y_mks, el, ns_val)
vtk.read_meas(ns_cal, set_id_cal, comp, vtk_filename, tensor_ID, dir_cal, wrt_file) ## Gather data from validation vtk files dir_val = 'vtk_val_stress_all_comp' vtk.read_euler(ns_val, set_id_val, vtk_filename, dir_val, wrt_file) for comp in xrange(9): vtk.read_meas(ns_val, set_id_val, comp, vtk_filename, tensor_ID, dir_val, wrt_file) ## Convert the orientations from the calibration datasets from bunge euler angles ## to GSH coefficients gsh.euler_to_gsh(ns_cal, set_id_cal, wrt_file) ## Convert the orientations from the validation datasets from bunge euler angles ## to GSH coefficients gsh.euler_to_gsh(ns_val, set_id_val, wrt_file) ## Generate the fftn of the calibration microstructure function msf.micr_func(ns_cal, set_id_cal, wrt_file) ## Generate the fftn of the validation microstructure function msf.micr_func(ns_val, set_id_val, wrt_file) ## Perform the calibration for comp in xrange(9): calibration.calibration_procedure(ns_cal, set_id_cal, comp, wrt_file)
dir_val = 'val' vtk.read_euler(ns_val, set_id_val, step, vtk_filename, dir_val, wrt_file) for comp in compl: vtk.read_meas(ns_val, set_id_val, step, comp, vtk_filename, tensor_ID, dir_val, wrt_file, 1) # ## Convert the orientations from the calibration datasets from bunge euler angles # ## to GSH coefficients # gsh.euler_to_gsh(ns_cal,set_id_cal,step,wrt_file) ## Convert the orientations from the validation datasets from bunge euler angles ## to GSH coefficients gsh.euler_to_gsh(ns_val, set_id_val, step, wrt_file) # ## Generate the fftn of the calibration microstructure function # msf.micr_func(ns_cal,set_id_cal,step,wrt_file) ## Generate the fftn of the validation microstructure function msf.micr_func(ns_val, set_id_val, step, wrt_file) # ## Perform the calibration # for comp in compl: # calibration.calibration_procedure(ns_cal,set_id_cal,step,comp,wrt_file) ## Perform the validation for comp in compl: validation.validation_procedure(ns_cal, ns_val, set_id_cal, set_id_val, step, comp, wrt_file)
""" """Gather data from calibration vtk files""" # for ii in xrange(len(set_id_D3D)): # vtk.read_euler(el, ns_D3D[ii], set_id_D3D[ii], # step, dir_D3D[ii], wrt_file, 0) # gen.delta(el, ns_cal[1], set_id_cal[1], step, wrt_file) # vfrac = np.array([.1, .05]) # gen.inclusion(el, ns_cal[2], set_id_cal[2], step, wrt_file, vfrac) gen.bicrystal(el, ns_cal[0], set_id_cal[0], step, wrt_file) """Compute GSH coefficients to create microstructure function in real and fourier space""" for ii in xrange(len(set_id_cal)): e2g.euler_to_gsh(el, H, ns_cal[ii], set_id_cal[ii], step, wrt_file) """Compute the periodic statistics for the microstructures""" for ii in xrange(len(set_id_cal)): corr.correlate(el, ns_cal[ii], H, set_id_cal[ii], step, wrt_file) """Perform PCA on autocorrelations""" pcaC.doPCA(el, H, ns_cal, set_id_cal, step, wrt_file) # """Plot an autocorrelation""" # sn = 0 # iA = 1 # iB = 1 # pltcorr.pltcorr(el, ns_cal[0], set_id_cal[0], step, sn, iA, iB) # """Plot the percentage explained variance""" # ns_tot = np.sum(ns_cal) # ev.variance(el, ns_tot, step)