def test_gravity_inversion(self): inp_file = os.path.sep.join([self.basePath, "SimPEG_Grav_Input.inp"]) driver = GravityDriver_Inv(inp_file) print(driver.mesh) print(driver.survey) print(driver.m0) print(driver.mref) print(driver.activeCells) print(driver.staticCells) print(driver.dynamicCells) print(driver.chi) print(driver.nC) print(driver.alphas) print(driver.bounds) print(driver.lpnorms) print(driver.eps) # Write obs to file io_utils.write_grav3d_ubc( os.path.sep.join([self.basePath, "FWR_data.dat"]), driver.data) # Read it back data = io_utils.read_grav3d_ubc( os.path.sep.join([self.basePath, "FWR_data.dat"])) # Check similarity passed = np.all(data.dobs == driver.data.dobs) self.assertTrue(passed, True) # Clean up the working directory shutil.rmtree(self.basePath)
def test_io_survey(self): data_object = Data(survey=self.survey) filename = "survey.grv" write_grav3d_ubc(filename, data_object) data_loaded = read_grav3d_ubc(filename) os.remove(filename) passed = np.all( np.isclose(self.survey.receiver_locations, data_loaded.survey.receiver_locations)) self.assertTrue(passed, True) print("SURVEY FILE IO FOR GRAV3D PASSED")
def test_io_dpred(self): data_object = Data(survey=self.survey, dobs=self.dobs) filename = "dpred.grv" write_grav3d_ubc(filename, data_object) data_loaded = read_grav3d_ubc(filename) os.remove(filename) passed = np.all( np.isclose( np.c_[self.survey.receiver_locations, self.dobs], np.c_[data_loaded.survey.receiver_locations, data_loaded.dobs], )) self.assertTrue(passed, True) print("PREDICTED DATA FILE IO FOR GRAV3D PASSED")
geocb = plt.colorbar(geoplot[0], cax=ax[3], ticks=[0, 1, 2]) geocb.set_label("True geology model\n(classification/density/mag. susc.)", fontsize=labelsize) geocb.set_ticklabels([ "BCKGRD (0 g/cc; 0 SI)", "PK (-0.8 g/cc; 5e-3 SI)", "VK (-0.2 g/cc; 2e-2 SI)" ]) geocb.ax.tick_params(labelsize=ticksize) ax[3].set_aspect(10) plt.show() # Load geophysical data data_grav_file = io_utils.download( "https://storage.googleapis.com/simpeg/pgi_tutorial_assets/gravity_data.obs" ) data_grav = io_utils.read_grav3d_ubc(data_grav_file) data_mag_file = io_utils.download( "https://storage.googleapis.com/simpeg/pgi_tutorial_assets/magnetic_data.obs" ) data_mag = io_utils.read_mag3d_ubc(data_mag_file) # plot data and mesh fig, ax = plt.subplots(2, 2, figsize=(15, 10)) ax = ax.reshape(-1) plt.gca().set_aspect("equal") plt.gca().set_xlim([ data_mag.survey.receiver_locations[:, 0].min(), data_mag.survey.receiver_locations[:, 0].max(), ], ) plt.gca().set_ylim([ data_mag.survey.receiver_locations[:, 1].min(),