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")