예제 #1
0
    def setUp(self):
        url = "https://storage.googleapis.com/simpeg/tests/dc_utils/"
        cloudfiles = [
            "mesh3d.msh",
            "2spheres_conmodel.npy",
            "rhoA_GIF_dd.txt",
            "rhoA_GIF_dp.txt",
            "rhoA_GIF_pd.txt",
            "rhoA_GIF_pp.txt",
        ]

        self.basePath = os.path.expanduser("~/Downloads/TestDCUtilsHalfSpace")
        io_utils.download(
            [url + f for f in cloudfiles], folder=self.basePath, overwrite=True
        )

        # Load Mesh
        mesh_file = os.path.sep.join([self.basePath, "mesh3d.msh"])
        mesh = discretize.load_mesh(mesh_file)
        self.mesh = mesh

        # Load Model
        model_file = os.path.sep.join([self.basePath, "2spheres_conmodel.npy"])
        model = np.load(model_file)
        self.model = model

        xmin, xmax = -15.0, 15.0
        ymin, ymax = 0.0, 0.0
        zmin, zmax = -0.25, -0.25
        xyz = np.array([[xmin, ymin, zmin], [xmax, ymax, zmax]])
        self.xyz = xyz
        self.survey_a = 1.0
        self.survey_b = 1.0
        self.survey_n = 10
        self.plotIt = False
예제 #2
0
 def test_save_load(self):
     print('\nTesting save / load of Cyl Mesh ...')
     mesh0 = self.mesh
     f = mesh0.save()
     mesh1 = discretize.load_mesh(f)
     compare_meshes(self, mesh0, mesh1)
     os.remove(f)
# unzip the tarfile
tar = tarfile.open(downloads, "r")
tar.extractall()
tar.close()

# Download the inverted model
f = discretize.utils.download(
    "https://storage.googleapis.com/simpeg/laguna_del_maule_slicer.tar.gz",
    overwrite=True,
)
tar = tarfile.open(f, "r")
tar.extractall()
tar.close()

# Load the mesh/data
mesh = discretize.load_mesh(
    os.path.join("laguna_del_maule_slicer", "mesh.json"))
models = {
    "Lpout": np.load(os.path.join("laguna_del_maule_slicer", "Lpout.npy"))
}

###############################################################################
# Create PyVista data objects
# ---------------------------
#
# Here we start making PyVista data objects of all the spatially referenced
# data.

# Get the PyVista dataset of the inverted model
dataset = mesh.to_vtk(models)

###############################################################################