question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Utils.ModelBuilder

See original GitHub issue

Does anyone use these functions in Utils.ModelBuilder?

defineTwoLayers
defineBlock
layeredModel
addBlock

If not, can we remove them, or refactor them?

Issue Analytics

  • State:open
  • Created 8 years ago
  • Comments:7 (7 by maintainers)

github_iconTop GitHub Comments

1reaction
jcapriotcommented, Aug 7, 2020

We’re thinking of moving this into the discretize repository as they are mesh independent and could be more useful for a more general approach.

0reactions
rowanc1commented, Mar 5, 2017
if __name__ == '__main__':

    from discretize import TensorMesh
    from matplotlib import pyplot as plt

    # Define the mesh

    testDim = 2
    h1 = 0.3*np.ones(7)
    h1[0] = 0.5
    h1[-1] = 0.6
    h2 = .5 * np.ones(4)
    h3 = .4 * np.ones(6)
    x0 = np.zeros(3)

    if testDim == 1:
        h = [h1]
        x0 = x0[0]
    elif testDim == 2:
        h = [h1, h2]
        x0 = x0[0:2]
    else:
        h = [h1, h2, h3]

    M = TensorMesh(h, x0)

    ccMesh = M.gridCC

    # ------------------- Test conductivities! --------------------------
    print('Testing 1 block conductivity')

    p0 = np.array([0.5,0.5,0.5])[:testDim]
    p1 = np.array([1.0,1.0,1.0])[:testDim]
    vals = np.array([100,1e-6])

    sigma = defineBlockConductivity(ccMesh,p0,p1,vals)

    # Plot sigma model
    print(sigma.shape)
    M.plotImage(sigma)
    print('Done with block! :)')
    plt.show()

    # -----------------------------------------
    print('Testing the two layered model')
    vals = np.array([100,1e-5]);
    depth    = 1.0;

    sigma = defineTwoLayeredConductivity(ccMesh,depth,vals)

    M.plotImage(sigma)
    print(sigma)
    print('layer model!')
    plt.show()

    # -----------------------------------------
    print('Testing scalar conductivity')

    if testDim == 1:
        pFunction = lambda x: np.exp(x)
    elif testDim == 2:
        pFunction = lambda x,y: np.exp(x+y)
    elif testDim == 3:
        pFunction = lambda x,y,z: np.exp(x+y+z)

    sigma = scalarConductivity(ccMesh,pFunction)

    # Plot sigma model
    M.plotImage(sigma)
    print(sigma)
    print('Scalar conductivity defined!')
    plt.show()

    # -----------------------------------------

I have removed this from the bottom of the ModelBuilder code. It is not being run.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Utilities—ArcGIS Pro | Documentation
There are five utilities that support advanced behavior in ModelBuilder. You can add a utility to your model by clicking ModelBuilder > Insert...
Read more >
com.badlogic.gdx.graphics.g3d.utils.ModelBuilder. ...
ModelBuilder. Best Java code snippets using com.badlogic.gdx.graphics.g3d.utils.ModelBuilder.rebuildReferences (Showing top 9 results out of 315).
Read more >
ModelBuilder (Eclipse RDF4J 4.2.1)
Builder to facilitate easier creation of new RDF Model objects via a fluent interface. All methods returning a ModelBuilder return an immutable reference...
Read more >
QuaggaLib/ModelBuilder.py at master · HPI-Information-Systems ...
coding: utf-8 -*-. import keras.backend as K. from keras_contrib.utils import save_load_utils. from keras.models import model_from_json.
Read more >
ModelBuilder resets tools to 'ready-to-run' state
Hello! When working with ModelBuilder, tools that I have already run and are in the 'has-been-run' state are very often reset to ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found