def extrapolate(self): # get well log well_name = self.well_comboBox.currentText() well = ppp.Well(str(CONF.well_dir / ".{}".format(well_name))) log = well.get_log(str(self.log_comboBox.currentText())) sm_log = well.get_log(str(self.sm_log_comboBox.currentText())) # get a, b a, b = float(self.a_lineEdit.text()), float(self.b_lineEdit.text()) shift = well.kelly_bushing + well.water_depth shift_depth = np.array(log.depth) mask = shift_depth >= shift shift_depth = shift_depth[mask] new_den = np.full_like(np.array(log.data), np.nan) new_den[mask] = ppp.traugott(shift_depth, a, b) old_den = np.array(sm_log.data) old_mask = np.isfinite(old_den) new_den[old_mask] = old_den[old_mask] self.extraploated_log = ppp.Log() self.extraploated_log.depth = sm_log.depth self.extraploated_log.data = new_den self.extraploated_log.units = sm_log.units # self.fit_line_ax.append(self.ax.plot(new_den, log.depth)[0]) self.fit_line_ax2.append(self.ax2.plot(new_den, log.depth)[0]) self.matplotlib_widget.fig.canvas.draw()
def draw_line_with_a_b(self): # get well log well_name = self.well_comboBox.currentText() well = ppp.Well(str(CONF.well_dir / ".{}".format(well_name))) log = well.get_log(str(self.log_comboBox.currentText())) # get a, b a, b = float(self.a_lineEdit.text()), float(self.b_lineEdit.text()) shift = well.kelly_bushing + well.water_depth shift_depth = np.array(log.depth) mask = shift_depth >= shift shift_depth = shift_depth[mask] new_den = np.full_like(np.array(log.data), np.nan) new_den[mask] = ppp.traugott(shift_depth, a, b) self.fit_line_ax.append(self.ax.plot(new_den, log.depth)[0]) self.fit_line_ax2.append(self.ax2.plot(new_den, log.depth)[0]) self.matplotlib_widget.fig.canvas.draw()
def fit_button_on_clicked(self): # get well log well_name = self.well_comboBox.currentText() well = ppp.Well(str(CONF.well_dir / ".{}".format(well_name))) log = well.get_log(str(self.log_comboBox.currentText())) # get interval for fitting if self.start_lineEdit.text() == "": fit_start = log.top self.start_lineEdit.setText("{}".format(fit_start)) else: fit_start = float(self.start_lineEdit.text()) if self.end_lineEdit.text() == "": fit_stop = log.bottom self.end_lineEdit.setText("{}".format(fit_stop)) else: fit_stop = float(self.end_lineEdit.text()) # do fitting shift = well.kelly_bushing + well.water_depth start_idx = log.get_depth_idx(fit_start) stop_idx = log.get_depth_idx(fit_stop) + 1 depth = np.array(log.depth[start_idx:stop_idx + 1]) - shift den = np.array(log.data[start_idx:stop_idx + 1]) # dt = vel**(-1) # dt_log = np.log(dt) fit_mask = np.isfinite(den) # dt_log_finite = dt_log[mask] # depth_finite = depth[mask] popt, pcov = curve_fit(ppp.traugott, depth[fit_mask], den[fit_mask]) a, b = popt self.a_lineEdit.setText("{}".format(a)) self.b_lineEdit.setText("{}".format(b)) # plot on graph shift_depth = np.array(log.depth) mask = shift_depth >= shift shift_depth = shift_depth[mask] new_den = np.full_like(np.array(log.data), np.nan) new_den[mask] = ppp.traugott(shift_depth, a, b) self.fit_line_ax.append(self.ax.plot(new_den, log.depth)[0]) self.fit_line_ax2.append(self.ax2.plot(new_den, log.depth)[0]) self.matplotlib_widget.fig.canvas.draw()
def test_traugott(depth): assert (ppp.traugott(depth, 1, 1) == depth + 1.70).all()