def velocity_to_density_conversion(input_object, output_object, c, d): input_seisegy = ppp.SeiSEGY(str(input_object.path)) output_seisegy = ppp.SeiSEGY(str(output_object.path)) # twt = np.array(list(input_seisegy.depths())) for il in input_seisegy.inlines(): input_data_inline = input_seisegy.inline(il) output_data_inline = np.copy(input_data_inline) for idx in range(input_seisegy.nNorth): output_data_inline[idx] = ppp.gardner(input_data_inline[idx], c, d) output_seisegy.update(ppp.InlineIndex(il), output_data_inline)
def average_to_interval(input_object, output_object): input_seisegy = ppp.SeiSEGY(str(input_object.path)) output_seisegy = ppp.SeiSEGY(str(output_object.path)) twt = np.array(list(input_seisegy.depths())) for il in input_seisegy.inlines(): input_data_inline = input_seisegy.inline(il) output_data_inline = np.copy(input_data_inline) for idx in range(input_seisegy.nNorth): output_data_inline[idx] = ppp.avg2int(twt, input_data_inline[idx]) output_seisegy.update(ppp.InlineIndex(il), output_data_inline)
def obp_calculation(input_object, output_object): input_seisegy = ppp.SeiSEGY(str(input_object.path)) stepDepth = input_seisegy.survey_setting.stepDepth output_seisegy = ppp.SeiSEGY(str(output_object.path)) # depth = np.array(list(input_seisegy.depths())) for il in input_seisegy.inlines(): input_data_inline = input_seisegy.inline(il) output_data_inline = np.copy(input_data_inline) for idx in range(input_seisegy.nNorth): output_data_inline[idx] = ppp.obp_trace(input_data_inline[idx], stepDepth) output_seisegy.update(ppp.InlineIndex(il), output_data_inline)
def eaton_calculation(obp_object, vel_object, output_object, a, b, n): obp_seisegy = ppp.SeiSEGY(str(obp_object.path)) vel_seisegy = ppp.SeiSEGY(str(vel_object.path)) output_seisegy = ppp.SeiSEGY(str(output_object.path)) # preparation depth = np.array(list(obp_seisegy.depths())) vn = ppp.normal(depth, a, b) hydrostatic = ppp.hydrostatic_trace(depth) # actual calcualtion for il in obp_seisegy.inlines(): obp_data_inline = obp_seisegy.inline(il) vel_data_inline = vel_seisegy.inline(il) output_data_inline = np.copy(obp_data_inline) for idx in range(obp_seisegy.nNorth): output_data_inline[idx] = ppp.eaton( vel_data_inline[idx], vn, hydrostatic, obp_data_inline[idx], n=n) output_seisegy.update(ppp.InlineIndex(il), output_data_inline)
def bowers_calculation(obp_object, vel_object, output_object, a, b): obp_seisegy = ppp.SeiSEGY(str(obp_object.path)) vel_seisegy = ppp.SeiSEGY(str(vel_object.path)) output_seisegy = ppp.SeiSEGY(str(output_object.path)) # actual calcualtion for il in obp_seisegy.inlines(): obp_data_inline = obp_seisegy.inline(il) vel_data_inline = vel_seisegy.inline(il) output_data_inline = np.copy(obp_data_inline) for idx in range(obp_seisegy.nNorth): output_data_inline[idx] = ppp.bowers(vel_data_inline[idx], obp_data_inline[idx], 1, start_idx=-1, a=a, b=b, vmax=5000, end_idx=None) output_seisegy.update(ppp.InlineIndex(il), output_data_inline)
def new_seis_object(self, name): # emit status signal to MainWindow self.status.emit("Setting up seismic data object ...") data_path = Path(CONF.data_root) / CONF.current_survey / \ "Seismics" / ".{}".format(name) if data_path.exists() is True: segy_path = "" with open(str(data_path), "r") as fl: json_object = json.load(fl) segy_path = json_object['path'] seis_object = ppp.SeiSEGY(segy_path) setattr(self, "data_{}".format(name), seis_object) # flush status bar self.status.emit("")
def test__seisegy(): seis_cube = ppp.SeiSEGY("test/data/f3_sparse.sgy") # test generators assert list(seis_cube.inlines()) == list(range(200, 641, 20)) assert list(seis_cube.crlines())[-1] == 1200 assert list(seis_cube.inline_crlines())[-1] == (640, 1200) assert list(seis_cube.depths())[-1] == 1100 # test retrieve data first_test_cdp_data = seis_cube.data(ppp.CdpIndex((200, 700))) assert (seis_cube.data(ppp.InlineIndex(200))[0] == \ first_test_cdp_data).all() assert (seis_cube.data(ppp.CrlineIndex(700))[0] == \ first_test_cdp_data).all() assert seis_cube.data(ppp.DepthIndex(1100))[0][0] == \ first_test_cdp_data[-1] assert seis_cube.valid_cdp((199, 400)) == (200, 400) assert str(seis_cube) == repr(seis_cube)
def create_seis_object(self, segy_path): seis_object = ppp.SeiSEGY(segy_path) self.tableWidget.setItem(0, 0, QTableWidgetItem("1")) self.tableWidget.setItem(1, 0, QTableWidgetItem("1 - Floating point")) self.tableWidget.setItem( 2, 0, QTableWidgetItem("{} ({} traces)".format( seis_object.survey_setting.nDepth, seis_object.survey_setting.nEast * \ seis_object.survey_setting.nNorth))) self.tableWidget.setItem( 3, 0, QTableWidgetItem("{} - {} (s or m)".format( seis_object.survey_setting.startDepth * 0.001, seis_object.survey_setting.endDepth * 0.001))) self.tableWidget.setItem( 4, 0, QTableWidgetItem("{} - {}".format( seis_object.survey_setting.startInline, seis_object.survey_setting.endInline))) self.tableWidget.setItem( 5, 0, QTableWidgetItem("{} - {}".format( seis_object.survey_setting.startCrline, seis_object.survey_setting.endCrline))) self.nsample_spinBox.setValue(seis_object.survey_setting.nDepth) self.start_lineEdit.setText( str(seis_object.survey_setting.startDepth * 0.001)) self.step_lineEdit.setText( str(seis_object.survey_setting.stepDepth * 0.001)) self.info_dict = { "inline_range": [ seis_object.survey_setting.startInline, seis_object.survey_setting.endInline, seis_object.survey_setting.stepInline ], "crline_range": [ seis_object.survey_setting.startCrline, seis_object.survey_setting.endCrline, seis_object.survey_setting.stepCrline ], "z_range": [ float(seis_object.survey_setting.startDepth), float(seis_object.survey_setting.endDepth), float(seis_object.survey_setting.stepDepth) ] }
def plot_seis(self, dataset_name): data_path = Path(CONF.data_root) / CONF.current_survey / \ "Seismics" / ".{}".format(dataset_name) # seis_object = ppp.SeisCube(str(data_path)) segy_path = "" inDepth = None property_type = None with open(str(data_path), "r") as fl: json_object = json.load(fl) segy_path = json_object['path'] property_type = json_object['Property_Type'] inDepth = json_object['inDepth'] seis_object = ppp.SeiSEGY(segy_path) seis_object.inDepth = inDepth seis_object.property_type = property_type cm = "" if seis_object.property_type == 'Reflection': cm = u'seismic' elif seis_object.property_type == "Velocity": cm = u'jet' else: cm = u"seismic" # read data into a ndarray data_cube = list() start = time.time() for inline in seis_object.inlines(): data_cube.append(seis_object.inline(inline)) data_cube = np.array(data_cube) end = time.time() - start self.statusBar().showMessage("{}ms used for reading data".format(end)) start2 = time.time() # Create source setattr(self, "source_{}".format(dataset_name), \ self.mayavi_widget.visualization.scene. \ mlab.pipeline.scalar_field(data_cube)) # self.source = self.mayavi_widget.visualization.scene.\ # mlab.pipeline.scalar_field(data_cube, name=dataset_name) self.statusBar().showMessage("type {}".format(type(self.source))) length_inline = (seis_object.survey_setting.nEast - 1) * \ seis_object.survey_setting.stepInline * \ seis_object.survey_setting.inline_bin length_depth = (seis_object.survey_setting.nDepth - 1) * \ seis_object.survey_setting.stepDepth scale = 0.5 * length_inline / length_depth getattr(self, "source_{}".format(dataset_name)).spacing = [ seis_object.survey_setting.inline_bin * \ seis_object.survey_setting.stepInline, seis_object.survey_setting.crline_bin * \ seis_object.survey_setting.stepCrline, -seis_object.stepDepth * scale] x_slice = self.mayavi_widget.visualization.scene.\ mlab.pipeline.image_plane_widget( getattr(self, "source_{}".format(dataset_name)), plane_orientation='x_axes', slice_index=int(seis_object.survey_setting.nEast // 2), colormap=cm, name="inline_slice") x_slice.module_manager.scalar_lut_manager.reverse_lut = True y_slice = self.mayavi_widget.visualization.scene.\ mlab.pipeline.image_plane_widget( getattr(self, "source_{}".format(dataset_name)), plane_orientation='y_axes', slice_index=int(seis_object.survey_setting.nNorth // 2), colormap=cm, name="crline_slice") y_slice.module_manager.scalar_lut_manager.reverse_lut = True z_slice = self.mayavi_widget.visualization.scene.\ mlab.pipeline.image_plane_widget( getattr(self, "source_{}".format(dataset_name)), plane_orientation='z_axes', slice_index=int(seis_object.survey_setting.nDepth // 2), colormap=cm, name='z_slice') z_slice.module_manager.scalar_lut_manager.reverse_lut = True # for axis in ['x', 'y', 'z']: # plane = self.mayavi_widget.visualization.scene.\ # mlab.pipeline.image_plane_widget( # self.source, # plane_orientation='{}_axes'.format(axis), # slice_index=100, # colormap='Greys') # # only slice is reversed(the actual data is not) # plane.module_manager.scalar_lut_manager.reverse_lut = True outline = self.mayavi_widget.visualization.scene.\ mlab.outline() # add direction hint self.mayavi_widget.visualization.scene.\ mlab.orientation_axes( xlabel='inline', ylabel='crline', zlabel='depth') ax = self.mayavi_widget.visualization.scene. \ mlab.axes( xlabel='inline', ylabel='crline', zlabel='depth', ranges=[ seis_object.survey_setting.startInline, seis_object.survey_setting.endInline, seis_object.survey_setting.startCrline, seis_object.survey_setting.endCrline, seis_object.survey_setting.endDepth, seis_object.survey_setting.startDepth]) ax.axes.label_format = '%.0f' self.mayavi_widget.visualization.scene.mlab.colorbar( orientation='vertical', label_fmt='%.1f') self.mayavi_widget.visualization.scene. \ mlab.show()