Skip to content

Instantly share code, notes, and snippets.

WITHOUT MODIFYING transD_GP: Adding an inverse (and forward) method using the transD_GP API

A 1D example to help you get along

Here we'll add a forward physics module called BarPhysics, which is totally independent of transD_GP. To couple the physics through a misfit function to transD_GP we'll use a helper module BarPhysicsInversion. This helps in code distribution as the authors of BarPhysics will not have to modifytransD_GP at all. Navigate to examples/Bar and have a look at BarPhysics.jl, which willl contain everything you need for forward computation, this file needs to know nothing about transD_GP. To define the get_misfit function such that transD_GP can use it, look at BarPhysicsInversion.jl in the same folder.

Have a close look at these two files

@a2ray
a2ray / add_method.md
Last active July 16, 2021 06:51
Adding a forward or regression method to transD_GP

Adding an inverse (and forward) method using the transD_GP API

A 1D example to help you get along

Here we'll add a module called FooPhysics, which is totally independent of transD_GP. To couple the physics through a misfit function to transD_GP we'll use a helper module FooPhysicsInversion. This helps in code maintenance as the authors of FooPhysics will not have the time to maintain the integration with transD_GP. That's our job!

All the inverse (and forward) physics (e.g., CSEM and AEM) as well as regression methods (e.g., Line and Surface regression) have to be included in the src/GeophysOperator.jl, so this is where I have added FooPhysics.jl and FooPhysicsInversion.jl through includes as follows:

.
.
include("FooPhysics.jl") # example for API
@a2ray
a2ray / julia_vscode.md
Last active April 22, 2022 02:25
Install VSCode/Julia

Install Julia from binary for your platform, download the VSCode RPM

rpm2cpio code-xxxx-vyyy.rpm | cpio -idv

find the code binary and run it

Additional info from @richardt94 :

Code binary is at <rpmdir>/usr/share/code/bin/code, where <rpmdir> is the folder where you ran the command in the gist. Best way to make running VSCode easy is to add the following line to ~/.bashrc:

@a2ray
a2ray / julia_revise_workflow.md
Last active July 11, 2022 18:08
Julia package workflow

A julia package workflow with Revise

You know your project will become a package -- don't deny it. Here's a hygienic workflow to start with, right at the outset.

The first thing is to install Revise and use it.

  • Hit the ] key to enter pkg> mode. When you see the pkg> prompt:
  • pkg> add Revise
  • hit Bksp to get back to the julia> REPL, and once there:
  • julia> using Revise