geoist.flex package

Submodules

geoist.flex.classes module

plateflex defines the following Grid classes:

  • Grid

  • TopoGrid

  • GravGrid

  • BougGrid

  • FairGrid

  • RhocGrid

  • ZcGrid

These classes can be initialized with a grid of topography/bathymetry or gravity anomaly (Bouguer/Free-air) data, and contain methods for the following functionality:

  • Extracting contours at some level of the grid

  • Performing a wavelet transform using a Morlet wavelet

  • Obtaining the wavelet scalogram from the wavelet transform

  • Plotting the input grids, wavelet transform components, and scalograms

This module further contains the class Project, which itself is a container of Grid objects (at least one each of TopoGrid and GravGrid). Methods are available to:

  • Add Grid or Project objects to the project

  • Iterate over Grid objects

  • Initialize the project

  • Perform the wavelet admittance and coherence between topography (TopoGrid object) and gravity anomalies (GravGrid object)

  • Plot the wavelet admnittance and coherence spectra

  • Estimate model parameters at single grid cell

  • Estimate model parameters at every (or decimated) grid cell

  • Plot the statistics of the estimated parameters at single grid cell

  • Plot the observed and predicted admittance and coherence functions at single grid cell

  • Plot the final grids of model parameters

class geoist.flex.classes.BougGrid(grid, dx, dy)[源代码]

基类:geoist.flex.classes.GravGrid

Basic grid class of plateflex for Bouguer gravity data that inherits from GravGrid

Additional Attributes

title: str

Descriptor for Bouguer gravity data

>>> import numpy as np
>>> from plateflex import Grid, BougGrid, GravGrid
>>> nn = 200; dd = 10.
>>> bouggrid = BougGrid(np.random.randn(nn, nn), dd, dd)
>>> isinstance(bouggrid, GravGrid)
True
>>> isinstance(bouggrid, Grid)
True
class geoist.flex.classes.FairGrid(grid, dx, dy)[源代码]

基类:geoist.flex.classes.GravGrid

Basic grid class of plateflex for Free-air gravity data that inherits from GravGrid

Additional Attributes

title: str

Descriptor for Free-air gravity data

>>> import numpy as np
>>> from plateflex import Grid, FairGrid, GravGrid
>>> nn = 200; dd = 10.
>>> fairgrid = FairGrid(np.random.randn(nn, nn), dd, dd)
>>> isinstance(fairgrid, GravGrid)
True
>>> isinstance(fairgrid, Grid)
True
class geoist.flex.classes.GravGrid(grid, dx, dy)[源代码]

基类:geoist.flex.classes.Grid

Basic grid class of plateflex for gravity data that inherits from Grid

Additional Attributes

units: str

Units of Gravity anomaly ('\(mGal\)')

sg_units: str

Units of wavelet PSD (scalogram) ('\(mGal^2/|k|\)')

logsg_units: str

Units of log of wavelet PSD (log(scalogram)) ('\(log(mGal^2/|k|)\)')

title: str

Descriptor for Gravity data

Example

>>> import numpy as np
>>> from plateflex import Grid, GravGrid
>>> nn = 200; dd = 10.
>>> gravgrid = GravGrid(np.random.randn(nn, nn), dd, dd)
>>> isinstance(gravgrid, Grid)
True
class geoist.flex.classes.Grid(grid, dx, dy)[源代码]

基类:object

An object containing a 2D array of data and Cartesian coordinates specifying the bounding box of the array. Contains methods to calculate the wavelet transform, wavelet scalogram and to plot those quantities at a specified wavenumber index.

参数
  • grid (ndarray) -- 2D array of of topography/gravity data

  • dx (float) -- Grid spacing in the x-direction (km)

  • dy (float) -- Grid spacing in the y-direction (km)

Grid must be projected in km.

Default Attributes

datandarray

2D array of topography/gravity data (shape (nx,ny))

dxfloat

Grid spacing in the x-direction in km

dyfloat

Grid spacing in the y-direction in km

nxint

Number of grid cells in the x-direction

nyint

Number of grid cells in the y-direction

unitsstr

Units of data set

sg_unitsstr

Units of power-spectral density of data set

logsg_unitsstr

Units of power-spectral density of data set in log

titlestr

Descriptor for data set - used in title of plots

ns int

Number of wavenumber samples

knp.ndarray

1D array of wavenumbers

>>> import numpy as np
>>> from plateflex import Grid
>>> # Create zero-valued square grid
>>> nn = 200; dd = 10.
>>> xmin = ymin = 0.
>>> xmax = ymax = (nn-1)*dd
>>> data = np.zeros((nn, nn))
>>> grid = Grid(data, dx, dy)
>>> grid
<plateflex.grids.Grid object at 0x10613fe10>
make_contours(level=0.0)[源代码]

This function returns the contours as a List of coordinate positions at one given level - run this more than once with different levels if desired

参数

level (float) -- Level (z value) of grid to contour

返回

contours: List of contours with coordinate positions

plot(mask=None, title=None, save=None, clabel=None, contours=None, **kwargs)[源代码]
plot_scalogram(kindex=None, log=True, mask=None, title='Wavelet scalogram', save=None, clabel=None, contours=None, **kwargs)[源代码]

This method plots the wavelet scalogram of a Grid object at a wavenumber index (int). Raises Exception for the cases where:

  • no wavenumber index is specified (kindex)

  • wavenumber index is lower than 0 or larger than self.ns - 1

注解

If no wl_sg attribute is found, the method automatically calculates the wavelet scalogram (and maybe also the wavelet transform) first.

plot_transform(kindex=None, aindex=None, log=False, mask=None, save=None, clabel=None, contours=None, **kwargs)[源代码]

This method plots the real and imaginary components of the wavelet transform of a Grid object at wavenumber and angle indices (int). Raises Exception for the cases where:

  • no wavenumber OR angle index is specified (kindex and aindex)

  • wavenumber index is lower than 0 or larger than self.ns

  • angle index is lower than 0 or larger than 11 (hardcoded)

注解

If no wl_trans attribute is found, the method automatically calculates the wavelet transform first.

wlet_scalogram()[源代码]

This method uses the module cpwt to calculate the wavelet scalogram of the grid.

注解

If no wl_trans attribute is found, the method automatically calculates the wavelet transform first.

The wavelet scalogram is stored as an attribute of the object.

Additional Attributes

wl_sgndarray

Wavelet scalogram of the grid (shape (nx,ny,na,ns))

Examples

>>> import numpy as np
>>> from plateflex import Grid
>>> # Create random-valued square grid
>>> nn = 200; dd = 10.
>>> xmin = ymin = 0.
>>> xmax = ymax = (nn-1)*dd
>>> # set random seed
>>> np.random.seed(0)
>>> data = np.random.randn(nn, nn)
>>> grid1 = Grid(data, dx, dy)
>>> grid1.wlet_scalogram()
 #loops = 17:  1  2  3  4  5  6  7  8  9 10 11 12 13 14 15 16 17
>>> grid1.wl_sg.shape
(200, 200, 17)
>>> # Perform wavelet transform first
>>> grid2 = Grid(data, dx, dy)
>>> grid2.wlet_transform()
 #loops = 17:  1  2  3  4  5  6  7  8  9 10 11 12 13 14 15 16 17
>>> grid2.wlet_scalogram()
>>> np.allclose(grid1.wl_sg, grid2.wl_sg)
True
wlet_transform()[源代码]

This method uses the module cpwt to calculate the wavelet transform of the grid. By default the method mirrors the grid edges, tapers them (10 points on each edge) and pads the array with zeros to the next power of 2. The wavelet transform is stored as an attribute of the object.

Additional Attributes

wl_transndarray

Wavelet transform of the grid (shape (nx,ny,na,ns))

Example

>>> import numpy as np
>>> from plateflex import Grid
>>> # Create zero-valued square array
>>> nn = 200; dd = 10.
>>> xmin = ymin = 0.
>>> xmax = ymax = (nn-1)*dd
>>> data = np.zeros((nn, nn))
>>> grid = Grid(data, dx, dy)
>>> grid.wlet_transform()
 #loops = 13:  1  2  3  4  5  6  7  8  9 10 11 12 13
>>> grid.wl_trans.shape
(100, 100, 11, 13)
class geoist.flex.classes.Project(grids=None)[源代码]

基类:object

Container for Grid objects, with methods to calculate the wavelet admittance and coherence and estimate flexural model parameters as well as plot various results.

参数

grids (list of Grid, optional) -- Initial list of PlateFlex Grid objects.

Default Attributes

grids: List

List of Grid objects

inversestr

Type of inversion to perform. By default the type is 'L2' for non-linear least-squares. Options are: 'L2' or 'bayes'

maskArray

2D array of boolean values determined independently

initializedBool

Whether or not the project has been initialized and is ready for the wavelet analysis and estimation steps. By default this parameter is False, unless the method init has been executed.

注解

Can hold a list of any length with any type of Grid objects - however the wavelet calculations will only proceed if the project holds one each of TopoGrid and GravGrid (BougGrid or FairGrid) objects.

Examples

Create zero-valued square grid

>>> import numpy as np
>>> from plateflex import Grid, TopoGrid, BougGrid, GravGrid, Project
>>> nn = 200; dd = 10.
>>> topogrid = TopoGrid(np.random.randn(nn, nn), dd, dd)
>>> bouggrid = BougGrid(np.random.randn(nn, nn), dd, dd)
>>> isinstance(bouggrid, GravGrid)
True
>>> isinstance(bouggrid, Grid)
True

Assign project with list of grids

>>> Project(grids=[topogrid, bouggrid])
<plateflex.classes.Project object at 0x10c62b320>

Add Grid to project

>>> project = Project()
>>> project += topogrid
>>> project += bouggrid
>>> project.grids
[<plateflex.classes.TopoGrid object at 0x1176b4240>, <plateflex.classes.BougGrid object at 0x1176b42e8>]

Append Grid to project

>>> project = Project()
>>> project.append(topogrid)
<plateflex.classes.Project object at 0x1176b9400>
>>> project.grids[0]
<plateflex.classes.TopoGrid object at 0x1176b4240>

Initialize project

>>> project.init()

Exception if project does not contain exactly one TopoGrid and one GravGrid

>>> project = Project(grids=[topogrid, topogrid])
>>> project.init()
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/Users/pascalaudet/Softwares/Python/plateflex-dev/PlateFlex/plateflex/classes.py", line 492, in wlet_admit_coh
    grids = self.grids + other.grids
Exception: There needs to be one GravGrid object in Project

Calculate wavelet admittance and coherence

>>> project = Project(grids=[topogrid, bouggrid])
>>> project.wlet_admit_coh()
 #loops = 17:  1  2  3  4  5  6  7  8  9 10 11 12 13 14 15 16 17
 #loops = 17:  1  2  3  4  5  6  7  8  9 10 11 12 13 14 15 16 17
 Calculation jackknife error on admittance and coherence
append(grid)[源代码]

Append a single Grid object to the current :class:`~plateflex.classes.Project object.

参数

grid (Grid) -- object to append to project

Example

>>> import numpy as np
>>> from plateflex import Grid, Project
>>> nn = 200; dd = 10.
>>> grid = Grid(np.random.randn(nn, nn), dd, dd)
>>> project = Project()
>>> project.append(grid)
estimate_cell(cell=0, 0, alph=False, atype='joint', returned=False)[源代码]

Method to estimate the parameters of the flexural model at a single cell location of the input grids. The type of estimation performed is set by the project attribute inverse. See Project` and estimate for details. The model parameters rhoc and zc are extracted from the corresponding RhocGrid and ZcGrid objects if they were initialized in the project.

参数
  • cell (tuple) -- Indices of cell location within grid

  • alph (bool, optional) -- Whether or not to estimate parameter alpha

  • atype (str, optional) -- Whether to use the admittance ('admit'), coherence ('coh') or both ('joint')

  • returned (bool, optional) -- Whether or not to return the estimates

Additional Attributes

traceMultiTrace

Posterior samples from the MCMC chains

summaryDataFrame

Summary statistics from Posterior distributions

map_estimatedict, optional

Container for Maximum a Posteriori (MAP) estimates

celltuple

Indices of cell location within grid

Results are stored as attributes of Project object.

estimate_grid(nn=10, alph=False, atype='joint', parallel=False)[源代码]

Method to estimate the parameters of the flexural model at all grid point locations. It is also possible to decimate the number of grid cells at which to estimate parameters.

参数
  • nn (int) -- Decimator. If grid shape is (nx, ny), resulting grids will have shape of (int(nx/nn), int(ny/nn)).

  • alph (bool, optional) -- Whether or not to estimate parameter alpha

  • atype (str, optional) -- Whether to use the admittance ('admit'), coherence ('coh') or both ('joint')

Additional Attributes

mean_Te_gridndarray

Grid with mean Te estimates (shape (nx, ny))

MAP_Te_gridndarray

Grid with MAP Te estimates (shape (nx, ny))

std_Te_gridndarray

Grid with std Te estimates (shape (nx, ny))

mean_F_gridndarray

Grid with mean F estimates (shape (nx, ny))

MAP_F_gridndarray

Grid with MAP F estimates (shape (nx, ny))

std_F_gridndarray

Grid with std F estimates (shape (nx, ny))

Optional Attributes

mean_a_gridndarray

Grid with mean alpha estimates (shape (nx, ny)). Only present if alph=True.

MAP_a_gridndarray

Grid with MAP alpha estimates (shape (nx, ny)). Only present if alph=True.

std_a_gridndarray

Grid with std alpha estimates (shape (nx, ny)). Only present if alph=True.

chi2_gridndarray

Grid with reduced chi-squared estimates (shape (nx, ny)). Only present if project.inverse='L2'

new_maskArray

New grid of masked (boolean) values, corresponding to decimated mask.

extend(grid_list)[源代码]

Extend the current Project object with a list of Grid objects.

参数

trace_list -- list of Grid objects or Project.

Example

>>> import numpy as np
>>> from plateflex import Grid, Project
>>> nn = 200; dd = 10.
>>> grid1 = Grid(np.random.randn(nn, nn), dd, dd)
>>> grid2 = Grid(np.random.randn(nn, nn), dd, dd)
>>> project = Project()
>>> project.extend(grids=[grid1, grid2])
init()[源代码]

Method to initialize a project. This step is required before calculating the wavelet admittance and coherence. The method checks that the project contains one each of TopoGrid and GravGrid. It also ensures that all grids have the same shape and sampling intervals. If Grids of type RhocGrid and/or ZcGrid are present, the project attributes will be updated with data from those grids to be used in the estimation part. The method further sets the water depth at each cell location (grid point) from the TopoGrid object.

Additional Attributes

water_depthndarray

Grid of water depth from topography data (shape (nx,ny))

nxint

Number of grid cells in the x-direction

nyint

Number of grid cells in the y-direction

nsint

Number of wavenumber samples

knp.ndarray

1D array of wavenumbers

initializedbool

Set to True when method is called successfully

Optional Attributes

rhocndarray

Grid of crustal density data (shape (nx,ny))

zcndarray

Grid of crustal thickness data (shape (nx,ny))

Example

>>> project = Project[grids=[topogrid, fairgrid, zcgrid]]
>>> project.init()
plot_admit_coh(kindex=None, mask=None, save=None, contours=None, **kwargs)[源代码]

Method to plot grids of wavelet admittance and coherence at a given wavenumber index.

参数
  • kindex (int) -- Index of wavenumber array

  • mask (ndarray, optional) -- Array of booleans for masking data points

  • title (str, optional) -- Title of plot

  • save (str, optional) -- Name of file for to save figure

  • clabel (str, optional) -- Label for colorbar

  • contours (List) -- List of contour lines obtained separately

  • kwargs (Keyword arguments) -- Keyword arguments allowing more control on plots

plot_bayes_stats(title=None, save=None)[源代码]

Method to plot the marginal and joint distributions of samples drawn from the posterior distribution as well as the extracted statistics. Calls the function plot_stats with attributes as arguments.

参数
  • title (str, optional) -- Title of plot

  • save (str, optional) -- Name of file for to save figure

plot_functions(est='mean', title=None, save=None)[源代码]

Method to plot observed and fitted admittance and coherence functions using one of mean or MAP estimates. The MAP is only available if the project attribute has been set to project='bayes'. Calls the function plot_functions with attributes as arguments.

参数
  • est (str, optional) -- Type of inference estimate to use for predicting admittance and coherence

  • title (str, optional) -- Title of plot

  • save (str, optional) -- Name of file for to save figure

plot_results(mean_Te=False, MAP_Te=False, std_Te=False, mean_F=False, MAP_F=False, std_F=False, mean_a=False, MAP_a=False, std_a=False, chi2=False, mask=False, contours=None, save=None, filter=True, sigma=1, **kwargs)[源代码]

Method to plot grids of estimated parameters with fixed labels and titles. To have more control over the plot rendering, use the function plot_real_grid with the relevant quantities and plotting options.

参数
  • mean/MAP/std_Te/F/a (bool) -- Type of plot to produce. All variables default to False (no plot generated)

  • mask (bool) -- Whether or not to plot the mask

  • contours (List) -- List of contours with coordinate positions

  • filter (bool) -- Whether or not to filter the resulting grid using a Gaussian filter

  • sigma (int) -- Standard deviation of filter (in terms of adjacent cells), if set to True

  • kwargs (Keyword arguments) -- Keyword arguments allowing more control on plots

注解

It is advisable to plot each grid separately using one call per grid, in order to have more control on plot paramters (e.g., colormap, min and max values of colorbar, etc.).

wlet_admit_coh()[源代码]

This method uses the module cpwt to calculate the wavelet admittance and coherence. The object needs to contain exactly two Grid objects, one of each of TopoGrid and GravGrid objects.

注解

If no wl_trans attribute is found for individual Grid objects, the method automatically calculates them first.

Stores the wavelet admittance, coherence and their errors as attributes

Additional Attributes

wl_admitndarray

Wavelet admittance (shape (nx,ny,ns))

wl_eadmitndarray

Error of wavelet admittance (shape (nx,ny,ns))

wl_cohndarray

Wavelet coherence (shape (nx,ny,ns))

wl_ecohndarray

Error of wavelet coherence (shape (nx,ny,ns))

class geoist.flex.classes.RhocGrid(grid, dx, dy)[源代码]

基类:geoist.flex.classes.Grid

Basic grid class of plateflex for crustal density data that inherits from Grid

Additional Attributes

unitsstr

Units of Density ('\(kg/m^3\)')

title: str

Descriptor for Density data

注解

This class should only be used to specify the density of the crust at each cell location. Although the Grid methods are still available, they are not useful in this context.

class geoist.flex.classes.TopoGrid(grid, dx, dy)[源代码]

基类:geoist.flex.classes.Grid

Basic grid class of plateflex for Topography data that inherits from Grid

Additional Attributes

unitsstr

Units of Topography ('\(m\)')

sg_unitsstr

Units of wavelet PSD (scalogram) ('\(m^2/|k|\)')

logsg_unitsstr

Units of log of wavelet PSD (log(scalogram)) ('\(log(m^2/|k|)\)')

title: str

Descriptor for Topography data

>>> import numpy as np
>>> from plateflex import Grid, TopoGrid
>>> nn = 200; dd = 10.
>>> topogrid = TopoGrid(np.random.randn(nn, nn), dd, dd)
>>> isinstance(topogrid, Grid)
True

注解

Automatically converts grid values to 'meters' if standard deviation is lower than 20

filter_water_depth(sigma=10, returned=False)[源代码]
plot_water_depth(mask=None, title=None, save=None, clabel=None, contours=None, **kwargs)[源代码]
class geoist.flex.classes.ZcGrid(grid, dx, dy)[源代码]

基类:geoist.flex.classes.Grid

Basic grid class of plateflex for crustal thickness data that inherits from Grid

Additional Attributes

unitsstr

Units of Crustal thickness ('\(m\)')

title: str

Descriptor for Crustal thickness data

注解

This class should only be used to specify the thickness of the crust at each cell location. Although the Grid methods are still available, they are not useful in this context.

geoist.flex.conf module

plateflex.cpwt.conf_cpwt

Global variable that controls the spatio-spectral localization of the Morlet wavelet. Default value in parentheses.

Internal wavenumber of Morlet wavelet

k0: float

Internal Morlet wavenumber (5.336 or higher)

plateflex.flex.conf_flex

Global variables that define model parameters for the flexural model. Default values in parentheses.

Earth parameters - fixed

Efloat

Young's modulus (100 GPa)

nufloat

Poisson's ratio (0.25)

gfloat

Gravitational acceleration (9.81 m/s^2)

Gfloat)

Gravitational constant (6.67e-11*1.e5 mGal)

Earth parameters - variable

zcfloat

Crustal thickness (35.e3 m)

rhom: float

Uppermost mantle density (3200. kg/m^3)

rhocfloat

Crustal density (2700. kg/m^3)

rhoafloat

Air density (0. kg/m^3)

rhowfloat

Water density (1030. kg/m^3)

rhoffloat

Fluid density at topo/fluid interface (==rhoa or ==rhow, depending on water depth)

wdfloat

Water depth (0.e3 m) - Automatically determined from TopoGrid object

plateflex.conf

Global variables that control sampling of the posterior from MCMC chains using pymc3. Default values in parentheses.

Bayes sampling

drawsint

Number of draws (i.e., samples) in single MCMC chain (500)

tunesint

Number of tuning (i.e., burn-in) samples (500)

coresint

Number of cores (i.e., parallel MCMC chains) (4)

geoist.flex.cpwt.cp37-win_amd64 module

geoist.flex.estimate module

This plateflex module contains the following functions:

  • bayes_estimate_cell: Set up pymc model and estimate the parameters of the elastic plate model using a probabilistic Bayesian inference method.

  • get_bayes_estimates: Explore the output of sampling the pymc model

  • L2_estimate_cell: Set up non-linear curve fitting to estimate the parameters of the elastic plate model using non-linear least-squares from the function scipy.optimize.curve_fit.

  • get_L2_estimates: Explore the output the non-linear inversion

  • real_xspec_functions: Calculate the analytical admittance and coherence functions.

Internal functions are also available to define predicted admittance and coherence data with theano decorators to be incorporated as pymc variables. These functions are used within Project methods as with plotting functions.

警告

If you plan to estimate model parameters over entire grids, the non-linear least-squares method is orders of magnitude faster than the probabilistic method and should be preferred. The probabilistic method, on the other hand, gives useful estimation statistics from sampling the posterior distribution and can provide better insight on the trade-off between parameters. Estimates from the two methods are otherwise asymptotically identical (i.e., given infinite sampling of the posterior)

geoist.flex.estimate.L2_estimate_cell(k, adm, eadm, coh, ecoh, alph=False, atype='joint')[源代码]

Function to estimate the parameters of the flexural model at a single cell location of the input grids.

参数
  • k (ndarray) -- 1D array of wavenumbers

  • adm (ndarray) -- 1D array of wavelet admittance

  • eadm (ndarray) -- 1D array of error on wavelet admittance

  • coh (ndarray) -- 1D array of wavelet coherence

  • ecoh (ndarray) -- 1D array of error on wavelet coherence

  • alph (bool, optional) -- Whether or not to estimate parameter alpha

  • atype (str, optional) -- Whether to use the admittance ('admit'), coherence ('coh') or both ('joint')

返回

(tuple): Tuple containing:
  • summaryDataFrame

    Summary statistics from L2 estimation

geoist.flex.estimate.bayes_estimate_cell(k, adm, eadm, coh, ecoh, alph=False, atype='joint')[源代码]

Function to estimate the parameters of the flexural model at a single cell location of the input grids.

参数
  • k (ndarray) -- 1D array of wavenumbers

  • adm (ndarray) -- 1D array of wavelet admittance

  • eadm (ndarray) -- 1D array of error on wavelet admittance

  • coh (ndarray) -- 1D array of wavelet coherence

  • ecoh (ndarray) -- 1D array of error on wavelet coherence

  • alph (bool, optional) -- Whether or not to estimate parameter alpha

  • atype (str, optional) -- Whether to use the admittance ('admit'), coherence ('coh') or both ('joint')

返回

(tuple): Tuple containing:
  • traceMultiTrace

    Posterior samples from the MCMC chains

  • summaryDataFrame

    Summary statistics from Posterior distributions

  • map_estimatedict

    Container for Maximum a Posteriori (MAP) estimates

geoist.flex.estimate.get_L2_estimates(summary)[源代码]

Returns digestible estimates from the L2 estimates.

参数

summary (DataFrame) -- Summary statistics from Posterior distributions

返回

(tuple): tuple containing:
  • mean_te (float) : Mean value of elastic thickness from posterior (km)

  • std_te (float) : Standard deviation of elastic thickness from posterior (km)

  • mean_F (float) : Mean value of load ratio from posterior

  • std_F (float) : Standard deviation of load ratio from posterior

  • mean_a (float, optional) : Mean value of phase difference between initial loads from posterior

  • std_a (float, optional) : Standard deviation of phase difference between initial loads from posterior

  • rchi2 (float) : Reduced chi-squared value

geoist.flex.estimate.get_bayes_estimates(summary, map_estimate)[源代码]

Returns digestible estimates from the Posterior distributions.

参数
  • summary (DataFrame) -- Summary statistics from Posterior distributions

  • map_estimate (dict) -- Container for Maximum a Posteriori (MAP) estimates

返回

(tuple): tuple containing:
  • mean_te (float) : Mean value of elastic thickness Te from posterior (km)

  • std_te (float) : Standard deviation of elastic thickness Te from posterior (km)

  • C2_5_te (float) : Lower limit of 95% confidence interval on Te (km)

  • C97_5_te (float) : Upper limit of 95% confidence interval on Te (km)

  • MAP_te (float) : Maximum a Posteriori Te (km)

  • mean_F (float) : Mean value of load ratio F from posterior

  • std_F (float) : Standard deviation of load ratio F from posterior

  • C2_5_F (float) : Lower limit of 95% confidence interval on F

  • C97_5_F (float) : Upper limit of 95% confidence interval on F

  • MAP_F (float) : Maximum a Posteriori load ratio F

  • mean_a (float, optional) : Mean value of initial phase difference alpha from posterior

  • std_a (float, optional) : Standard deviation of initial phase difference alpha` from posterior

  • C2_5_a (float, optional) : Lower limit of 95% confidence interval on alpha

  • C97_5_a (float, optional) : Upper limit of 95% confidence interval on alpha

  • MAP_a (float, optional) : Maximum a Posteriori initial phase difference alpha

geoist.flex.estimate.real_xspec_functions(k, Te, F, alpha=1.5707963267948966)[源代码]

Calculate analytical expressions for the real component of admittance and coherence functions.

参数
  • k (np.ndarray) -- Wavenumbers (rad/m)

  • Te (float) -- Effective elastic thickness (km)

  • F (float) -- Subsurface-to-surface load ratio [0, 1[

  • alpha (float, optional) -- Phase difference between initial applied loads (rad)

返回

(tuple): tuple containing:
  • admittance (ndarray): Real admittance function (shape: len(k))

  • coherence (ndarray): Coherence functions (shape: len(k))

geoist.flex.flex.cp37-win_amd64 module

geoist.flex.plotting module

This plateflex` module contains the following functions for plotting:

  • plot_real_grid

  • plot_bayes_stats

  • plot_functions

geoist.flex.plotting.plot_bayes_stats(trace, summary, map_estimate, title=None, save=None)[源代码]

Extract results from variables trace, summary and map_estimate to plot marginal and joint posterior distributions. Automatically determines how to plot results from those variables.

参数
  • trace (MultiTrace) -- Posterior samples from the MCMC chains

  • summary (DataFrame) -- Summary statistics from Posterior distributions

  • map_estimate (dict) -- Container for Maximum a Posteriori (MAP) estimates

  • title (str, optional) -- Title of plot

  • save (str, optional) -- Name of file for to save figure

geoist.flex.plotting.plot_functions(k, adm, eadm, coh, ecoh, padm=None, pcoh=None, title=None, save=None)[源代码]

Function to plot observed and predicted (None by default) admittance and coherence functions. Both admittance and coherence are plotted regardless of method to estimate the model paramters.

参数
  • k (ndarray) -- 1D array of wavenumbers

  • adm (ndarray) -- 1D array of observed wavelet admittance

  • eadm (ndarray) -- 1D array of error on observed wavelet admittance

  • coh (ndarray) -- 1D array of observed wavelet coherence

  • ecoh (ndarray) -- 1D array of error on observed wavelet coherence

  • padm (ndarray) -- 1D array of predicted wavelet admittance

  • pcoh (ndarray) -- 1D array of predicted wavelet coherence

  • title (str, optional) -- Title of plot

  • save (str, optional) -- Name of file for to save figure

geoist.flex.plotting.plot_real_grid(grid, log=False, mask=None, title=None, save=None, clabel=None, contours=None, **kwargs)[源代码]

Plot 2D image of any real-valued 2D array, used in several context throughout plateflex. For example, it can be used to plot the input grids of topography or gravity anomalies, the real or imaginary values of the wavelet transform at a giben wavenumber index, the wavelet scalograms at a given wavenumber index, the wavelet admittance or coherence at a given wavenumber index, or the final grids of results.

参数
  • grid (ndarray) -- Array of real-valued data

  • log (bool, optional) -- Whether or not to take the log of the array values (useful in scalogram)

  • mask (np.ndarray, optional) -- Array of booleans for masking data points

  • title (str, optional) -- Title of plot

  • save (str, optional) -- Name of file for to save figure

  • clabel (str, optional) -- Label for colorbar

  • contours (List) -- Contours to overlay on maps (e.g., useful for plotting outline of land areas)

Module contents

PlateFlex is a software for estimating the effective elastic thickness of the lithosphere from the inversion of flexural isostatic response functions calculated from a wavelet analysis of gravity and topography data.

Licence

Copyright 2019 Pascal Audet

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

Installation

Dependencies

The current version was developed using Python3.7 Also, the following packages are required:

The following package is useful to draw outline of land areas:

See below for full installation details.

Download the software

  • Clone the repository:

git clone https://github.com/paudetseis/PlateFlex.git
cd PlateFlex

Conda environment

We recommend creating a custom conda environment where plateflex can be installed along with its dependencies.

conda create -n pflex python=3.7 numpy pymc3 matplotlib seaborn -c conda-forge

or create it from the pflex_env.yml file:

conda env create -f pflex_env.yml

Activate the newly created environment:

conda activate pflex

Installing using pip

Once the previous steps are performed, you can install plateflex using pip:

pip install .

注解

Please note, if you are actively working on the code, or making frequent edits, it is advisable to perform the pip installation with the -e flag. This enables an editable installation, where symbolic links are used rather than straight copies. This means that any changes made in the local folders will be reflected in the packages available on the system.

geoist.flex.get_conf_cpwt()[源代码]

Print global variable that controls the spatio-spectral resolution of the wavelet transform

Example

>>> import plateflex
>>> plateflex.get_conf_cpwt()
Wavelet parameter used in plateflex.cpwt:
-----------------------------------------
[Internal wavenumber]      k0 (float):     5.336
geoist.flex.get_conf_flex()[源代码]

Print global variables that control the setup of the flexural isostatic model

Example

>>> import plateflex
>>> plateflex.get_conf_flex()
Global model parameters currently in use by plateflex:
------------------------------------------------------
[Crustal thickness]        zc (float):     35000 m
[Mantle density]           rhom (float):   3200 kg/m^3
[Crustal density]          rhoc (float):   2700 kg/m^3
[Water density]            rhow (float):   1030 kg/m^3
[Air density]              rhoa (float):   0 kg/m^3
[Fluid density]            rhof (float):   0 kg/m^3
[Water depth]              wd (float):     0 m
[Bouguer analysis?]        boug (int):     1 ; True
geoist.flex.set_conf_cpwt()[源代码]
geoist.flex.set_conf_flex()[源代码]