ax = fig.add_axes([0.05, 0.05, 0.9, 0.9]) ax.scatter(rlm.predict(), rlm.resid) ax.set_ylabel('residual') ax.set_xlabel('yhat') #%% OLS model on profile # indicate if want to use deltaDelta ddelta = 1 filename = 'Non_peat_data_synthesis.csv' cutdep = 40. Cave14C = prep.getCweightedD14C2(filename) data = pd.read_csv(filename,encoding='iso-8859-1',index_col='ProfileID', skiprows=[1]) profid = data[data['Start_of_Profile']==1].index # index of profile start d14C = prep.getvarxls(data,'D14C_BulkLayer', profid, ':') sampleyr = prep.getvarxls(data, 'SampleYear', profid, ':') dd14C = prep.getDDelta14C(sampleyr, d14C) tau, cost = C14tools.cal_tau(d14C, sampleyr) data['tau'] = pd.Series(tau[:,0], index=data.index) mat = prep.getvarxls(data,'MAT', profid, ':') mapp = prep.getvarxls(data,'MAP', profid, ':') layerbot = prep.getvarxls(data, 'Layer_bottom_norm', profid, ':') vegid = prep.getvarxls(data, 'VegTypeCode_Local', profid, ':') vegiduniq = np.unique(vegid[~np.isnan(vegid)]) soilorder = prep.getvarxls(data, 'LEN Order', profid, ':') soilorder = np.array([str(i) for i in soilorder]) soilorderuniq = np.unique(soilorder[soilorder != 'nan']) lon = prep.getvarxls(data,'Lon',profid,':') lat = prep.getvarxls(data,'Lat',profid,':') clayon = 0 nppon = 0 plott = 0