Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update example for new SlimPlotting #276

Merged
merged 1 commit into from
Oct 29, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/ci-examples.yml
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ jobs:

- name: Install packages
run: |
julia -e 'using Pkg;Pkg.add(["SlimPlotting", "PyPlot", "NLopt", "Flux", "JOLI", "Zygote", "IterativeSolvers", "SlimOptim", "HDF5", "SegyIO", "SetIntersectionProjection"])'
julia -e 'using Pkg;Pkg.add(["SlimPlotting", "PythonPlot", "NLopt", "Flux", "JOLI", "Zygote", "IterativeSolvers", "SlimOptim", "HDF5", "SegyIO", "SetIntersectionProjection"])'
julia -e 'using Pkg; Pkg.develop(PackageSpec(path=pwd()))'

- name: Run examples
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ run(`wget ftp://slim.gatech.edu/data/SoftwareRelease/WaveformInversion.jl/2DFWI/
The first step is to load the velocity model and the observed data into Julia, as well as setting up bound constraints for the inversion, which prevent too high or low velocities in the final result. Furthermore, we define an 8 Hertz Ricker wavelet as the source function:

```Julia
using PyPlot, HDF5, SegyIO, JUDI, SlimOptim, Statistics, Random
using PythonPlot, HDF5, SegyIO, JUDI, SlimOptim, Statistics, Random

# Load starting model
n, d, o, m0 = read(h5open("overthrust_2D_initial_model.h5", "r"), "n", "d", "o", "m0")
Expand Down Expand Up @@ -204,7 +204,7 @@ run(`wget ftp://slim.gatech.edu/data/SoftwareRelease/Imaging.jl/2DLSRTM/marmousi
Once again, load the starting model and the data and set up the source wavelet. For this example, we use a Ricker wavelet with 30 Hertz peak frequency. For setting up matrix-free linear operators, an `info` structure with the dimensions of the problem is required:

```Julia
using PyPlot, HDF5, JUDI, SegyIO, Random
using PythonPlot, HDF5, JUDI, SegyIO, Random

# Load smooth migration velocity model
n,d,o,m0 = read(h5open("marmousi_migration_velocity.h5","r"), "n", "d", "o", "m0")
Expand Down
2 changes: 1 addition & 1 deletion docker/Dockerfile.base
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ RUN for pkg in "SegyIO" "JOLI" "JUDI" "SlimOptim" "InvertibleNetworks"; do \
julia -e "using Pkg;Pkg.develop(\"$pkg\");using $pkg"; \
done
RUN for pkg in "LineSearches" "Optim" "DSP" "Dierckx" "NLopt" "FFTW" "SetIntersectionProjection" "IterativeSolvers" "JLD" \
"Flux" "Zygote" "JLD2" "HDF5" "PyPlot" "PyCall" "Distributed" "Images" "SlimPlotting"; do \
"Flux" "Zygote" "JLD2" "HDF5" "PythonPlot" "PyCall" "Distributed" "Images" "SlimPlotting"; do \
julia -e "using Pkg;Pkg.add(\"$pkg\"); using $pkg"; \
done

Expand Down
2 changes: 1 addition & 1 deletion docs/Project.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[deps]
Documenter = "e30172f5-a6a5-5a46-863b-614d45cd2de4"
PyPlot = "d330b81b-6aea-500a-939a-2ce795aea3ee"
PythonPlot = "274fc56d-3b97-40fa-a1cd-1b4a50311bf9"
Weave = "44d3d7a6-8a23-5bf8-98c5-b353f8df5ec9"

[compat]
Expand Down
6 changes: 3 additions & 3 deletions docs/src/basics.md
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ d_obs = F*q
We can plot a 2D shot record by accessing the `.data` field of the `judiVector`, which contains the data in the original (non-vectorized) dimensions:

```julia
using PyPlot
using PythonPlot
imshow(d_obs.data[1], vmin=-5, vmax=5, cmap="seismic", aspect="auto")
```

Expand Down Expand Up @@ -230,7 +230,7 @@ d_obs = Pr*A_inv*Ps'*q
The 3D shot records are still saved as 2D arrays of dimensions `time x (nxrec*nyrec)`:

```julia
using PyPlot
using PythonPlot
imshow(d_obs.data[1], vmin=-.4, vmax=.4, cmap="seismic", aspect="auto")
```

Expand Down Expand Up @@ -495,7 +495,7 @@ u = A_inv*Ps'*q
This return an abstract data vector called `judiWavefield`. Similar to `judiVectors`, we can access the data for each source number `i` via `u.data[i]`. The data is a 3D array of size `(nt, nx, nz)` for 2D and a 4D array of size `(nt, nx, ny, nz)` for 3D. We can plot the wavefield of the 600th time step with:

```julia
using PyPlot
using PythonPlot
imshow(u.data[1][600, :, :]', vmin=-5, vmax=5, cmap="seismic", aspect="auto")
```

Expand Down
4 changes: 2 additions & 2 deletions docs/src/inversion.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ run(`wget ftp://slim.gatech.edu/data/SoftwareRelease/WaveformInversion.jl/2DFWI/
The first step is to load the velocity model and the observed data into Julia, as well as setting up bound constraints for the inversion, which prevent too high or low velocities in the final result. Furthermore, we define an 8 Hertz Ricker wavelet as the source function:

```julia
using PyPlot, HDF5, SegyIO, JUDI, SlimOptim, Statistics, Random
using PythonPlot, HDF5, SegyIO, JUDI, SlimOptim, Statistics, Random

# Load starting model
n, d, o, m0 = read(h5open("overthrust_2D_initial_model.h5", "r"), "n", "d", "o", "m0")
Expand Down Expand Up @@ -118,7 +118,7 @@ run(`wget ftp://slim.gatech.edu/data/SoftwareRelease/Imaging.jl/2DLSRTM/marmousi
Once again, load the starting model and the data and set up the source wavelet. For this example, we use a Ricker wavelet with 30 Hertz peak frequency.

```julia
using PyPlot, HDF5, JUDI, SegyIO, Random
using PythonPlot, HDF5, JUDI, SegyIO, Random

# Load smooth migration velocity model
n,d,o,m0 = read(h5open("marmousi_migration_velocity.h5","r"), "n", "d", "o", "m0")
Expand Down
2 changes: 1 addition & 1 deletion examples/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ Pkg.add("JLD")
Pkg.add("JLD2")

# Plotting
Pkg.add("PyPlot")
Pkg.add("PythonPlot")
Pkg.add("SlimPlotting")

# Optimization
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
# Set up path where data will be saved
data_path = "/path/to/data/"

using JUDI, SegyIO, JLD, PyPlot
using JUDI, SegyIO, JLD, PythonPlot

# Load velocity
if !isfile("bp_synthetic_2004_true_velocity.jld")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
# Set up path where data will be saved
data_path = "/path/to/data/"

using JUDI, SegyIO, JLD, PyPlot, LinearAlgebra
using JUDI, SegyIO, JLD, PythonPlot, LinearAlgebra

# Load velocity model
if !isfile("bp_synthetic_2004_migration_velocity.jld")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
# Set up path where data will be saved
data_path = "/path/to/data/"

using JUDI, SegyIO, JLD, PyPlot, JOLI, Random, LinearAlgebra
using JUDI, SegyIO, JLD, PythonPlot, JOLI, Random, LinearAlgebra

# Load velocity model(replace with correct paths)
if !isfile("bp_synthetic_2004_migration_velocity.jld")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
# Date: January 2017
#

using JUDI, PyPlot, JLD, SegyIO, LinearAlgebra
using JUDI, PythonPlot, JLD, SegyIO, LinearAlgebra

# Load Sigsbee model
if !isfile("sigsbee2A_model.jld")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
# Date: January 2017
#

using JUDI, PyPlot, JLD, SegyIO, LinearAlgebra
using JUDI, PythonPlot, JLD, SegyIO, LinearAlgebra

# Load Marmousi (4 km x 2 km)
if !isfile("marmousi_small.jld")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
file_path="/path/to/data/"
file_name="sigsbee2A_marine"

using JUDI, PyPlot, JLD, SegyIO
using JUDI, PythonPlot, JLD, SegyIO

# Load Sigsbee model
if !isfile("sigsbee2A_model.jld")
Expand Down
2 changes: 1 addition & 1 deletion examples/compressive_splsrtm/Sigsbee2A/rtm_sigsbee.jl
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
path_to_data = "/path/to/directory/"
data_name = "sigsbee2A_marine" # common base name of all shots

using JUDI, PyPlot, JLD, SegyIO
using JUDI, PythonPlot, JLD, SegyIO

# Load Sigsbee model
M = load("sigsbee2A_model.jld")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
path_to_data="/home/pwitte3/.julia/dev/JUDI/examples/compressive_splsrtm/Sigsbee2A/"
data_name = "sigsbee2A_marine" # common base name of all shots

using JUDI, PyPlot, JLD, SegyIO, JOLI, Random, LinearAlgebra
using JUDI, PythonPlot, JLD, SegyIO, JOLI, Random, LinearAlgebra

# Load Sigsbee model
M = load("sigsbee2A_model.jld")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
path_to_data="/home/pwitte3/.julia/dev/JUDI/examples/compressive_splsrtm/Sigsbee2A/"
data_name = "sigsbee2A_marine" # common base name of all shots

using JUDI, PyPlot, JLD, SegyIO, JOLI, Random
using JUDI, PythonPlot, JLD, SegyIO, JOLI, Random

# Load Sigsbee model
M = load("sigsbee2A_model.jld")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,7 @@ for k in 1:nworkers()
@spawnat workers()[k] ENV["GOMP_CPU_AFFINITY"] = "$(place1)-$(place2)";
end

@everywhere using Distributed, JUDI.TimeModeling, SlimOptim, LinearAlgebra, PyPlot, SetIntersectionProjection, SegyIO
@everywhere using Distributed, JUDI.TimeModeling, SlimOptim, LinearAlgebra, PythonPlot, SetIntersectionProjection, SegyIO

function objective(m, d_obs, wb_mask)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
"import numpy as np\n",
"import pandas as pd\n",
"import matplotlib\n",
"import matplotlib.pyplot as plt\n",
"import matplotlib.PythonPlot as plt\n",
"import seaborn as sns\n",
"from rsf.proj import *\n",
"import rsf.api as sf"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@
"from scipy.signal import periodogram, welch\n",
"from wiggle.wiggle import wiggle\n",
"import matplotlib\n",
"import matplotlib.pyplot as plt\n",
"import matplotlib.PythonPlot as plt\n",
"from scipy.interpolate import griddata\n",
"from scipy.interpolate import Rbf"
]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@
"from scipy.signal import periodogram, welch\n",
"from wiggle.wiggle import wiggle\n",
"import matplotlib\n",
"import matplotlib.pyplot as plt\n",
"import matplotlib.PythonPlot as plt\n",
"from scipy.interpolate import griddata\n",
"from scipy.interpolate import Rbf"
]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@
"from scipy.signal import periodogram, welch\n",
"from wiggle.wiggle import wiggle\n",
"import matplotlib\n",
"import matplotlib.pyplot as plt\n",
"import matplotlib.PythonPlot as plt\n",
"from scipy.interpolate import griddata\n",
"from scipy.interpolate import Rbf"
]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@
"from scipy.signal import periodogram, welch\n",
"from wiggle.wiggle import wiggle\n",
"import matplotlib\n",
"import matplotlib.pyplot as plt\n",
"import matplotlib.PythonPlot as plt\n",
"from scipy.interpolate import griddata\n",
"from scipy.interpolate import Rbf"
]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@
"from scipy.signal import periodogram, welch\n",
"from wiggle.wiggle import wiggle\n",
"import matplotlib\n",
"import matplotlib.pyplot as plt\n",
"import matplotlib.PythonPlot as plt\n",
"from scipy.interpolate import griddata\n",
"from scipy.interpolate import Rbf"
]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@
"from scipy.signal import periodogram, welch\n",
"from wiggle.wiggle import wiggle\n",
"import matplotlib\n",
"import matplotlib.pyplot as plt\n",
"import matplotlib.PythonPlot as plt\n",
"from scipy.interpolate import griddata\n",
"from scipy.interpolate import Rbf"
]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
"using SegyIO\n",
"using Interpolations\n",
"using PyCall\n",
"using PyPlot\n",
"using PythonPlot\n",
"using HDF5\n",
"using DelimitedFiles\n",
"using ImageFiltering"
Expand Down
2 changes: 1 addition & 1 deletion examples/notebooks/01_intro.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
"metadata": {},
"outputs": [],
"source": [
"using JUDI, PyPlot, LinearAlgebra"
"using JUDI, PythonPlot, LinearAlgebra"
]
},
{
Expand Down
2 changes: 1 addition & 1 deletion examples/notebooks/02_fwi_example_NLopt.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
"metadata": {},
"outputs": [],
"source": [
"using SegyIO, HDF5, PyPlot, JUDI, NLopt, Random, LinearAlgebra, Printf"
"using SegyIO, HDF5, PythonPlot, JUDI, NLopt, Random, LinearAlgebra, Printf"
]
},
{
Expand Down
4 changes: 2 additions & 2 deletions examples/notebooks/03_constrained_fwi.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
"outputs": [],
"source": [
"# Add packages needed\n",
"# PyPlot is already installed in the environment\n",
"# PythonPlot is already installed in the environment\n",
"# using Pkg\n",
"# Pkg.add([\"Distributed\", \"SlimOptim\", \"JUDI\", \"SetIntersectionProjection\"])"
]
Expand All @@ -46,7 +46,7 @@
"metadata": {},
"outputs": [],
"source": [
"using Distributed, JUDI, SlimOptim, LinearAlgebra, PyPlot, SetIntersectionProjection, Printf"
"using Distributed, JUDI, SlimOptim, LinearAlgebra, PythonPlot, SetIntersectionProjection, Printf"
]
},
{
Expand Down
2 changes: 1 addition & 1 deletion examples/notebooks/04_judi_leading_edge_tutorial.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@
"metadata": {},
"outputs": [],
"source": [
"using PyPlot\n",
"using PythonPlot\n",
"\n",
"i = 8\n",
"figure(figsize=(15,6))\n",
Expand Down
2 changes: 1 addition & 1 deletion examples/notebooks/05_custom_misfit.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@
"metadata": {},
"outputs": [],
"source": [
"using SegyIO, HDF5, PyPlot, JUDI, Random, LinearAlgebra, Printf, SlimPlotting, SlimOptim, Statistics"
"using SegyIO, HDF5, PythonPlot, JUDI, Random, LinearAlgebra, Printf, SlimPlotting, SlimOptim, Statistics"
]
},
{
Expand Down
2 changes: 1 addition & 1 deletion examples/notebooks/06_automatic_differentiation.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -418,7 +418,7 @@
}
],
"source": [
"using PyPlot\n",
"using PythonPlot\n",
"plot(x, label=\"true\")\n",
"plot(summary.minimizer, label=\"Recovered\")\n",
"legend()"
Expand Down
2 changes: 1 addition & 1 deletion examples/scripts/extended_source_lsqr.jl
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
# Date: January 2017
#

using JUDI, SegyIO, LinearAlgebra, PyPlot, IterativeSolvers, JOLI
using JUDI, SegyIO, LinearAlgebra, PythonPlot, IterativeSolvers, JOLI

# Set up model structure
n = (120, 100) # (x,y,z) or (x,z)
Expand Down
2 changes: 1 addition & 1 deletion examples/scripts/fwi_example_2D.jl
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
#

using Statistics, Random, LinearAlgebra
using JUDI, HDF5, SegyIO, SlimOptim, SlimPlotting
using JUDI, HDF5, SegyIO, SlimOptim, PythonPlot, SlimPlotting

# Load starting model
n,d,o,m0 = read(h5open("$(JUDI.JUDI_DATA)/overthrust_model.h5","r"), "n", "d", "o", "m0")
Expand Down
2 changes: 1 addition & 1 deletion examples/scripts/fwi_example_ADloss.jl
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
# Date: September 2022
#

using Statistics, Random, LinearAlgebra, PyPlot, Distributed
using Statistics, Random, LinearAlgebra, PythonPlot, Distributed
using JUDI, SlimOptim, HDF5, SegyIO
@everywhere using JUDI.FFTW, Zygote

Expand Down
2 changes: 1 addition & 1 deletion examples/scripts/fwi_example_constraints.jl
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
# Date: January 2022

using Statistics, Random, LinearAlgebra
using JUDI, SlimOptim, HDF5, SegyIO, PyPlot
using JUDI, SlimOptim, HDF5, SegyIO, PythonPlot
using SetIntersectionProjection

# Load starting model
Expand Down
2 changes: 1 addition & 1 deletion examples/scripts/fwi_example_minConf.jl
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
# Date: December 2017
#

using Statistics, Random, LinearAlgebra, PyPlot
using Statistics, Random, LinearAlgebra, PythonPlot
using JUDI, SlimOptim, HDF5, SegyIO

# Load starting model
Expand Down
2 changes: 1 addition & 1 deletion examples/scripts/fwi_example_studentst.jl
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
# Date: September 2022
#

using Statistics, Random, LinearAlgebra, PyPlot, SlimPlotting
using Statistics, Random, LinearAlgebra, PythonPlot, SlimPlotting
using JUDI, SlimOptim, HDF5, SegyIO

# Load starting model
Expand Down
2 changes: 1 addition & 1 deletion examples/scripts/fwi_gauss_newton.jl
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
#

using Statistics, Random, LinearAlgebra
using JUDI, HDF5, SegyIO, PyPlot, IterativeSolvers
using JUDI, HDF5, SegyIO, PythonPlot, IterativeSolvers

# Load starting model
n,d,o,m0 = read(h5open("$(JUDI.JUDI_DATA)/overthrust_model.h5","r"), "n", "d", "o", "m0")
Expand Down
2 changes: 1 addition & 1 deletion examples/scripts/illum.jl
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
# Author: Mathias Louboutin, [email protected]
# February 2022

using JUDI, HDF5, SlimPlotting, PyPlot, LinearAlgebra, Downloads, SlimPlotting, Distributed
using JUDI, HDF5, SlimPlotting, PythonPlot, LinearAlgebra, Downloads, SlimPlotting, Distributed

# Load model
data_path = dirname(pathof(JUDI))*"/../data/"
Expand Down
Loading
Loading