def misfit(phase_1_fraction): # Here we define the rock as before. phase_2_fraction = 1.0 - phase_1_fraction rock = burnman.Composite( [minerals.SLB_2011.stishovite(), minerals.SLB_2011.wuestite()], [phase_1_fraction, phase_2_fraction]) # Just as in step 1, we want to set which equation of state we use, # then call burnman.velocities_from_rock, which evaluates the # elastic properties and seismic velocities at the predefined # pressures and temperatures rock.set_method('slb3') density, vphi, vs = rock.evaluate(['density', 'v_phi', 'v_s'], pressure, temperature) # Since we will call this misfit function many times, we may be interested # in a status report. These lines print some debug output so we # can keep track of what the script is doing. print("Calculations are done for:") rock.debug_print() # Here we integrate an L2 difference with depth between our calculated seismic # profiles and PREM. We then return those misfits. [vs_err, vphi_err, rho_err] = burnman.compare_l2(depths, [vs, vphi, density], [seis_vs, seis_vphi, seis_rho]) return vs_err, vphi_err, rho_err
def material_error(x): _, mat_vs, mat_vphi, mat_rho = eval_material(x) [rho_err,vphi_err,vs_err]=burnman.compare_l2(depths, [mat_vs,mat_vphi,mat_rho], [seis_vs,seis_vphi,seis_rho]) scale = 2700e3-850e3 return vs_err/scale, vphi_err/scale
def material_error(x): _, mat_vs, mat_vphi, mat_rho = eval_material(x) [vs_err, vphi_err, rho_err] = burnman.compare_l2(depths, [mat_vs, mat_vphi, mat_rho], [seis_vs, seis_vphi, seis_rho]) scale = 2700e3 - 850e3 return vs_err / scale, vphi_err / scale
def misfit(phase_1_fraction): # Here we define the rock as before. phase_2_fraction = 1.0-phase_1_fraction rock = burnman.Composite([phase_1_fraction, phase_2_fraction], [minerals.SLB_2011.stishovite(), minerals.SLB_2011.wuestite()]) # Just as in step 1, we want to set which equation of state we use, # then call burnman.velocities_from_rock, which evaluates the # elastic properties and seismic velocities at the predefined # pressures and temperatures rock.set_method('slb3') density, vp, vs, vphi, K, G = burnman.velocities_from_rock(rock, pressure, temperature) # Since we will call this misfit function many times, we may be interested # in a status report. These lines print some debug output so we # can keep track of what the script is doing. print "Calculations are done for:" rock.debug_print() # Here we integrate an L2 difference with depth between our calculated seismic # profiles and PREM. We then return those misfits. [vs_err, vphi_err, rho_err]=burnman.compare_l2(depths,[vs,vphi,density],[seis_vs,seis_vphi,seis_rho]) return vs_err, vphi_err, rho_err
def material_error(amount_perovskite): rock = burnman.composite ( [ (minerals.Murakami_etal_2012.fe_perovskite(), amount_perovskite), (minerals.Murakami_etal_2012.fe_periclase(), 1.0 - amount_perovskite) ] ) rock.set_method(method) print "Calculations are done for:" rock.debug_print() mat_rho, mat_vp, mat_vs, mat_vphi, mat_K, mat_G = \ burnman.velocities_from_rock(rock, seis_p, temperature, burnman.averaging_schemes.voigt_reuss_hill()) #[rho_err,vphi_err,vs_err]=burnman.compare_chifactor([mat_vs,mat_vphi,mat_rho],[seis_vs,seis_vphi,seis_rho]) [rho_err,vphi_err,vs_err]=burnman.compare_l2(depths,[mat_vs,mat_vphi,mat_rho],[seis_vs,seis_vphi,seis_rho]) return vs_err, vphi_err
def material_error(amount_perovskite): #Define composition using the values from Murakami et al. 2012 (Note: fe_perovskite and fe_periclase do not represent pure iron #endmembers here, but contain 6% and 20% Fe respectively. rock = burnman.Composite([amount_perovskite, 1.0-amount_perovskite], [minerals.Murakami_etal_2012.fe_perovskite(), minerals.Murakami_etal_2012.fe_periclase()]) mat_rho, mat_vp, mat_vs, mat_vphi, mat_K, mat_G = \ burnman.velocities_from_rock(rock, seis_p, temperature, burnman.averaging_schemes.VoigtReussHill()) print "Calculations are done for:" rock.debug_print() [vs_err, vphi_err, rho_err] = \ burnman.compare_l2(depths, [mat_vs,mat_vphi,mat_rho], [seis_vs,seis_vphi,seis_rho]) return vs_err, vphi_err
def material_error(amount_perovskite): #Define composite using the values rock = burnman.Composite([perovskite, ferropericlase], \ [amount_perovskite, 1.0-amount_perovskite]) # Compute velocities mat_rho, mat_vp, mat_vs, mat_vphi, mat_K, mat_G = \ rock.evaluate(['density','v_p','v_s','v_phi','K_S','G'], seis_p, temperature) print("Calculations are done for:") rock.debug_print() # Calculate errors [vs_err, vphi_err, rho_err, K_err, G_err] = \ burnman.compare_l2(depths, [mat_vs,mat_vphi,mat_rho, mat_K, mat_G], [seis_vs,seis_vphi,seis_rho, seis_K, seis_G]) # Normalize errors vs_err = vs_err/np.mean(seis_vs)**2. vphi_err = vphi_err/np.mean(seis_vphi)**2. rho_err = rho_err/np.mean(seis_rho)**2. K_err = K_err/np.mean(seis_K)**2. G_err = G_err/np.mean(seis_G)**2. return vs_err, vphi_err, rho_err, K_err, G_err
def material_error(amount_perovskite): # Define composite using the values rock = burnman.Composite([perovskite, ferropericlase], [amount_perovskite, 1.0 - amount_perovskite]) # Compute velocities mat_rho, mat_vp, mat_vs, mat_vphi, mat_K, mat_G = \ rock.evaluate( ['density', 'v_p', 'v_s', 'v_phi', 'K_S', 'G'], seis_p, temperature) print("Calculations are done for:") rock.debug_print() # Calculate errors [vs_err, vphi_err, rho_err, K_err, G_err] = \ burnman.compare_l2(depths, [mat_vs, mat_vphi, mat_rho, mat_K, mat_G], [ seis_vs, seis_vphi, seis_rho, seis_K, seis_G]) # Normalize errors vs_err = vs_err / np.mean(seis_vs)**2. vphi_err = vphi_err / np.mean(seis_vphi)**2. rho_err = rho_err / np.mean(seis_rho)**2. K_err = K_err / np.mean(seis_K)**2. G_err = G_err / np.mean(seis_G)**2. return vs_err, vphi_err, rho_err, K_err, G_err
for n in names: fit.append(mymap[n]) lit.append(mymaplit[n]) rock, anchor_t = array_to_rock(fit, names) temperature = burnman.geotherm.adiabatic(pressure, anchor_t, rock) rock.set_averaging_scheme( burnman.averaging_schemes.HashinShtrikmanAverage()) rho, vp, vs, vphi, K, G = \ rock.evaluate( ['rho', 'v_p', 'v_s', 'v_phi', 'K_S', 'G'], pressure, temperature) err_vs, err_vphi, err_rho = burnman.compare_l2(depths / np.mean(depths), [ vs / np.mean(seis_vs), vphi / np.mean(seis_vphi), rho / np.mean(seis_rho) ], [ seis_vs / np.mean(seis_vs), seis_vphi / np.mean(seis_vphi), seis_rho / np.mean(seis_rho) ]) error = np.sum([err_rho, err_vphi, err_vs]) print("errors:", error, err_rho, err_vphi, err_vs) figsize = (6, 5) prop = {'size': 12} plt.rc('text', usetex=True) plt.rcParams['text.latex.preamble'] = r'\usepackage{relsize}' plt.rc('font', family='sans-serif') figure = plt.figure(dpi=100, figsize=figsize) # plot v_s
fit = [] lit = [] for n in names: fit.append(mymap[n]) lit.append(mymaplit[n]) rock, anchor_t = array_to_rock(fit, names) temperature = burnman.geotherm.adiabatic(pressure, anchor_t, rock) rho, vp, vs, vphi, K, G = \ burnman.velocities_from_rock(rock, pressure, temperature, burnman.averaging_schemes.HashinShtrikmanAverage()) err_vs, err_vphi, err_rho = burnman.compare_l2(depths/np.mean(depths), [vs/np.mean(seis_vs), vphi/np.mean(seis_vphi), rho/np.mean(seis_rho)], [seis_vs/np.mean(seis_vs), seis_vphi/np.mean(seis_vphi), seis_rho/np.mean(seis_rho)]) error = np.sum([err_rho, err_vphi, err_vs]) print "errors:", error, err_rho, err_vphi, err_vs figsize=(6,5) prop={'size':12} plt.rc('text', usetex=True) plt.rcParams['text.latex.preamble'] = '\usepackage{relsize}' plt.rc('font', family='sanserif') figure=plt.figure(dpi=100,figsize=figsize) #plot v_s
dashstyle2=(7,3) dashstyle3=(3,2) fit = [] lit = [] for n in names: fit.append(mymap[n]) lit.append(mymaplit[n]) rock, anchor_t = array_to_rock(fit, names) temperature = burnman.geotherm.adiabatic(pressure, anchor_t, rock) rho, vp, vs, vphi, K, G = \ burnman.velocities_from_rock(rock, pressure, temperature, burnman.averaging_schemes.HashinShtrikmanAverage()) err_vs, err_vphi, err_rho = burnman.compare_l2(depths/np.mean(depths), vs/np.mean(seis_vs), vphi/np.mean(seis_vphi), \ rho/np.mean(seis_rho), seis_vs/np.mean(seis_vs), seis_vphi/np.mean(seis_vphi), seis_rho/np.mean(seis_rho)) error = np.sum([err_rho, err_vphi, err_vs]) print error, err_rho, err_vphi, err_vs figsize=(6,5) prop={'size':12} plt.rc('text', usetex=True) plt.rcParams['text.latex.preamble'] = '\usepackage{relsize}' plt.rc('font', family='sanserif') figure=plt.figure(dpi=100,figsize=figsize) #plot v_s plt.plot(pressure/1.e9,seis_vs/1.e3,linestyle="-",color='k',linewidth=2.0,label='PREM')
dashstyle2=(7,3) dashstyle3=(3,2) fit = [] lit = [] for n in names: fit.append(mymap[n]) lit.append(mymaplit[n]) rock, anchor_t = array_to_rock(fit, names) temperature = burnman.geotherm.adiabatic(pressure, anchor_t, rock) rock.set_averaging_scheme(burnman.averaging_schemes.HashinShtrikmanAverage()) rho, vs, vphi = rock.evaluate(['rho','v_s','v_phi'], pressure, temperature) err_vs, err_vphi, err_rho = burnman.compare_l2(depths, [vs, vphi, rho], [seis_vs, seis_vphi, seis_rho]) error = np.sum([err_rho/np.mean(seis_rho), err_vphi/np.mean(seis_vphi), err_vs/np.mean(seis_vs)]) figsize=(6,5) prop={'size':12} plt.rc('text', usetex=True) plt.rcParams['text.latex.preamble'] = r'\usepackage{relsize}' plt.rc('font', family='sans-serif') figure=plt.figure(dpi=100,figsize=figsize) #plot v_s plt.plot(pressure/1.e9,seis_vs/1.e3,linestyle="-",color='k',linewidth=2.0,label='PREM') #plot v_phi plt.plot(pressure/1.e9,seis_vphi/1.e3,linestyle="-",color='k',linewidth=2.0)
dashstyle2=(7,3) dashstyle3=(3,2) fit = [] lit = [] for n in names: fit.append(mymap[n]) lit.append(mymaplit[n]) rock, anchor_t = array_to_rock(fit, names) temperature = burnman.geotherm.adiabatic(pressure, anchor_t, rock) rho, vp, vs, vphi, K, G = \ burnman.velocities_from_rock(rock, pressure, temperature, burnman.averaging_schemes.hashin_shtrikman_average()) err_rho, err_vphi, err_vs = burnman.compare_l2(depths/np.mean(depths), vs/np.mean(seis_vs), vphi/np.mean(seis_vphi), \ rho/np.mean(seis_rho), seis_vs/np.mean(seis_vs), seis_vphi/np.mean(seis_vphi), seis_rho/np.mean(seis_rho)) error = np.sum([err_rho, err_vphi, err_vs]) print error, err_rho, err_vphi, err_vs figsize=(6,5) prop={'size':12} plt.rc('text', usetex=True) plt.rcParams['text.latex.preamble'] = '\usepackage{relsize}' plt.rc('font', family='sanserif') figure=plt.figure(dpi=100,figsize=figsize) #plot v_s plt.plot(pressure/1.e9,seis_vs/1.e3,linestyle="-",color='k',linewidth=2.0,label='PREM')
fit = [] lit = [] for n in names: fit.append(mymap[n]) lit.append(mymaplit[n]) rock, anchor_t = array_to_rock(fit, names) temperature = burnman.geotherm.adiabatic(pressure, anchor_t, rock) rock.set_averaging_scheme( burnman.averaging_schemes.HashinShtrikmanAverage()) rho, vs, vphi = rock.evaluate( ['rho', 'v_s', 'v_phi'], pressure, temperature) err_vs, err_vphi, err_rho = burnman.compare_l2( depths, [vs, vphi, rho], [seis_vs, seis_vphi, seis_rho]) error = np.sum( [err_rho / np.mean(seis_rho), err_vphi / np.mean(seis_vphi), err_vs / np.mean(seis_vs)]) figsize = (6, 5) prop = {'size': 12} plt.rc('text', usetex=True) plt.rcParams['text.latex.preamble'] = r'\usepackage{relsize}' plt.rc('font', family='sans-serif') figure = plt.figure(dpi=100, figsize=figsize) # plot v_s plt.plot(pressure / 1.e9, seis_vs / 1.e3, linestyle="-", color='k', linewidth=2.0, label='PREM') # plot v_phi