Beispiel #1
0
    def test_io_survey(self):

        data_object = Data(survey=self.survey)
        filename = "survey.mag"

        write_mag3d_ubc(filename, data_object)
        data_loaded = read_mag3d_ubc(filename)
        os.remove(filename)

        passed = np.all(
            np.isclose(
                self.survey.receiver_locations, data_loaded.survey.receiver_locations
            )
        )
        self.assertTrue(passed, True)

        passed = np.all(
            np.isclose(
                self.survey.source_field.parameters,
                data_loaded.survey.source_field.parameters,
            )
        )
        self.assertTrue(passed, True)

        print("SURVEY FILE IO FOR MAG3D PASSED")
Beispiel #2
0
    def test_io_dobs(self):

        data_object = Data(survey=self.survey,
                           dobs=self.dobs,
                           standard_deviation=self.std)
        filename = "dpred.mag"

        write_mag3d_ubc(filename, data_object)
        data_loaded = read_mag3d_ubc(filename)
        os.remove(filename)

        passed = np.all(
            np.isclose(
                np.c_[self.survey.receiver_locations, self.dobs, self.std],
                np.c_[data_loaded.survey.receiver_locations, data_loaded.dobs,
                      data_loaded.standard_deviation, ],
            ))
        self.assertTrue(passed, True)

        passed = np.all(
            np.isclose(
                self.survey.source_field.parameters,
                data_loaded.survey.source_field.parameters,
            ))
        self.assertTrue(passed, True)

        print("OBSERVED DATA FILE IO FOR MAG3D PASSED")
Beispiel #3
0
    def test_magnetics_inversion(self):

        inp_file = os.path.sep.join([self.basePath, "SimPEG_Mag_Input.inp"])

        driver = MagneticsDriver_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_mag3d_ubc(
            os.path.sep.join([self.basePath, "FWR_data.dat"]), driver.data)

        # Read it back
        data = io_utils.read_mag3d_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)
Beispiel #4
0
    "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(),
    data_mag.survey.receiver_locations[:, 1].max(),
])
mesh.plotSlice(
    np.ones(mesh.nC),