diff --git a/dev/API/index.html b/dev/API/index.html index 318a4fb..a243f39 100644 --- a/dev/API/index.html +++ b/dev/API/index.html @@ -2,14 +2,14 @@ API reference · Slim Plotting toolbox

API reference

Core functions

SlimPlotting._plot_with_unitsFunction
_plot_with_units(image, spacing; perc=95, cmap=:cet_CET_L1, 
                  o=(0, 0), interp="hanning", aspect=nothing, d_scale=0,
                  positive=false, labels=(:X, :Depth), cbar=false,
-                 units=(:m, :m), name="RTM", new_fig=true, save=nothing)

Plot a 2D grided image with physical units defined by the grid spacing spacing.

Arguments

  • image::Array{T, 2}: image to be plotted
  • spacing::Tuple: grid spacing in physical units
  • perc::Int: (Optional) Clipping percentile, default=95
  • cmap::Symbol: (Optional) Color map, default=:lineargrey1095c0_n256
  • o::Tuple: (Optional) Origin of the image, default=(0, 0)
  • interp::String: (Optional) Interpolation method, default="hanning"
  • aspect::Symbol: (Optional) Aspect ratio, default=:auto
  • d_scale::Float: (Optional) Depth scaling, default=1.5. Applied scaling is (1:max_depth).^d_scale.
  • positive::Bool: (Optional) Plot positive only image (clip [0:max(image)]), default=false
  • labels::Tuple: (Optional) Labels for the axes, default=(:X, :Depth)
  • name::String: (Optional) Figure title, default="RTM"
  • units::Tuple(String): (Optional) Physical units of each axis, default=(:m, :m).
  • new_fig::Bool: (Optional) Create a new figure, default=true
  • save::String: (Optional) Save figure to file, default=nothing doesn't save the figure
  • cbar::Bool: (Optional) Show colorbar, default=false
source

Interface

SlimPlotting.plot_fsliceFunction
plot_fslice(image, spacing; perc=98, cmap=:diverging_bwr_20_95_c54_n256,
+                 units=(:m, :m), name="RTM", new_fig=true, save=nothing)

Plot a 2D grided image with physical units defined by the grid spacing spacing.

Arguments

  • image::Array{T, 2}: image to be plotted
  • spacing::Tuple: grid spacing in physical units
  • perc::Int: (Optional) Clipping percentile, default=95
  • cmap::Symbol: (Optional) Color map, default=:lineargrey1095c0_n256
  • o::Tuple: (Optional) Origin of the image, default=(0, 0)
  • interp::String: (Optional) Interpolation method, default="hanning"
  • aspect::Symbol: (Optional) Aspect ratio, default=:auto
  • d_scale::Float: (Optional) Depth scaling, default=1.5. Applied scaling is (1:max_depth).^d_scale.
  • positive::Bool: (Optional) Plot positive only image (clip [0:max(image)]), default=false
  • labels::Tuple: (Optional) Labels for the axes, default=(:X, :Depth)
  • name::String: (Optional) Figure title, default="RTM"
  • units::Tuple(String): (Optional) Physical units of each axis, default=(:m, :m).
  • new_fig::Bool: (Optional) Create a new figure, default=true
  • save::String: (Optional) Save figure to file, default=nothing doesn't save the figure
  • cbar::Bool: (Optional) Show colorbar, default=false
source

Interface

SlimPlotting.plot_fsliceFunction
plot_fslice(image, spacing; perc=98, cmap=:diverging_bwr_20_95_c54_n256,
             o=(0, 0), interp="hanning", aspect=nothing, d_scale=1.5,
-            name="Frequency slice", units="m", new_fig=true, save=nothing)

Plot a 2D frequency slice of seismic data. Calls _plot_with_units.

Arguments

  • image::Array{T, 2}: image to be plotted
  • spacing::Tuple: grid spacing in physical units
  • perc::Int: (Optional) Clipping percentile, default=95
  • cmap::Symbol: (Optional) Color map, default=:divergingbwr2095c54_n256
  • o::Tuple: (Optional) Origin of the image, default=(0, 0)
  • interp::String: (Optional) Interpolation method, default="hanning"
  • aspect::Symbol: (Optional) Aspect ratio, default=:auto
  • d_scale::Float: (Optional) Depth scaling, default=1.5. Applied scaling is (1:max_depth).^d_scale.
  • labels::Tuple: (Optional) Labels for the axes, default=(:X, :Depth)
  • name::String: (Optional) Figure title, default="RTM"
  • units::Tuple(String): (Optional) Physical units of each axis, default=(:m, :m).
  • new_fig::Bool: (Optional) Create a new figure, default=true
  • save::String: (Optional) Save figure to file, default=nothing doesn't save the figure
  • cbar::Bool: (Optional) Show colorbar, default=false
source
SlimPlotting.plot_velocityFunction
plot_velocity(image, spacing; perc=98, cmap=:cet_rainbow,
+            name="Frequency slice", units="m", new_fig=true, save=nothing)

Plot a 2D frequency slice of seismic data. Calls _plot_with_units.

Arguments

  • image::Array{T, 2}: image to be plotted
  • spacing::Tuple: grid spacing in physical units
  • perc::Int: (Optional) Clipping percentile, default=95
  • cmap::Symbol: (Optional) Color map, default=:divergingbwr2095c54_n256
  • o::Tuple: (Optional) Origin of the image, default=(0, 0)
  • interp::String: (Optional) Interpolation method, default="hanning"
  • aspect::Symbol: (Optional) Aspect ratio, default=:auto
  • d_scale::Float: (Optional) Depth scaling, default=1.5. Applied scaling is (1:max_depth).^d_scale.
  • labels::Tuple: (Optional) Labels for the axes, default=(:X, :Depth)
  • name::String: (Optional) Figure title, default="RTM"
  • units::Tuple(String): (Optional) Physical units of each axis, default=(:m, :m).
  • new_fig::Bool: (Optional) Create a new figure, default=true
  • save::String: (Optional) Save figure to file, default=nothing doesn't save the figure
  • cbar::Bool: (Optional) Show colorbar, default=false
source
SlimPlotting.plot_velocityFunction
plot_velocity(image, spacing; perc=98, cmap=:cet_rainbow,
             o=(0, 0), interp="hanning", aspect=nothing, d_scale=1.5,
-            name="Velocity", units="m", new_fig=true, save=nothing)

Plot a velocity model. Calls _plot_with_units.

Arguments

  • image::Array{T, 2}: image to be plotted
  • spacing::Tuple: grid spacing in physical units
  • perc::Int: (Optional) Clipping percentile, default=95
  • cmap::Symbol: (Optional) Color map, default=:cet_rainbow
  • o::Tuple: (Optional) Origin of the image, default=(0, 0)
  • interp::String: (Optional) Interpolation method, default="hanning"
  • aspect::Symbol: (Optional) Aspect ratio, default=:auto
  • d_scale::Float: (Optional) Depth scaling, default=1.5. Applied scaling is (1:max_depth).^d_scale.
  • labels::Tuple: (Optional) Labels for the axes, default=(:X, :Depth)
  • name::String: (Optional) Figure title, default="RTM"
  • units::Tuple(String): (Optional) Physical units of each axis, default=(:m, :m).
  • new_fig::Bool: (Optional) Create a new figure, default=true
  • save::String: (Optional) Save figure to file, default=nothing doesn't save the figure
  • cbar::Bool: (Optional) Show colorbar, default=false
source
SlimPlotting.plot_simageFunction
plot_simage(image, spacing; perc=98, cmap=:linear_grey_10_95_c0_n256,
+            name="Velocity", units="m", new_fig=true, save=nothing)

Plot a velocity model. Calls _plot_with_units.

Arguments

  • image::Array{T, 2}: image to be plotted
  • spacing::Tuple: grid spacing in physical units
  • perc::Int: (Optional) Clipping percentile, default=95
  • cmap::Symbol: (Optional) Color map, default=:cet_rainbow
  • o::Tuple: (Optional) Origin of the image, default=(0, 0)
  • interp::String: (Optional) Interpolation method, default="hanning"
  • aspect::Symbol: (Optional) Aspect ratio, default=:auto
  • d_scale::Float: (Optional) Depth scaling, default=1.5. Applied scaling is (1:max_depth).^d_scale.
  • labels::Tuple: (Optional) Labels for the axes, default=(:X, :Depth)
  • name::String: (Optional) Figure title, default="RTM"
  • units::Tuple(String): (Optional) Physical units of each axis, default=(:m, :m).
  • new_fig::Bool: (Optional) Create a new figure, default=true
  • save::String: (Optional) Save figure to file, default=nothing doesn't save the figure
  • cbar::Bool: (Optional) Show colorbar, default=false
source
SlimPlotting.plot_simageFunction
plot_simage(image, spacing; perc=98, cmap=:linear_grey_10_95_c0_n256,
             o=(0, 0), interp="hanning", aspect=nothing, d_scale=1.5,
             labels=(:X, :Depth), name="RTM", units=(:m, :m), new_fig=true,
-            save=nothing, cbar=false)

Plot a 2D seismic image with a grid spacing spacing. Calls _plot_with_units.

Arguments

  • image::Array{T, 2}: image to be plotted
  • spacing::Tuple: grid spacing in physical units
  • perc::Int: (Optional) Clipping percentile, default=95
  • cmap::Symbol: (Optional) Color map, default=:lineargrey1095c0_n256
  • o::Tuple: (Optional) Origin of the image, default=(0, 0)
  • interp::String: (Optional) Interpolation method, default="hanning"
  • aspect::Symbol: (Optional) Aspect ratio, default=:auto
  • d_scale::Float: (Optional) Depth scaling, default=1.5. Applied scaling is (1:max_depth).^d_scale.
  • labels::Tuple: (Optional) Labels for the axes, default=(:X, :Depth)
  • name::String: (Optional) Figure title, default="RTM"
  • units::Tuple(String): (Optional) Physical units of each axis, default=(:m, :m).
  • new_fig::Bool: (Optional) Create a new figure, default=true
  • save::String: (Optional) Save figure to file, default=nothing doesn't save the figure
  • cbar::Bool: (Optional) Show colorbar, default=false
source
SlimPlotting.plot_sdataFunction
plot_sdata(image, spacing; perc=98, cmap=:linear_grey_10_95_c0_n256,
+            save=nothing, cbar=false)

Plot a 2D seismic image with a grid spacing spacing. Calls _plot_with_units.

Arguments

  • image::Array{T, 2}: image to be plotted
  • spacing::Tuple: grid spacing in physical units
  • perc::Int: (Optional) Clipping percentile, default=95
  • cmap::Symbol: (Optional) Color map, default=:lineargrey1095c0_n256
  • o::Tuple: (Optional) Origin of the image, default=(0, 0)
  • interp::String: (Optional) Interpolation method, default="hanning"
  • aspect::Symbol: (Optional) Aspect ratio, default=:auto
  • d_scale::Float: (Optional) Depth scaling, default=1.5. Applied scaling is (1:max_depth).^d_scale.
  • labels::Tuple: (Optional) Labels for the axes, default=(:X, :Depth)
  • name::String: (Optional) Figure title, default="RTM"
  • units::Tuple(String): (Optional) Physical units of each axis, default=(:m, :m).
  • new_fig::Bool: (Optional) Create a new figure, default=true
  • save::String: (Optional) Save figure to file, default=nothing doesn't save the figure
  • cbar::Bool: (Optional) Show colorbar, default=false
source
SlimPlotting.plot_sdataFunction
plot_sdata(image, spacing; perc=98, cmap=:linear_grey_10_95_c0_n256,
             o=(0, 0), interp="hanning", aspect=nothing, d_scale=1.5,
-            name="Shot", units="m", new_fig=true, save=nothing)

Plot seismic data gather (i.e shot record). Calls _plot_with_units.

Arguments

  • image::Array{T, 2}: image to be plotted
  • spacing::Tuple: grid spacing in physical units
  • perc::Int: (Optional) Clipping percentile, default=95
  • cmap::Symbol: (Optional) Color map, default=:lineargrey1095c0_n256
  • o::Tuple: (Optional) Origin of the image, default=(0, 0)
  • interp::String: (Optional) Interpolation method, default="hanning"
  • aspect::Symbol: (Optional) Aspect ratio, default=:auto
  • d_scale::Float: (Optional) Depth scaling, default=1.5. Applied scaling is (1:max_depth).^d_scale.
  • labels::Tuple: (Optional) Labels for the axes, default=(:X, :Depth)
  • name::String: (Optional) Figure title, default="RTM"
  • units::Tuple(String): (Optional) Physical units of each axis, default=(:m, :m).
  • new_fig::Bool: (Optional) Create a new figure, default=true
  • save::String: (Optional) Save figure to file, default=nothing doesn't save the figure
  • cbar::Bool: (Optional) Show colorbar, default=false
source
SlimPlotting.wiggle_plotFunction
wiggle_plot(image, xrec, time_axis; t_scale=1.5,
-            new_fig=true)

wiggle_plot of a seismic traces.

Arguments

  • image::Array{T, 2}: Shot record to be plotted
  • xrec::Array{T, 1}: Receiver coordinates
  • time_axis::Array{T, 1}: Time axis
  • t_scale::Float: (Optional) Time scaling, default=1.5. Applied scaling is (1:max_time).^t_scale.
  • new_fig::Bool: (Optional) Create a new figure, default=true
source

Utilities

seiscm
+ name="Shot", units="m", new_fig=true, save=nothing)

Plot seismic data gather (i.e shot record). Calls _plot_with_units.

Arguments

source
SlimPlotting.wiggle_plotFunction
wiggle_plot(image, xrec, time_axis; t_scale=1.5,
+            new_fig=true)

wiggle_plot of a seismic traces.

Arguments

  • image::Array{T, 2}: Shot record to be plotted
  • xrec::Array{T, 1}: Receiver coordinates
  • time_axis::Array{T, 1}: Time axis
  • t_scale::Float: (Optional) Time scaling, default=1.5. Applied scaling is (1:max_time).^t_scale.
  • new_fig::Bool: (Optional) Create a new figure, default=true
source

Utilities

seiscm
diff --git a/dev/README/index.html b/dev/README/index.html index 5de5106..6a19877 100644 --- a/dev/README/index.html +++ b/dev/README/index.html @@ -1,2 +1,2 @@ -About · Slim Plotting toolbox

SlimPlotting

Utility function to plot physically gridded (seismic) data in the time and frequency domain and model parameters and perturbations. The functions currently only supports 2D data.

Disclaimer

This is a small package that I started to make my life easier visualizing data and results easily. Not all functionalities are tested and some of the features may need additional options for better images. This package is under development and welcomes contributions through Issues, Pull Requests or Discussions

Functionalities

This package implement four main functions that rely on a base _plot_with_units internal function.

  • plot_simage to plot a 2D seismic image (i.e RTM)
  • plot_sdata to plot 2D seismic data such as a shot record
  • plot_fslice to plot a 2D frequency slice of seismic data.
  • plot_velocity to plot a 2D velocity model.
  • wiggle_plot to make a 2D wiggle plot of a seismic data.

The functions plot_simage, plot_sdata and plot_velocity support abstract object with meta-data containing the grid spacing. For example, you can plot a 2D JUDI PhysicalParameter either via plot_velocity(p.data, p.d) or directly via plot_velocity(p) that will extract the data and spacing automatically. While this supports JUDI since we are using it extensively, this package does not depend on it and only expect a Julia structure as an input (when the spacing is not specified) containing a .d attribute with the grid spacing. We show in the simple example how to setup such a simple structure.

The expected inputs are:

  • plot_simage(array, tuple; kw...) or plot_simage(structure) with strucutre.d

containing the grid spacing and structure.data containing the 2D array.

  • plot_velocity(array, tuple; kw...) or plot_velocity(structure) with strucutre.d

containing the grid spacing and structure.data containing the 2D array.

  • plot_sdata(array, tuple; kw...) or plot_sdata(structure) with strucutre.dt

containing the time sampling rate and structure.d containing the receiver spacing (uniform sampling is assumed at the time) and structure.data containing the 2D array.

  • wiggle_plot(array, xrec, time_axis; kw...). In this case, xrec, time_axis are optional and wil default to 1:size(array, 2), 1:size(array, 1) respectively.

and you can check the docstring (julia ?) for additional information on the optional keyword arguments.

Color maps

The colormap support is extensive as this uses three sources:

  • matplotlib standard colormaps.
  • ColorShemes.jl that implements a variery of colormaps from different packages including Matplotlib, Seaborn, GNUPlot, colorcet(Collection of perceptually accurate colormaps). You can provide the chosen colormap as a kewyword , i.e plot_simage(array, tuple; cmap=:jet).
  • colorcet perceptually accurate colormaps that are available through their colorcet names (i.e cet_rainbow4 for a perceptually accurate jet colormap).
  • seismc a set of seismic colormap usable via seiscm(name) where name is one of the four supported maps seismic, bwr, frequency, phase

All functionality, with the exeption of wiggle_plot accept the keyword argument cmap, i.e plot_velocity(array, spacing; cmap=:vik).

Authors

This package is developed and maintained by Mathias Louboutin<mlouboutin3@gatech.edu> and the ML4Seismic Lab at Georgia Institute of Technology.

+About · Slim Plotting toolbox

SlimPlotting

Utility function to plot physically gridded (seismic) data in the time and frequency domain and model parameters and perturbations. The functions currently only supports 2D data.

Disclaimer

This is a small package that I started to make my life easier visualizing data and results easily. Not all functionalities are tested and some of the features may need additional options for better images. This package is under development and welcomes contributions through Issues, Pull Requests or Discussions

Functionalities

This package implement four main functions that rely on a base _plot_with_units internal function.

  • plot_simage to plot a 2D seismic image (i.e RTM)
  • plot_sdata to plot 2D seismic data such as a shot record
  • plot_fslice to plot a 2D frequency slice of seismic data.
  • plot_velocity to plot a 2D velocity model.
  • wiggle_plot to make a 2D wiggle plot of a seismic data.

The functions plot_simage, plot_sdata and plot_velocity support abstract object with meta-data containing the grid spacing. For example, you can plot a 2D JUDI PhysicalParameter either via plot_velocity(p.data, p.d) or directly via plot_velocity(p) that will extract the data and spacing automatically. While this supports JUDI since we are using it extensively, this package does not depend on it and only expect a Julia structure as an input (when the spacing is not specified) containing a .d attribute with the grid spacing. We show in the simple example how to setup such a simple structure.

The expected inputs are:

  • plot_simage(array, tuple; kw...) or plot_simage(structure) with strucutre.d

containing the grid spacing and structure.data containing the 2D array.

  • plot_velocity(array, tuple; kw...) or plot_velocity(structure) with strucutre.d

containing the grid spacing and structure.data containing the 2D array.

  • plot_sdata(array, tuple; kw...) or plot_sdata(structure) with strucutre.dt

containing the time sampling rate and structure.d containing the receiver spacing (uniform sampling is assumed at the time) and structure.data containing the 2D array.

  • wiggle_plot(array, xrec, time_axis; kw...). In this case, xrec, time_axis are optional and wil default to 1:size(array, 2), 1:size(array, 1) respectively.

and you can check the docstring (julia ?) for additional information on the optional keyword arguments.

Color maps

The colormap support is extensive as this uses three sources:

  • matplotlib standard colormaps.
  • ColorShemes.jl that implements a variery of colormaps from different packages including Matplotlib, Seaborn, GNUPlot, colorcet(Collection of perceptually accurate colormaps). You can provide the chosen colormap as a kewyword , i.e plot_simage(array, tuple; cmap=:jet).
  • colorcet perceptually accurate colormaps that are available through their colorcet names (i.e cet_rainbow4 for a perceptually accurate jet colormap).
  • seismc a set of seismic colormap usable via seiscm(name) where name is one of the four supported maps seismic, bwr, frequency, phase

All functionality, with the exeption of wiggle_plot accept the keyword argument cmap, i.e plot_velocity(array, spacing; cmap=:vik).

Authors

This package is developed and maintained by Mathias Louboutin<mlouboutin3@gatech.edu> and the ML4Seismic Lab at Georgia Institute of Technology.

diff --git a/dev/examples/index.html b/dev/examples/index.html index f7e1e46..dcf7cd3 100644 --- a/dev/examples/index.html +++ b/dev/examples/index.html @@ -1,5 +1,5 @@ -Examples · Slim Plotting toolbox

Plotting data and models with SlimPlotting


title: Overview of SlimPlotting utilities author: Mathias Louboutin date: April 2023 –-

This example script is written using Weave.jl and can be converted to different format for documentation and usage This example is converted to a markdown file for the documentation.

Import SlimPlotting, SegyIO to read seismic data, JLD2 for hdf5-like files

using SlimPlotting, SegyIO, JLD2

Initialize all needed data

Close all figures if any existing

SlimPlotting.PyPlot.close(:all)

Path to the files and data used for these examples

data_path = dirname(pathof(SlimPlotting)) * "/../data/";

Read the data

# Pure array
+Examples · Slim Plotting toolbox

Plotting data and models with SlimPlotting


title: Overview of SlimPlotting utilities author: Mathias Louboutin date: April 2023 –-

This example script is written using Weave.jl and can be converted to different format for documentation and usage This example is converted to a markdown file for the documentation.

Import SlimPlotting, SegyIO to read seismic data, JLD2 for hdf5-like files

using SlimPlotting, SegyIO, JLD2

Initialize all needed data

Close all figures if any existing

plotclose("all")
Python: None

Path to the files and data used for these examples

data_path = dirname(pathof(SlimPlotting)) * "/../data/";

Read the data

# Pure array
 vp = Float32.(segy_read("$(data_path)2dVP.sgy").data);
 dm = diff(vp, dims = 1);
 shot = Float32.(segy_read("$(data_path)2dshot.segy").data);
@@ -90,4 +90,4 @@
 # figure(figsize=(5, 5))
 # subplot(111)
 # wiggle_plot(shot[1:5:end, 1:10:end], xloc[1:10:end], 0:0.02:4.6; new_fig=false)
-# tight_layout();display(gcf())
+# tight_layout();display(gcf())
diff --git a/dev/figures/plot_example_10_1.png b/dev/figures/plot_example_10_1.png index 55c5635..1334e23 100644 Binary files a/dev/figures/plot_example_10_1.png and b/dev/figures/plot_example_10_1.png differ diff --git a/dev/figures/plot_example_11_1.png b/dev/figures/plot_example_11_1.png index 0662eaa..6feba0f 100644 Binary files a/dev/figures/plot_example_11_1.png and b/dev/figures/plot_example_11_1.png differ diff --git a/dev/figures/plot_example_6_1.png b/dev/figures/plot_example_6_1.png index 01f66f0..ad0a722 100644 Binary files a/dev/figures/plot_example_6_1.png and b/dev/figures/plot_example_6_1.png differ diff --git a/dev/figures/plot_example_7_1.png b/dev/figures/plot_example_7_1.png index 04d491f..99f0626 100644 Binary files a/dev/figures/plot_example_7_1.png and b/dev/figures/plot_example_7_1.png differ diff --git a/dev/figures/plot_example_8_1.png b/dev/figures/plot_example_8_1.png index cd56628..a47dc64 100644 Binary files a/dev/figures/plot_example_8_1.png and b/dev/figures/plot_example_8_1.png differ diff --git a/dev/figures/plot_example_9_1.png b/dev/figures/plot_example_9_1.png index a4d9fe2..efd588b 100644 Binary files a/dev/figures/plot_example_9_1.png and b/dev/figures/plot_example_9_1.png differ diff --git a/dev/index.html b/dev/index.html index dd245f3..152aba9 100644 --- a/dev/index.html +++ b/dev/index.html @@ -1,2 +1,2 @@ -Home · Slim Plotting toolbox

SLimPlotting.jl documentation

Welcome to the documentation and API reference for SLimPlotting.jl.

+Home · Slim Plotting toolbox

SLimPlotting.jl documentation

Welcome to the documentation and API reference for SLimPlotting.jl.

diff --git a/dev/search/index.html b/dev/search/index.html index 8fcff34..e060cb5 100644 --- a/dev/search/index.html +++ b/dev/search/index.html @@ -1,2 +1,2 @@ -Search · Slim Plotting toolbox

Loading search...

    +Search · Slim Plotting toolbox

    Loading search...

      diff --git a/dev/search_index.js b/dev/search_index.js index e19e45f..fd3bea4 100644 --- a/dev/search_index.js +++ b/dev/search_index.js @@ -1,3 +1,3 @@ var documenterSearchIndex = {"docs": -[{"location":"examples/#Plotting-data-and-models-with-SlimPlotting","page":"Examples","title":"Plotting data and models with SlimPlotting","text":"","category":"section"},{"location":"examples/","page":"Examples","title":"Examples","text":"","category":"page"},{"location":"examples/","page":"Examples","title":"Examples","text":"title: Overview of SlimPlotting utilities author: Mathias Louboutin date: April 2023 –-","category":"page"},{"location":"examples/","page":"Examples","title":"Examples","text":"This example script is written using Weave.jl and can be converted to different format for documentation and usage This example is converted to a markdown file for the documentation.","category":"page"},{"location":"examples/#Import-SlimPlotting,-SegyIO-to-read-seismic-data,-JLD2-for-hdf5-like-files","page":"Examples","title":"Import SlimPlotting, SegyIO to read seismic data, JLD2 for hdf5-like files","text":"","category":"section"},{"location":"examples/","page":"Examples","title":"Examples","text":"using SlimPlotting, SegyIO, JLD2","category":"page"},{"location":"examples/#Initialize-all-needed-data","page":"Examples","title":"Initialize all needed data","text":"","category":"section"},{"location":"examples/","page":"Examples","title":"Examples","text":"Close all figures if any existing","category":"page"},{"location":"examples/","page":"Examples","title":"Examples","text":"SlimPlotting.PyPlot.close(:all)","category":"page"},{"location":"examples/","page":"Examples","title":"Examples","text":"Path to the files and data used for these examples","category":"page"},{"location":"examples/","page":"Examples","title":"Examples","text":"data_path = dirname(pathof(SlimPlotting)) * \"/../data/\";","category":"page"},{"location":"examples/","page":"Examples","title":"Examples","text":"Read the data","category":"page"},{"location":"examples/","page":"Examples","title":"Examples","text":"# Pure array\nvp = Float32.(segy_read(\"$(data_path)2dVP.sgy\").data);\ndm = diff(vp, dims = 1);\nshot = Float32.(segy_read(\"$(data_path)2dshot.segy\").data);\nxloc = get_header(segy_read(\"$(data_path)2dshot.segy\"), \"GroupX\")\nfslice = JLD2.load(\"$(data_path)2dfslice.jld\");","category":"page"},{"location":"examples/#Create-structures-to-mimic-JUDI-like-inputs","page":"Examples","title":"Create structures to mimic JUDI-like inputs","text":"","category":"section"},{"location":"examples/","page":"Examples","title":"Examples","text":"In the future this should be instead converted into an extension rather than implicit knowledge of the structure","category":"page"},{"location":"examples/","page":"Examples","title":"Examples","text":"# Dummy structures to check plot with metadata\nstruct geometry\n xloc::Any\nend\n\nstruct shotrec\n data::Any\n dt::Any\n geometry::Any\nend\n\nstruct Phys\n data::Any\n d::Any\nend\n\n## Make physical objects\ndmp = Phys(dm, (10, 20))\nvpp = Phys(vp, (10, 20))\nfslicep = Phys(fslice[\"Freq\"][1, :, :], (12.5, 12.5))\nshotp = shotrec([shot], 0.008, geometry([xloc]));","category":"page"},{"location":"examples/#Model-perturbation","page":"Examples","title":"Model perturbation","text":"","category":"section"},{"location":"examples/","page":"Examples","title":"Examples","text":"We plot here a model perturbation (i.e a Reverse-time Migrated image) and compare a few colormaps:","category":"page"},{"location":"examples/","page":"Examples","title":"Examples","text":"The seiscm.seimic colormap\nThe standard matplotlib Greys colormap\nThe perceptually accurate Greys colormap from colorcet","category":"page"},{"location":"examples/","page":"Examples","title":"Examples","text":"figure(figsize = (10, 10))\nsubplot(311)\nplot_simage(dmp; new_fig = false, name = \"Seismic\")\nsubplot(312)\nplot_simage(dm, (10, 20); cmap = \"Greys\", new_fig = false, name = \"Greys\")\nsubplot(313)\nplot_simage(dm, (10, 20); cmap = :cet_CET_L1, new_fig = false, name = \"Colorcet Greys\")\ntight_layout();\ndisplay(gcf());","category":"page"},{"location":"examples/","page":"Examples","title":"Examples","text":"(Image: )","category":"page"},{"location":"examples/#Velocity","page":"Examples","title":"Velocity","text":"","category":"section"},{"location":"examples/","page":"Examples","title":"Examples","text":"We plot here a velocity model and compare a few colormaps:","category":"page"},{"location":"examples/","page":"Examples","title":"Examples","text":"The seiscm.frequency colormap\nThe ColorSchemes vik colormap\nThe perceptually accurate jet colormap from colorcet named cet_rainbow4","category":"page"},{"location":"examples/","page":"Examples","title":"Examples","text":"figure(figsize = (10, 10))\nsubplot(311)\nplot_velocity(vpp; new_fig = false, name = \"colorcet jet\", cmap = \"cet_rainbow4\")\nsubplot(312)\nplot_velocity(vp, (10, 20); cmap = :vik, new_fig = false, name = \"ColorSchemes's vik\")\nsubplot(313)\nplot_velocity(vp, (10, 20); cmap = seiscm(:frequency), new_fig = false, name = \"Seiscm\")\ntight_layout();\ndisplay(gcf());","category":"page"},{"location":"examples/","page":"Examples","title":"Examples","text":"(Image: )","category":"page"},{"location":"examples/#Frequency-slice","page":"Examples","title":"Frequency slice","text":"","category":"section"},{"location":"examples/","page":"Examples","title":"Examples","text":"We plot here a frequency slice for a seismic dataset and compare a few colormaps:","category":"page"},{"location":"examples/","page":"Examples","title":"Examples","text":"The seiscm.bwr colormap\nThe standard matplotlib bwr colormap\nThe perceptually accurate bwr colormap from colorcet named cet_CET_D1A","category":"page"},{"location":"examples/","page":"Examples","title":"Examples","text":"# Frequency slice\nfigure(figsize = (10, 5))\nsubplot(131)\nplot_fslice(fslice[\"Freq\"][1, :, :], (12.5, 12.5); new_fig = false, name = \"colorcet bwr\")\nsubplot(132)\nplot_fslice(fslicep; cmap = :bwr, new_fig = false, name = \"bwr\")\nsubplot(133)\nplot_fslice(fslicep; cmap = seiscm(:bwr), new_fig = false, name = \"Seiscm bwr\")\ntight_layout();\ndisplay(gcf());","category":"page"},{"location":"examples/","page":"Examples","title":"Examples","text":"(Image: )","category":"page"},{"location":"examples/#Shot-record","page":"Examples","title":"Shot record","text":"","category":"section"},{"location":"examples/#Seismic-blue-white-red","page":"Examples","title":"Seismic blue-white-red","text":"","category":"section"},{"location":"examples/","page":"Examples","title":"Examples","text":"We plot here a frequency slice for a seismic dataset and compare a few colormaps for the bwr colormap:","category":"page"},{"location":"examples/","page":"Examples","title":"Examples","text":"The seiscm.bwr colormap\nThe standard matplotlib bwr colormap\nThe perceptually accurate bwr colormap from colorcet named cet_CET_D1A","category":"page"},{"location":"examples/","page":"Examples","title":"Examples","text":"# Shot record\nfigure(figsize = (10, 5))\nsubplot(131)\nplot_sdata(shotp; new_fig = false, name = \"matplotlib seismic\", cmap = \"bwr\")\nsubplot(132)\nplot_sdata(shot, (12.5, 0.008); cmap = :cet_CET_D1A, new_fig = false, name = \"Colorcet bwr\")\nsubplot(133)\nplot_sdata(shot, (12.5, 0.008); cmap = seiscm(:bwr), new_fig = false, name = \"Seismic bwr\")\ntight_layout();\ndisplay(gcf());","category":"page"},{"location":"examples/","page":"Examples","title":"Examples","text":"(Image: )","category":"page"},{"location":"examples/#Seismic-greys","page":"Examples","title":"Seismic greys","text":"","category":"section"},{"location":"examples/","page":"Examples","title":"Examples","text":"We plot here a frequency slice for a seismic dataset and compare a few colormaps for the greys colormap:","category":"page"},{"location":"examples/","page":"Examples","title":"Examples","text":"The standard matplotlib gray colormap\nThe perceptually accurate greys colormap from colorcet named cet_CET_L1","category":"page"},{"location":"examples/","page":"Examples","title":"Examples","text":"# Shot record\nfigure(figsize = (10, 5))\nsubplot(121)\nplot_sdata(shotp; new_fig = false, name = \"colorcet gray\", cmap = \"cet_CET_L1\")\nsubplot(122)\nplot_sdata(shot, (12.5, 0.008); cmap = \"gray\", new_fig = false, name = \"Greys\")\ntight_layout();\ndisplay(gcf());","category":"page"},{"location":"examples/","page":"Examples","title":"Examples","text":"(Image: )","category":"page"},{"location":"examples/#Compare-shot-records","page":"Examples","title":"Compare shot records","text":"","category":"section"},{"location":"examples/","page":"Examples","title":"Examples","text":"One of the main visual representation of FWI inversion is to compare the true shot record with the synthetic data from the current velocity model. A good way to visualize this difference is to overlay the two shot records alternating the traces between each shots with a different colormap to check the alignment of the events. We show below how to do this with the compare_shots function","category":"page"},{"location":"examples/","page":"Examples","title":"Examples","text":"figure(figsize = (10, 5))\nsubplot(131)\ncompare_shots(shotp, shotp; new_fig = false, name = \"Overlap compare\")\nsubplot(132)\ncompare_shots(\n shotp,\n shotp;\n new_fig = false,\n cmap = (\"bwr\", \"RdBu\"),\n name = \"Overlap compare custom cmap\",\n)\nsubplot(133)\ncompare_shots(\n shotp,\n shotp;\n side_by_side = true,\n new_fig = false,\n name = \"Side by side compare\",\n)\ntight_layout();\ndisplay(gcf());","category":"page"},{"location":"examples/","page":"Examples","title":"Examples","text":"(Image: )","category":"page"},{"location":"examples/#Wiggle-traces","page":"Examples","title":"Wiggle traces","text":"","category":"section"},{"location":"examples/","page":"Examples","title":"Examples","text":"We finally show the traditional wiggle plot for a shot record used in seismic.","category":"page"},{"location":"examples/","page":"Examples","title":"Examples","text":"# Wiggle plot\n\n# figure(figsize=(5, 5))\n# subplot(111)\n# wiggle_plot(shot[1:5:end, 1:10:end], xloc[1:10:end], 0:0.02:4.6; new_fig=false)\n# tight_layout();display(gcf())","category":"page"},{"location":"README/","page":"About","title":"About","text":"(Image: ) (Image: )","category":"page"},{"location":"README/#SlimPlotting","page":"About","title":"SlimPlotting","text":"","category":"section"},{"location":"README/","page":"About","title":"About","text":"Utility function to plot physically gridded (seismic) data in the time and frequency domain and model parameters and perturbations. The functions currently only supports 2D data.","category":"page"},{"location":"README/#Disclaimer","page":"About","title":"Disclaimer","text":"","category":"section"},{"location":"README/","page":"About","title":"About","text":"This is a small package that I started to make my life easier visualizing data and results easily. Not all functionalities are tested and some of the features may need additional options for better images. This package is under development and welcomes contributions through Issues, Pull Requests or Discussions","category":"page"},{"location":"README/#Functionalities","page":"About","title":"Functionalities","text":"","category":"section"},{"location":"README/","page":"About","title":"About","text":"This package implement four main functions that rely on a base _plot_with_units internal function.","category":"page"},{"location":"README/","page":"About","title":"About","text":"plot_simage to plot a 2D seismic image (i.e RTM)\nplot_sdata to plot 2D seismic data such as a shot record\nplot_fslice to plot a 2D frequency slice of seismic data.\nplot_velocity to plot a 2D velocity model.\nwiggle_plot to make a 2D wiggle plot of a seismic data.","category":"page"},{"location":"README/","page":"About","title":"About","text":"The functions plot_simage, plot_sdata and plot_velocity support abstract object with meta-data containing the grid spacing. For example, you can plot a 2D JUDI PhysicalParameter either via plot_velocity(p.data, p.d) or directly via plot_velocity(p) that will extract the data and spacing automatically. While this supports JUDI since we are using it extensively, this package does not depend on it and only expect a Julia structure as an input (when the spacing is not specified) containing a .d attribute with the grid spacing. We show in the simple example how to setup such a simple structure.","category":"page"},{"location":"README/","page":"About","title":"About","text":"The expected inputs are:","category":"page"},{"location":"README/","page":"About","title":"About","text":"plot_simage(array, tuple; kw...) or plot_simage(structure) with strucutre.d","category":"page"},{"location":"README/","page":"About","title":"About","text":"containing the grid spacing and structure.data containing the 2D array.","category":"page"},{"location":"README/","page":"About","title":"About","text":"plot_velocity(array, tuple; kw...) or plot_velocity(structure) with strucutre.d","category":"page"},{"location":"README/","page":"About","title":"About","text":"containing the grid spacing and structure.data containing the 2D array.","category":"page"},{"location":"README/","page":"About","title":"About","text":"plot_sdata(array, tuple; kw...) or plot_sdata(structure) with strucutre.dt","category":"page"},{"location":"README/","page":"About","title":"About","text":"containing the time sampling rate and structure.d containing the receiver spacing (uniform sampling is assumed at the time) and structure.data containing the 2D array.","category":"page"},{"location":"README/","page":"About","title":"About","text":"wiggle_plot(array, xrec, time_axis; kw...). In this case, xrec, time_axis are optional and wil default to 1:size(array, 2), 1:size(array, 1) respectively.","category":"page"},{"location":"README/","page":"About","title":"About","text":"and you can check the docstring (julia ?) for additional information on the optional keyword arguments.","category":"page"},{"location":"README/#Color-maps","page":"About","title":"Color maps","text":"","category":"section"},{"location":"README/","page":"About","title":"About","text":"The colormap support is extensive as this uses three sources:","category":"page"},{"location":"README/","page":"About","title":"About","text":"matplotlib standard colormaps.\nColorShemes.jl that implements a variery of colormaps from different packages including Matplotlib, Seaborn, GNUPlot, colorcet(Collection of perceptually accurate colormaps). You can provide the chosen colormap as a kewyword , i.e plot_simage(array, tuple; cmap=:jet).\ncolorcet perceptually accurate colormaps that are available through their colorcet names (i.e cet_rainbow4 for a perceptually accurate jet colormap).\nseismc a set of seismic colormap usable via seiscm(name) where name is one of the four supported maps seismic, bwr, frequency, phase","category":"page"},{"location":"README/","page":"About","title":"About","text":"All functionality, with the exeption of wiggle_plot accept the keyword argument cmap, i.e plot_velocity(array, spacing; cmap=:vik).","category":"page"},{"location":"README/#Authors","page":"About","title":"Authors","text":"","category":"section"},{"location":"README/","page":"About","title":"About","text":"This package is developed and maintained by Mathias Louboutin and the ML4Seismic Lab at Georgia Institute of Technology.","category":"page"},{"location":"#SLimPlotting.jl-documentation","page":"Home","title":"SLimPlotting.jl documentation","text":"","category":"section"},{"location":"","page":"Home","title":"Home","text":"Welcome to the documentation and API reference for SLimPlotting.jl.","category":"page"},{"location":"","page":"Home","title":"Home","text":"","category":"page"},{"location":"API/#API-reference","page":"API reference","title":"API reference","text":"","category":"section"},{"location":"API/","page":"API reference","title":"API reference","text":"CurrentModule = SlimPlotting","category":"page"},{"location":"API/#Core-functions","page":"API reference","title":"Core functions","text":"","category":"section"},{"location":"API/","page":"API reference","title":"API reference","text":"_plot_with_units","category":"page"},{"location":"API/#SlimPlotting._plot_with_units","page":"API reference","title":"SlimPlotting._plot_with_units","text":"_plot_with_units(image, spacing; perc=95, cmap=:cet_CET_L1, \n o=(0, 0), interp=\"hanning\", aspect=nothing, d_scale=0,\n positive=false, labels=(:X, :Depth), cbar=false,\n units=(:m, :m), name=\"RTM\", new_fig=true, save=nothing)\n\nPlot a 2D grided image with physical units defined by the grid spacing spacing.\n\nArguments\n\nimage::Array{T, 2}: image to be plotted\nspacing::Tuple: grid spacing in physical units\nperc::Int: (Optional) Clipping percentile, default=95\ncmap::Symbol: (Optional) Color map, default=:lineargrey1095c0_n256\no::Tuple: (Optional) Origin of the image, default=(0, 0)\ninterp::String: (Optional) Interpolation method, default=\"hanning\"\naspect::Symbol: (Optional) Aspect ratio, default=:auto\nd_scale::Float: (Optional) Depth scaling, default=1.5. Applied scaling is (1:max_depth).^d_scale.\npositive::Bool: (Optional) Plot positive only image (clip [0:max(image)]), default=false\nlabels::Tuple: (Optional) Labels for the axes, default=(:X, :Depth)\nname::String: (Optional) Figure title, default=\"RTM\"\nunits::Tuple(String): (Optional) Physical units of each axis, default=(:m, :m).\nnew_fig::Bool: (Optional) Create a new figure, default=true\nsave::String: (Optional) Save figure to file, default=nothing doesn't save the figure\ncbar::Bool: (Optional) Show colorbar, default=false\n\n\n\n\n\n","category":"function"},{"location":"API/#Interface","page":"API reference","title":"Interface","text":"","category":"section"},{"location":"API/","page":"API reference","title":"API reference","text":"plot_fslice\nplot_velocity\nplot_simage\nplot_sdata\nwiggle_plot","category":"page"},{"location":"API/#SlimPlotting.plot_fslice","page":"API reference","title":"SlimPlotting.plot_fslice","text":"plot_fslice(image, spacing; perc=98, cmap=:diverging_bwr_20_95_c54_n256,\n o=(0, 0), interp=\"hanning\", aspect=nothing, d_scale=1.5,\n name=\"Frequency slice\", units=\"m\", new_fig=true, save=nothing)\n\nPlot a 2D frequency slice of seismic data. Calls _plot_with_units.\n\nArguments\n\nimage::Array{T, 2}: image to be plotted\nspacing::Tuple: grid spacing in physical units\nperc::Int: (Optional) Clipping percentile, default=95\ncmap::Symbol: (Optional) Color map, default=:divergingbwr2095c54_n256\no::Tuple: (Optional) Origin of the image, default=(0, 0)\ninterp::String: (Optional) Interpolation method, default=\"hanning\"\naspect::Symbol: (Optional) Aspect ratio, default=:auto\nd_scale::Float: (Optional) Depth scaling, default=1.5. Applied scaling is (1:max_depth).^d_scale.\nlabels::Tuple: (Optional) Labels for the axes, default=(:X, :Depth)\nname::String: (Optional) Figure title, default=\"RTM\"\nunits::Tuple(String): (Optional) Physical units of each axis, default=(:m, :m).\nnew_fig::Bool: (Optional) Create a new figure, default=true\nsave::String: (Optional) Save figure to file, default=nothing doesn't save the figure\ncbar::Bool: (Optional) Show colorbar, default=false\n\n\n\n\n\n","category":"function"},{"location":"API/#SlimPlotting.plot_velocity","page":"API reference","title":"SlimPlotting.plot_velocity","text":"plot_velocity(image, spacing; perc=98, cmap=:cet_rainbow,\n o=(0, 0), interp=\"hanning\", aspect=nothing, d_scale=1.5,\n name=\"Velocity\", units=\"m\", new_fig=true, save=nothing)\n\nPlot a velocity model. Calls _plot_with_units.\n\nArguments\n\nimage::Array{T, 2}: image to be plotted\nspacing::Tuple: grid spacing in physical units\nperc::Int: (Optional) Clipping percentile, default=95\ncmap::Symbol: (Optional) Color map, default=:cet_rainbow\no::Tuple: (Optional) Origin of the image, default=(0, 0)\ninterp::String: (Optional) Interpolation method, default=\"hanning\"\naspect::Symbol: (Optional) Aspect ratio, default=:auto\nd_scale::Float: (Optional) Depth scaling, default=1.5. Applied scaling is (1:max_depth).^d_scale.\nlabels::Tuple: (Optional) Labels for the axes, default=(:X, :Depth)\nname::String: (Optional) Figure title, default=\"RTM\"\nunits::Tuple(String): (Optional) Physical units of each axis, default=(:m, :m).\nnew_fig::Bool: (Optional) Create a new figure, default=true\nsave::String: (Optional) Save figure to file, default=nothing doesn't save the figure\ncbar::Bool: (Optional) Show colorbar, default=false\n\n\n\n\n\n","category":"function"},{"location":"API/#SlimPlotting.plot_simage","page":"API reference","title":"SlimPlotting.plot_simage","text":"plot_simage(image, spacing; perc=98, cmap=:linear_grey_10_95_c0_n256,\n o=(0, 0), interp=\"hanning\", aspect=nothing, d_scale=1.5,\n labels=(:X, :Depth), name=\"RTM\", units=(:m, :m), new_fig=true,\n save=nothing, cbar=false)\n\nPlot a 2D seismic image with a grid spacing spacing. Calls _plot_with_units.\n\nArguments\n\nimage::Array{T, 2}: image to be plotted\nspacing::Tuple: grid spacing in physical units\nperc::Int: (Optional) Clipping percentile, default=95\ncmap::Symbol: (Optional) Color map, default=:lineargrey1095c0_n256\no::Tuple: (Optional) Origin of the image, default=(0, 0)\ninterp::String: (Optional) Interpolation method, default=\"hanning\"\naspect::Symbol: (Optional) Aspect ratio, default=:auto\nd_scale::Float: (Optional) Depth scaling, default=1.5. Applied scaling is (1:max_depth).^d_scale.\nlabels::Tuple: (Optional) Labels for the axes, default=(:X, :Depth)\nname::String: (Optional) Figure title, default=\"RTM\"\nunits::Tuple(String): (Optional) Physical units of each axis, default=(:m, :m).\nnew_fig::Bool: (Optional) Create a new figure, default=true\nsave::String: (Optional) Save figure to file, default=nothing doesn't save the figure\ncbar::Bool: (Optional) Show colorbar, default=false\n\n\n\n\n\n","category":"function"},{"location":"API/#SlimPlotting.plot_sdata","page":"API reference","title":"SlimPlotting.plot_sdata","text":"plot_sdata(image, spacing; perc=98, cmap=:linear_grey_10_95_c0_n256,\n o=(0, 0), interp=\"hanning\", aspect=nothing, d_scale=1.5,\n name=\"Shot\", units=\"m\", new_fig=true, save=nothing)\n\nPlot seismic data gather (i.e shot record). Calls _plot_with_units.\n\nArguments\n\nimage::Array{T, 2}: image to be plotted\nspacing::Tuple: grid spacing in physical units\nperc::Int: (Optional) Clipping percentile, default=95\ncmap::Symbol: (Optional) Color map, default=:lineargrey1095c0_n256\no::Tuple: (Optional) Origin of the image, default=(0, 0)\ninterp::String: (Optional) Interpolation method, default=\"hanning\"\naspect::Symbol: (Optional) Aspect ratio, default=:auto\nd_scale::Float: (Optional) Depth scaling, default=1.5. Applied scaling is (1:max_depth).^d_scale.\nlabels::Tuple: (Optional) Labels for the axes, default=(:X, :Depth)\nname::String: (Optional) Figure title, default=\"RTM\"\nunits::Tuple(String): (Optional) Physical units of each axis, default=(:m, :m).\nnew_fig::Bool: (Optional) Create a new figure, default=true\nsave::String: (Optional) Save figure to file, default=nothing doesn't save the figure\ncbar::Bool: (Optional) Show colorbar, default=false\n\n\n\n\n\n","category":"function"},{"location":"API/#SlimPlotting.wiggle_plot","page":"API reference","title":"SlimPlotting.wiggle_plot","text":"wiggle_plot(image, xrec, time_axis; t_scale=1.5,\n new_fig=true)\n\nwiggle_plot of a seismic traces.\n\nArguments\n\nimage::Array{T, 2}: Shot record to be plotted\nxrec::Array{T, 1}: Receiver coordinates\ntime_axis::Array{T, 1}: Time axis\nt_scale::Float: (Optional) Time scaling, default=1.5. Applied scaling is (1:max_time).^t_scale.\nnew_fig::Bool: (Optional) Create a new figure, default=true\n\n\n\n\n\n","category":"function"},{"location":"API/#Utilities","page":"API reference","title":"Utilities","text":"","category":"section"},{"location":"API/","page":"API reference","title":"API reference","text":"seiscm","category":"page"}] +[{"location":"examples/#Plotting-data-and-models-with-SlimPlotting","page":"Examples","title":"Plotting data and models with SlimPlotting","text":"","category":"section"},{"location":"examples/","page":"Examples","title":"Examples","text":"","category":"page"},{"location":"examples/","page":"Examples","title":"Examples","text":"title: Overview of SlimPlotting utilities author: Mathias Louboutin date: April 2023 –-","category":"page"},{"location":"examples/","page":"Examples","title":"Examples","text":"This example script is written using Weave.jl and can be converted to different format for documentation and usage This example is converted to a markdown file for the documentation.","category":"page"},{"location":"examples/#Import-SlimPlotting,-SegyIO-to-read-seismic-data,-JLD2-for-hdf5-like-files","page":"Examples","title":"Import SlimPlotting, SegyIO to read seismic data, JLD2 for hdf5-like files","text":"","category":"section"},{"location":"examples/","page":"Examples","title":"Examples","text":"using SlimPlotting, SegyIO, JLD2","category":"page"},{"location":"examples/#Initialize-all-needed-data","page":"Examples","title":"Initialize all needed data","text":"","category":"section"},{"location":"examples/","page":"Examples","title":"Examples","text":"Close all figures if any existing","category":"page"},{"location":"examples/","page":"Examples","title":"Examples","text":"plotclose(\"all\")","category":"page"},{"location":"examples/","page":"Examples","title":"Examples","text":"Python: None","category":"page"},{"location":"examples/","page":"Examples","title":"Examples","text":"Path to the files and data used for these examples","category":"page"},{"location":"examples/","page":"Examples","title":"Examples","text":"data_path = dirname(pathof(SlimPlotting)) * \"/../data/\";","category":"page"},{"location":"examples/","page":"Examples","title":"Examples","text":"Read the data","category":"page"},{"location":"examples/","page":"Examples","title":"Examples","text":"# Pure array\nvp = Float32.(segy_read(\"$(data_path)2dVP.sgy\").data);\ndm = diff(vp, dims = 1);\nshot = Float32.(segy_read(\"$(data_path)2dshot.segy\").data);\nxloc = get_header(segy_read(\"$(data_path)2dshot.segy\"), \"GroupX\")\nfslice = JLD2.load(\"$(data_path)2dfslice.jld\");","category":"page"},{"location":"examples/#Create-structures-to-mimic-JUDI-like-inputs","page":"Examples","title":"Create structures to mimic JUDI-like inputs","text":"","category":"section"},{"location":"examples/","page":"Examples","title":"Examples","text":"In the future this should be instead converted into an extension rather than implicit knowledge of the structure","category":"page"},{"location":"examples/","page":"Examples","title":"Examples","text":"# Dummy structures to check plot with metadata\nstruct geometry\n xloc::Any\nend\n\nstruct shotrec\n data::Any\n dt::Any\n geometry::Any\nend\n\nstruct Phys\n data::Any\n d::Any\nend\n\n## Make physical objects\ndmp = Phys(dm, (10, 20))\nvpp = Phys(vp, (10, 20))\nfslicep = Phys(fslice[\"Freq\"][1, :, :], (12.5, 12.5))\nshotp = shotrec([shot], 0.008, geometry([xloc]));","category":"page"},{"location":"examples/#Model-perturbation","page":"Examples","title":"Model perturbation","text":"","category":"section"},{"location":"examples/","page":"Examples","title":"Examples","text":"We plot here a model perturbation (i.e a Reverse-time Migrated image) and compare a few colormaps:","category":"page"},{"location":"examples/","page":"Examples","title":"Examples","text":"The seiscm.seimic colormap\nThe standard matplotlib Greys colormap\nThe perceptually accurate Greys colormap from colorcet","category":"page"},{"location":"examples/","page":"Examples","title":"Examples","text":"figure(figsize = (10, 10))\nsubplot(311)\nplot_simage(dmp; new_fig = false, name = \"Seismic\")\nsubplot(312)\nplot_simage(dm, (10, 20); cmap = \"Greys\", new_fig = false, name = \"Greys\")\nsubplot(313)\nplot_simage(dm, (10, 20); cmap = :cet_CET_L1, new_fig = false, name = \"Colorcet Greys\")\ntight_layout();\ndisplay(gcf());","category":"page"},{"location":"examples/","page":"Examples","title":"Examples","text":"(Image: )","category":"page"},{"location":"examples/#Velocity","page":"Examples","title":"Velocity","text":"","category":"section"},{"location":"examples/","page":"Examples","title":"Examples","text":"We plot here a velocity model and compare a few colormaps:","category":"page"},{"location":"examples/","page":"Examples","title":"Examples","text":"The seiscm.frequency colormap\nThe ColorSchemes vik colormap\nThe perceptually accurate jet colormap from colorcet named cet_rainbow4","category":"page"},{"location":"examples/","page":"Examples","title":"Examples","text":"figure(figsize = (10, 10))\nsubplot(311)\nplot_velocity(vpp; new_fig = false, name = \"colorcet jet\", cmap = \"cet_rainbow4\")\nsubplot(312)\nplot_velocity(vp, (10, 20); cmap = :vik, new_fig = false, name = \"ColorSchemes's vik\")\nsubplot(313)\nplot_velocity(vp, (10, 20); cmap = seiscm(:frequency), new_fig = false, name = \"Seiscm\")\ntight_layout();\ndisplay(gcf());","category":"page"},{"location":"examples/","page":"Examples","title":"Examples","text":"(Image: )","category":"page"},{"location":"examples/#Frequency-slice","page":"Examples","title":"Frequency slice","text":"","category":"section"},{"location":"examples/","page":"Examples","title":"Examples","text":"We plot here a frequency slice for a seismic dataset and compare a few colormaps:","category":"page"},{"location":"examples/","page":"Examples","title":"Examples","text":"The seiscm.bwr colormap\nThe standard matplotlib bwr colormap\nThe perceptually accurate bwr colormap from colorcet named cet_CET_D1A","category":"page"},{"location":"examples/","page":"Examples","title":"Examples","text":"# Frequency slice\nfigure(figsize = (10, 5))\nsubplot(131)\nplot_fslice(fslice[\"Freq\"][1, :, :], (12.5, 12.5); new_fig = false, name = \"colorcet bwr\")\nsubplot(132)\nplot_fslice(fslicep; cmap = :bwr, new_fig = false, name = \"bwr\")\nsubplot(133)\nplot_fslice(fslicep; cmap = seiscm(:bwr), new_fig = false, name = \"Seiscm bwr\")\ntight_layout();\ndisplay(gcf());","category":"page"},{"location":"examples/","page":"Examples","title":"Examples","text":"(Image: )","category":"page"},{"location":"examples/#Shot-record","page":"Examples","title":"Shot record","text":"","category":"section"},{"location":"examples/#Seismic-blue-white-red","page":"Examples","title":"Seismic blue-white-red","text":"","category":"section"},{"location":"examples/","page":"Examples","title":"Examples","text":"We plot here a frequency slice for a seismic dataset and compare a few colormaps for the bwr colormap:","category":"page"},{"location":"examples/","page":"Examples","title":"Examples","text":"The seiscm.bwr colormap\nThe standard matplotlib bwr colormap\nThe perceptually accurate bwr colormap from colorcet named cet_CET_D1A","category":"page"},{"location":"examples/","page":"Examples","title":"Examples","text":"# Shot record\nfigure(figsize = (10, 5))\nsubplot(131)\nplot_sdata(shotp; new_fig = false, name = \"matplotlib seismic\", cmap = \"bwr\")\nsubplot(132)\nplot_sdata(shot, (12.5, 0.008); cmap = :cet_CET_D1A, new_fig = false, name = \"Colorcet bwr\")\nsubplot(133)\nplot_sdata(shot, (12.5, 0.008); cmap = seiscm(:bwr), new_fig = false, name = \"Seismic bwr\")\ntight_layout();\ndisplay(gcf());","category":"page"},{"location":"examples/","page":"Examples","title":"Examples","text":"(Image: )","category":"page"},{"location":"examples/#Seismic-greys","page":"Examples","title":"Seismic greys","text":"","category":"section"},{"location":"examples/","page":"Examples","title":"Examples","text":"We plot here a frequency slice for a seismic dataset and compare a few colormaps for the greys colormap:","category":"page"},{"location":"examples/","page":"Examples","title":"Examples","text":"The standard matplotlib gray colormap\nThe perceptually accurate greys colormap from colorcet named cet_CET_L1","category":"page"},{"location":"examples/","page":"Examples","title":"Examples","text":"# Shot record\nfigure(figsize = (10, 5))\nsubplot(121)\nplot_sdata(shotp; new_fig = false, name = \"colorcet gray\", cmap = \"cet_CET_L1\")\nsubplot(122)\nplot_sdata(shot, (12.5, 0.008); cmap = \"gray\", new_fig = false, name = \"Greys\")\ntight_layout();\ndisplay(gcf());","category":"page"},{"location":"examples/","page":"Examples","title":"Examples","text":"(Image: )","category":"page"},{"location":"examples/#Compare-shot-records","page":"Examples","title":"Compare shot records","text":"","category":"section"},{"location":"examples/","page":"Examples","title":"Examples","text":"One of the main visual representation of FWI inversion is to compare the true shot record with the synthetic data from the current velocity model. A good way to visualize this difference is to overlay the two shot records alternating the traces between each shots with a different colormap to check the alignment of the events. We show below how to do this with the compare_shots function","category":"page"},{"location":"examples/","page":"Examples","title":"Examples","text":"figure(figsize = (10, 5))\nsubplot(131)\ncompare_shots(shotp, shotp; new_fig = false, name = \"Overlap compare\")\nsubplot(132)\ncompare_shots(\n shotp,\n shotp;\n new_fig = false,\n cmap = (\"bwr\", \"RdBu\"),\n name = \"Overlap compare custom cmap\",\n)\nsubplot(133)\ncompare_shots(\n shotp,\n shotp;\n side_by_side = true,\n new_fig = false,\n name = \"Side by side compare\",\n)\ntight_layout();\ndisplay(gcf());","category":"page"},{"location":"examples/","page":"Examples","title":"Examples","text":"(Image: )","category":"page"},{"location":"examples/#Wiggle-traces","page":"Examples","title":"Wiggle traces","text":"","category":"section"},{"location":"examples/","page":"Examples","title":"Examples","text":"We finally show the traditional wiggle plot for a shot record used in seismic.","category":"page"},{"location":"examples/","page":"Examples","title":"Examples","text":"# Wiggle plot\n\n# figure(figsize=(5, 5))\n# subplot(111)\n# wiggle_plot(shot[1:5:end, 1:10:end], xloc[1:10:end], 0:0.02:4.6; new_fig=false)\n# tight_layout();display(gcf())","category":"page"},{"location":"README/","page":"About","title":"About","text":"(Image: ) (Image: )","category":"page"},{"location":"README/#SlimPlotting","page":"About","title":"SlimPlotting","text":"","category":"section"},{"location":"README/","page":"About","title":"About","text":"Utility function to plot physically gridded (seismic) data in the time and frequency domain and model parameters and perturbations. The functions currently only supports 2D data.","category":"page"},{"location":"README/#Disclaimer","page":"About","title":"Disclaimer","text":"","category":"section"},{"location":"README/","page":"About","title":"About","text":"This is a small package that I started to make my life easier visualizing data and results easily. Not all functionalities are tested and some of the features may need additional options for better images. This package is under development and welcomes contributions through Issues, Pull Requests or Discussions","category":"page"},{"location":"README/#Functionalities","page":"About","title":"Functionalities","text":"","category":"section"},{"location":"README/","page":"About","title":"About","text":"This package implement four main functions that rely on a base _plot_with_units internal function.","category":"page"},{"location":"README/","page":"About","title":"About","text":"plot_simage to plot a 2D seismic image (i.e RTM)\nplot_sdata to plot 2D seismic data such as a shot record\nplot_fslice to plot a 2D frequency slice of seismic data.\nplot_velocity to plot a 2D velocity model.\nwiggle_plot to make a 2D wiggle plot of a seismic data.","category":"page"},{"location":"README/","page":"About","title":"About","text":"The functions plot_simage, plot_sdata and plot_velocity support abstract object with meta-data containing the grid spacing. For example, you can plot a 2D JUDI PhysicalParameter either via plot_velocity(p.data, p.d) or directly via plot_velocity(p) that will extract the data and spacing automatically. While this supports JUDI since we are using it extensively, this package does not depend on it and only expect a Julia structure as an input (when the spacing is not specified) containing a .d attribute with the grid spacing. We show in the simple example how to setup such a simple structure.","category":"page"},{"location":"README/","page":"About","title":"About","text":"The expected inputs are:","category":"page"},{"location":"README/","page":"About","title":"About","text":"plot_simage(array, tuple; kw...) or plot_simage(structure) with strucutre.d","category":"page"},{"location":"README/","page":"About","title":"About","text":"containing the grid spacing and structure.data containing the 2D array.","category":"page"},{"location":"README/","page":"About","title":"About","text":"plot_velocity(array, tuple; kw...) or plot_velocity(structure) with strucutre.d","category":"page"},{"location":"README/","page":"About","title":"About","text":"containing the grid spacing and structure.data containing the 2D array.","category":"page"},{"location":"README/","page":"About","title":"About","text":"plot_sdata(array, tuple; kw...) or plot_sdata(structure) with strucutre.dt","category":"page"},{"location":"README/","page":"About","title":"About","text":"containing the time sampling rate and structure.d containing the receiver spacing (uniform sampling is assumed at the time) and structure.data containing the 2D array.","category":"page"},{"location":"README/","page":"About","title":"About","text":"wiggle_plot(array, xrec, time_axis; kw...). In this case, xrec, time_axis are optional and wil default to 1:size(array, 2), 1:size(array, 1) respectively.","category":"page"},{"location":"README/","page":"About","title":"About","text":"and you can check the docstring (julia ?) for additional information on the optional keyword arguments.","category":"page"},{"location":"README/#Color-maps","page":"About","title":"Color maps","text":"","category":"section"},{"location":"README/","page":"About","title":"About","text":"The colormap support is extensive as this uses three sources:","category":"page"},{"location":"README/","page":"About","title":"About","text":"matplotlib standard colormaps.\nColorShemes.jl that implements a variery of colormaps from different packages including Matplotlib, Seaborn, GNUPlot, colorcet(Collection of perceptually accurate colormaps). You can provide the chosen colormap as a kewyword , i.e plot_simage(array, tuple; cmap=:jet).\ncolorcet perceptually accurate colormaps that are available through their colorcet names (i.e cet_rainbow4 for a perceptually accurate jet colormap).\nseismc a set of seismic colormap usable via seiscm(name) where name is one of the four supported maps seismic, bwr, frequency, phase","category":"page"},{"location":"README/","page":"About","title":"About","text":"All functionality, with the exeption of wiggle_plot accept the keyword argument cmap, i.e plot_velocity(array, spacing; cmap=:vik).","category":"page"},{"location":"README/#Authors","page":"About","title":"Authors","text":"","category":"section"},{"location":"README/","page":"About","title":"About","text":"This package is developed and maintained by Mathias Louboutin and the ML4Seismic Lab at Georgia Institute of Technology.","category":"page"},{"location":"#SLimPlotting.jl-documentation","page":"Home","title":"SLimPlotting.jl documentation","text":"","category":"section"},{"location":"","page":"Home","title":"Home","text":"Welcome to the documentation and API reference for SLimPlotting.jl.","category":"page"},{"location":"","page":"Home","title":"Home","text":"","category":"page"},{"location":"API/#API-reference","page":"API reference","title":"API reference","text":"","category":"section"},{"location":"API/","page":"API reference","title":"API reference","text":"CurrentModule = SlimPlotting","category":"page"},{"location":"API/#Core-functions","page":"API reference","title":"Core functions","text":"","category":"section"},{"location":"API/","page":"API reference","title":"API reference","text":"_plot_with_units","category":"page"},{"location":"API/#SlimPlotting._plot_with_units","page":"API reference","title":"SlimPlotting._plot_with_units","text":"_plot_with_units(image, spacing; perc=95, cmap=:cet_CET_L1, \n o=(0, 0), interp=\"hanning\", aspect=nothing, d_scale=0,\n positive=false, labels=(:X, :Depth), cbar=false,\n units=(:m, :m), name=\"RTM\", new_fig=true, save=nothing)\n\nPlot a 2D grided image with physical units defined by the grid spacing spacing.\n\nArguments\n\nimage::Array{T, 2}: image to be plotted\nspacing::Tuple: grid spacing in physical units\nperc::Int: (Optional) Clipping percentile, default=95\ncmap::Symbol: (Optional) Color map, default=:lineargrey1095c0_n256\no::Tuple: (Optional) Origin of the image, default=(0, 0)\ninterp::String: (Optional) Interpolation method, default=\"hanning\"\naspect::Symbol: (Optional) Aspect ratio, default=:auto\nd_scale::Float: (Optional) Depth scaling, default=1.5. Applied scaling is (1:max_depth).^d_scale.\npositive::Bool: (Optional) Plot positive only image (clip [0:max(image)]), default=false\nlabels::Tuple: (Optional) Labels for the axes, default=(:X, :Depth)\nname::String: (Optional) Figure title, default=\"RTM\"\nunits::Tuple(String): (Optional) Physical units of each axis, default=(:m, :m).\nnew_fig::Bool: (Optional) Create a new figure, default=true\nsave::String: (Optional) Save figure to file, default=nothing doesn't save the figure\ncbar::Bool: (Optional) Show colorbar, default=false\n\n\n\n\n\n","category":"function"},{"location":"API/#Interface","page":"API reference","title":"Interface","text":"","category":"section"},{"location":"API/","page":"API reference","title":"API reference","text":"plot_fslice\nplot_velocity\nplot_simage\nplot_sdata\nwiggle_plot","category":"page"},{"location":"API/#SlimPlotting.plot_fslice","page":"API reference","title":"SlimPlotting.plot_fslice","text":"plot_fslice(image, spacing; perc=98, cmap=:diverging_bwr_20_95_c54_n256,\n o=(0, 0), interp=\"hanning\", aspect=nothing, d_scale=1.5,\n name=\"Frequency slice\", units=\"m\", new_fig=true, save=nothing)\n\nPlot a 2D frequency slice of seismic data. Calls _plot_with_units.\n\nArguments\n\nimage::Array{T, 2}: image to be plotted\nspacing::Tuple: grid spacing in physical units\nperc::Int: (Optional) Clipping percentile, default=95\ncmap::Symbol: (Optional) Color map, default=:divergingbwr2095c54_n256\no::Tuple: (Optional) Origin of the image, default=(0, 0)\ninterp::String: (Optional) Interpolation method, default=\"hanning\"\naspect::Symbol: (Optional) Aspect ratio, default=:auto\nd_scale::Float: (Optional) Depth scaling, default=1.5. Applied scaling is (1:max_depth).^d_scale.\nlabels::Tuple: (Optional) Labels for the axes, default=(:X, :Depth)\nname::String: (Optional) Figure title, default=\"RTM\"\nunits::Tuple(String): (Optional) Physical units of each axis, default=(:m, :m).\nnew_fig::Bool: (Optional) Create a new figure, default=true\nsave::String: (Optional) Save figure to file, default=nothing doesn't save the figure\ncbar::Bool: (Optional) Show colorbar, default=false\n\n\n\n\n\n","category":"function"},{"location":"API/#SlimPlotting.plot_velocity","page":"API reference","title":"SlimPlotting.plot_velocity","text":"plot_velocity(image, spacing; perc=98, cmap=:cet_rainbow,\n o=(0, 0), interp=\"hanning\", aspect=nothing, d_scale=1.5,\n name=\"Velocity\", units=\"m\", new_fig=true, save=nothing)\n\nPlot a velocity model. Calls _plot_with_units.\n\nArguments\n\nimage::Array{T, 2}: image to be plotted\nspacing::Tuple: grid spacing in physical units\nperc::Int: (Optional) Clipping percentile, default=95\ncmap::Symbol: (Optional) Color map, default=:cet_rainbow\no::Tuple: (Optional) Origin of the image, default=(0, 0)\ninterp::String: (Optional) Interpolation method, default=\"hanning\"\naspect::Symbol: (Optional) Aspect ratio, default=:auto\nd_scale::Float: (Optional) Depth scaling, default=1.5. Applied scaling is (1:max_depth).^d_scale.\nlabels::Tuple: (Optional) Labels for the axes, default=(:X, :Depth)\nname::String: (Optional) Figure title, default=\"RTM\"\nunits::Tuple(String): (Optional) Physical units of each axis, default=(:m, :m).\nnew_fig::Bool: (Optional) Create a new figure, default=true\nsave::String: (Optional) Save figure to file, default=nothing doesn't save the figure\ncbar::Bool: (Optional) Show colorbar, default=false\n\n\n\n\n\n","category":"function"},{"location":"API/#SlimPlotting.plot_simage","page":"API reference","title":"SlimPlotting.plot_simage","text":"plot_simage(image, spacing; perc=98, cmap=:linear_grey_10_95_c0_n256,\n o=(0, 0), interp=\"hanning\", aspect=nothing, d_scale=1.5,\n labels=(:X, :Depth), name=\"RTM\", units=(:m, :m), new_fig=true,\n save=nothing, cbar=false)\n\nPlot a 2D seismic image with a grid spacing spacing. Calls _plot_with_units.\n\nArguments\n\nimage::Array{T, 2}: image to be plotted\nspacing::Tuple: grid spacing in physical units\nperc::Int: (Optional) Clipping percentile, default=95\ncmap::Symbol: (Optional) Color map, default=:lineargrey1095c0_n256\no::Tuple: (Optional) Origin of the image, default=(0, 0)\ninterp::String: (Optional) Interpolation method, default=\"hanning\"\naspect::Symbol: (Optional) Aspect ratio, default=:auto\nd_scale::Float: (Optional) Depth scaling, default=1.5. Applied scaling is (1:max_depth).^d_scale.\nlabels::Tuple: (Optional) Labels for the axes, default=(:X, :Depth)\nname::String: (Optional) Figure title, default=\"RTM\"\nunits::Tuple(String): (Optional) Physical units of each axis, default=(:m, :m).\nnew_fig::Bool: (Optional) Create a new figure, default=true\nsave::String: (Optional) Save figure to file, default=nothing doesn't save the figure\ncbar::Bool: (Optional) Show colorbar, default=false\n\n\n\n\n\n","category":"function"},{"location":"API/#SlimPlotting.plot_sdata","page":"API reference","title":"SlimPlotting.plot_sdata","text":"plot_sdata(image, spacing; perc=98, cmap=:linear_grey_10_95_c0_n256,\n o=(0, 0), interp=\"hanning\", aspect=nothing, d_scale=1.5,\n name=\"Shot\", units=\"m\", new_fig=true, save=nothing)\n\nPlot seismic data gather (i.e shot record). Calls _plot_with_units.\n\nArguments\n\nimage::Array{T, 2}: image to be plotted\nspacing::Tuple: grid spacing in physical units\nperc::Int: (Optional) Clipping percentile, default=95\ncmap::Symbol: (Optional) Color map, default=:lineargrey1095c0_n256\no::Tuple: (Optional) Origin of the image, default=(0, 0)\ninterp::String: (Optional) Interpolation method, default=\"hanning\"\naspect::Symbol: (Optional) Aspect ratio, default=:auto\nd_scale::Float: (Optional) Depth scaling, default=1.5. Applied scaling is (1:max_depth).^d_scale.\nlabels::Tuple: (Optional) Labels for the axes, default=(:X, :Depth)\nname::String: (Optional) Figure title, default=\"RTM\"\nunits::Tuple(String): (Optional) Physical units of each axis, default=(:m, :m).\nnew_fig::Bool: (Optional) Create a new figure, default=true\nsave::String: (Optional) Save figure to file, default=nothing doesn't save the figure\ncbar::Bool: (Optional) Show colorbar, default=false\n\n\n\n\n\n","category":"function"},{"location":"API/#SlimPlotting.wiggle_plot","page":"API reference","title":"SlimPlotting.wiggle_plot","text":"wiggle_plot(image, xrec, time_axis; t_scale=1.5,\n new_fig=true)\n\nwiggle_plot of a seismic traces.\n\nArguments\n\nimage::Array{T, 2}: Shot record to be plotted\nxrec::Array{T, 1}: Receiver coordinates\ntime_axis::Array{T, 1}: Time axis\nt_scale::Float: (Optional) Time scaling, default=1.5. Applied scaling is (1:max_time).^t_scale.\nnew_fig::Bool: (Optional) Create a new figure, default=true\n\n\n\n\n\n","category":"function"},{"location":"API/#Utilities","page":"API reference","title":"Utilities","text":"","category":"section"},{"location":"API/","page":"API reference","title":"API reference","text":"seiscm","category":"page"}] }