sys.path.insert(0, '/data/ap4909/30.10.2013-hot_cold_geochem/mantle_temp_cals/calculate_p_t_using_lee/aux_files') import pet_read_in_with_labels from scipy.optimize import fsolve samps_markers={} h2o_colours={0:"r",4:'g',8:'b'} volcano_names=["Ata","Tofua","Niuatoputapu","Tafahi","Kao","Late"] island_symbols={"Agrigan":".","Almagan":"v","Anatahan":"8","Asuncion":"s","Guguan":"D","Pagan":'p',"Sarigan":"*","Uracas":"o"}#symbols for each island h2o_vals=np.linspace(0,8,10) for sub_zone in["Southern_Marianas"]:# samps1=pet_read_in_with_labels.pet_read_in("/data/ap4909/30.10.2013-hot_cold_geochem/get_lat_lon_data/sz_with_lat_lon/individual_files/individual_files_with_feo/%s_new.xls"%(sub_zone),1,sub_zone)[0] mineral_props={"Fo=92":{"ol":0.65,"opx":0.3,"cpx":0.05},"Fo=91":{"ol":0.65,"opx":0.25,"cpx":0.1},"Fo=90":{"ol":0.65,"opx":0.2,"cpx":0.15}} #mineral proportions for fo90,fo91,fo92 mantle for samps,symbol,colour,label in zip([samps1],["s"],["r"],["My samples"]): for comp in [0.9]: for key,value in samps.iteritems(): print key P_vals=[] mf_vals=[] for h2o in h2o_vals: ti_corrected=value.get_ti_corrected(0.9,h2o,0.25)
comp_frac_1 = np.interp(comp, mg_num_pressures[2], mf_pressures[2]) comp_frac_2 = np.interp(comp, mg_num_pressures[3], mf_pressures[3]) comp_frac_list = [comp_frac_1, comp_frac_2] comp_frac = np.interp(P, [2, 3], comp_frac_list) elif pre_P > 3: comp_frac = np.interp(comp, mg_num_pressures[3], mf_pressures[3]) cpx_mode = value.mineral_mode( comp_frac, pre_P, "cpx") #getting modal abundance of cpx in source return cpx_mode for sub_zone in ["Southern_Marianas"]: # samps1 = pet_read_in_with_labels.pet_read_in( "/data/ap4909/30.10.2013-hot_cold_geochem/get_lat_lon_data/sz_with_lat_lon/individual_files/individual_files_with_feo/%s_new.xls" % (sub_zone), 1, sub_zone)[0] kelley_samps = pet_read_in_with_labels.pet_read_in( "/data/ap4909/30.10.2013-hot_cold_geochem/sample_testing/southern_marianas/kelley/kelley_appendix_4_formatted.xls", 1, sub_zone)[0] mineral_props = { "Fo=92": { "ol": 0.65, "opx": 0.3, "cpx": 0.05 }, "Fo=91": { "ol": 0.65, "opx": 0.25, "cpx": 0.1
ti_source.append(batch_modal_melting(f,0.09)*0.09) ti_mg_num=[] for tim in ti_melt_fraction: ti_mg_num.append(np.interp(tim,mf,mg_nums)) print ti_mg_num for zone in ["Southern_Marianas"]:#["Southern_Marianas","South_Sandwich","West_Aleutians","Izu","South_Lesser_Antilles","Tonga","Central_Aleutians","Kermadec","New_Britain","New_Zealand","North_Vanuatu"]: sub_zone="%s"%zone print sub_zone labels=[] index=1 samps1=pet_read_in_with_labels.pet_read_in("/data/ap4909/30.10.2013-hot_cold_geochem/get_lat_lon_data/sz_with_lat_lon/individual_files/individual_files_with_feo/%s_new.xls"%(sub_zone),1,sub_zone)[0] one_samp={} kelley_samps=pet_read_in_with_labels.pet_read_in("/data/ap4909/30.10.2013-hot_cold_geochem/sample_testing/southern_marianas/kelley/kelley_appendix_4_formatted.xls",0,sub_zone)[0] sample_best_P_vals=[] sample_best_f=[] sample_best_ti_source=[] sample_best_source_mg=[] for samps,symbol in zip([kelley_samps,samps1],["d","s"]): #for samps,symbol in zip([samps1],["s"]): for key,value in samps.iteritems(): if value.pts["MGO(WT%)"]>6:# and key not in exclude_samps: katz_mg_res_fit=[] ti_mg_res_fit=[]
x0 = fsolve(mf_root_finding, 0, (cond[1], cond[0], h2o_bulk))[0] return x0 volcano_TP = { "Agrigan": [1330, 1.87], "Guguan": [1356, 1.9], "Pagan": [1346, 1.61], "Sarigan": [1260, 1.14] } volcano_colours = {"Agrigan": "b", "Guguan": "r", "Pagan": "g", "Sarigan": "m"} for sub_zone in ["Southern_Marianas"]: # #samps1=pet_read_in_with_labels.pet_read_in("/data/ap4909/30.10.2013-hot_cold_geochem/get_lat_lon_data/sz_with_lat_lon/individual_files/individual_files_with_feo/%s_new.xls"%(sub_zone),1,sub_zone)[0] kelley_samps = pet_read_in_with_labels.pet_read_in( "/data/ap4909/30.10.2013-hot_cold_geochem/sample_testing/southern_marianas/kelley/kelley_appendix_4_formatted.xls", 0, sub_zone)[0] mineral_props = { "Fo=92": { "ol": 0.65, "opx": 0.3, "cpx": 0.05 }, "Fo=91": { "ol": 0.65, "opx": 0.25, "cpx": 0.1 }, "Fo=90": { "ol": 0.65,
b=132.899012 c=1159.66061#value from kelley 2010 x=-136.88 y=332.01 Dh2o=0.012 return h2o_bulk-(Dh2o*(1-Ff)+Ff)*((T-(a*P**2+b*P+c)-(x*math.log(P)+y)*F)/-60)**1.85 x0=fsolve(mf_root_finding,0,(cond[1],cond[0],h2o_bulk))[0] return x0 volcano_TP={"Agrigan":[1330,1.87],"Guguan":[1356,1.9],"Pagan":[1346,1.61],"Sarigan":[1260,1.14]} volcano_colours={"Agrigan":"b","Guguan":"r","Pagan":"g","Sarigan":"m"} for sub_zone in["Southern_Marianas"]:# #samps1=pet_read_in_with_labels.pet_read_in("/data/ap4909/30.10.2013-hot_cold_geochem/get_lat_lon_data/sz_with_lat_lon/individual_files/individual_files_with_feo/%s_new.xls"%(sub_zone),1,sub_zone)[0] kelley_samps=pet_read_in_with_labels.pet_read_in("/data/ap4909/30.10.2013-hot_cold_geochem/sample_testing/southern_marianas/kelley/kelley_appendix_4_formatted.xls",0,sub_zone)[0] mineral_props={"Fo=92":{"ol":0.65,"opx":0.3,"cpx":0.05},"Fo=91":{"ol":0.65,"opx":0.25,"cpx":0.1},"Fo=90":{"ol":0.65,"opx":0.2,"cpx":0.15}} #mineral proportions for fo90,fo91,fo92 mantle ax=plt.gca() #ax2=ax.twinx() latitudes=[] p_vals=[] mf_vals=[] for samps,symbol in zip([kelley_samps],["d"]): #for samps,symbol in zip([samps1],["s"]): for h2o in [4]:
samp_errors={} #stores lowest for each sample done=0 #indicating whether first composition has been run through sub_zone="%s"%zone #Pressure function d_a=[ 0., 3000., 15000., 24400., 71000., 171000., 220000.,271000., 371000., 400000., 471000., 571000., 670000., 771000., 871000., 971000., 1071000., 1171000., 1271000., 1371000., 1471000.,1571000., 1671000., 1771000., 1871000., 1971000., 2071000., 2171000.,2271000., 2371000., 2471000., 2571000., 2671000., 2771000., 2871000.,2891000.] #PREM depths p_a=[ 0.00000000e+00, 0.00000000e+00, 3.00000000e+08, 6.00000000e+08, 2.20000000e+09, 5.50000000e+09 , 7.10000000e+09, 8.90000000e+09, 1.23000000e+10, 1.34000000e+10, 1.60000000e+10, 1.99000000e+10, 2.38000000e+10, 2.83000000e+10, 3.28000000e+10, 3.73000000e+10, 4.19000000e+10 , 4.65000000e+10, 5.12000000e+10, 5.59000000e+10, 6.07000000e+10, 6.55000000e+10,7.04000000e+10, 7.54000000e+10, 8.04000000e+10, 8.55000000e+10, 9.06000000e+10, 9.58000000e+10, 1.01100000e+11, 1.06400000e+11, 1.11900000e+11, 1.17400000e+11, 1.23000000e+11, 1.28800000e+11 , 1.34600000e+11, 1.35800000e+11] #PREM pressures def prem_pressure(height): for prem_depth in range(1,len(d_a)): #loops through depths, starting at index one if -height<=d_a[prem_depth]: #checks in which depth interval the height is Pressure=((p_a[prem_depth]-p_a[prem_depth-1])/(d_a[prem_depth]-d_a[prem_depth-1]))*((-height)-d_a[prem_depth-1])+p_a[prem_depth-1] break return Pressure labels=[] index=1 samps=pet_read_in_with_labels.pet_read_in("pt_files/%s_calculate_pt.csv"%(sub_zone)) #samps=pet_read_in_with_labels.pet_read_in("testing/test1.csv") mineral_props={"Fo=92":{"ol":0.65,"opx":0.3,"cpx":0.05},"Fo=91":{"ol":0.65,"opx":0.25,"cpx":0.1},"Fo=90":{"ol":0.65,"opx":0.2,"cpx":0.15}} #mineral proportions for fo90,fo91,fo92 mantle mant_vals={"Fo=92":{"Y":3.129,"La":0.134,"Ti":650.0},"Fo=91":{"Y":3.328,"La":0.192,"Ti":716.3},"Fo=90":{"Y":3.548,"La":0.253,"Ti":792.0}}#mantle concentrations for DDMM, Ave DMM and enriched DMM from workman and Hart 2005 for comp in mant_vals.keys(): for key,value in samps.iteritems(): ti_est=[]# list to store ti melt fraction estimates at different h2os Y_est=[]# list to store Y melt fraction estimates at different h2os katz_est=[]# list to store major element melt fraction estimates at different h2os pt_sample={} #Plotting F estimates from element concs