Models and Calculations

modelr.reflectivity

Basic methods for creating models.

modelr.reflectivity.do_convolve(wavelets, data, traces=None)[source]

Convolves wavelets against a reflectivity dataset.

Parameters:
  • wavelets – An array of wavelets to convolve with the dataset. The array must be indexed as [samples, wavelet].
  • traces – Indexes of of traces to convolve. If none are specified, convolutions will be calculated for every trace.
Param:

data: An array of reflectivity data to convolve against. Must be indexed as [samples, traces ].

Returns:

an array of synthetic seismic traces, indexed as [samples, traces, wavelet].

modelr.reflectivity.get_boundaries(data)[source]

Finds interfaces in the earth model

Parameters:data – A numpy array of RGB values, indexed as (sample, trace, (R,G,B) )
Returns:a list of indices where a boundary occurs.
modelr.reflectivity.get_reflectivity(data, colourmap, theta=0, reflectivity_method=<function zoeppritz at 0x53ee488>)[source]

Create reflectivities from an image of an earth model and a mapping of colours to rock properties. Will find each interface and use the specified reflectivity method to calculate the Vp reflection coefficient.

Parameters:
  • data – The image data of the earth model. A 3D array indexed as [samples, traces, colour].
  • colourmap – A lookup table (dict) that maps colour values to rock property structures.
  • theta – Angle of incidence to use reflectivity. Can be a float or an array of angles [deg].
  • reflectivity_method – The reflectivity algorithm to use. See agilegeo.avo for methods.
Returns:

The vp reflectivity coefficients corresponding to the earth model. Data will be indexed as [sample, trace, theta]

modelr.reflectivity.rock_reflectivity(Rp0, Rp1, theta=0.0, method=<function zoeppritz at 0x53ee488>)[source]

A wrapper function for calling any of the reflection methods using rock property structures.

Parameters:
  • Rp0 – A rock properties structure for the top medium. Struct must contain vp, vs, rho.
  • Rp1 – A rock properties structure for the bottom medium. Struct must contain vp, vs, rho.
  • theta – A single angle or an array of angles to calculate angle dependent reflectivity. Defaults to 0.
  • method – The reflectivity method to use. See agilegeo.avo for available functions. Defaults to zoeppreitz.
Returns:

the p-wave reflection coefficients for each value of theta.

modelr.modelbuilder

modelr.modelbuilder.body(pad, margin, left, right, traces, layers)[source]

Makes a 3 layer earth model with the slabs defined by the user parameters.

Parameters:
  • pad – The amount of samples before the first interface. Essentially the thickness of the first layer.
  • margin – The symmetric bottom vertices for the slab. For example, a value of zero would be vertices at the first and last trace, a value of traces/2 would put a vertex in the center, making a triangular shape. Anything in between is trapezoidal.
  • left – The depths of the wedge interface at the left edge of the plot. A two element tuple(d1,d2) whose difference defines the thickness of the wedge at the left edge.
  • right – The depths of the wedge interface at the right edge of the plot. A two element tuple(d1,d2) whose difference defines the thickness of the wedge at the right edge.
  • traces – The number of traces to use in the model.
  • layers – An array/list/tuple of RGB values that will be mapped to each layer. Indexed as (top, slab, bottom) as RGB values ((R,G,B),(R,G,B), (R,G,B) ).
Returns:

A numpy array of RGB values for the earth model.

modelr.modelbuilder.body_svg(pad, margin, left, right, traces, layers)[source]

Makes a body. Used for tilted slabs and wedges. Give it pad, left and right thickness, traces, and an iterable of layers. Returns an SVG file name.

Parameters:
  • pad – The amount of samples before the first interface. Essentially the thickness of the first layer.
  • margin – The symmetric bottom vertices for the slab. For example, a value of zero would be vertices at the first and last trace, a value of traces/2 would put a vertex in the center, making a triangular shape. Anything in between is trapezoidal.
  • left – The depths of the wedge interface at the left edge of the plot. A two element tuple(d1,d2) whose difference defines the thickness of the wedge at the left edge.
  • right – The depths of the wedge interface at the right edge of the plot. A two element tuple(d1,d2) whose difference defines the thickness of the wedge at the right edge.
  • traces – The number of traces to use in the model.
  • layers – An array/list/tuple of RGB values that will be mapped to each layer. Indexed as (top, slab, bottom) as RGB values ((R,G,B),(R,G,B), (R,G,B) ).
Returns:

a tempfile object holding the output svg filename.

modelr.modelbuilder.channel(pad, thickness, traces, layers)[source]

Makes a rounded channel. Give it pad, thickness, traces, and an iterable of layers. Returns an SVG file.

Parameters:
  • pad – The number (n) of points on top of the channel.
  • traces – The number of traces in the channel model.
  • layers – An 3X3 array or tuple of RGB values corresponding to each rock layer. ((R,G,B),(R,G,B),(R,G,B)). Indexed as (top, channel, bottom ).
Param:

thickness: The radius of the channel (npoints).

Returns:

a numpy array of the RGB values for the data model.

modelr.modelbuilder.channel_svg(pad, thickness, traces, layers)[source]

Makes a rounded channel. Give it pad, thickness, traces, and an iterable of layers. Returns an SVG file.

Parameters:
  • pad – The number (n) of points on top of the channel.
  • traces – The number of traces in the channel model.
  • layers – An 3X3 array or tuple of RGB values corresponding to each rock layer. ((R,G,B),(R,G,B),(R,G,B)). Indexed as (top, channel, bottom ).
Param:

thickness: The radius of the channel (npoints).

Returns:

a tempfile object pointed to the model svg file.

modelr.modelbuilder.png2array(infile)[source]

Turns a PNG into a numpy array.

Parameters:infile – Path to PNG file
Returns:a NumPy array.
modelr.modelbuilder.svg2array(infile, layers)[source]

Wrapper for svg2png and png2array.

Parameters:
  • infile – File object output from tempfile.NamedTemporaryFile containing the path to the SVG file.
  • layers – An array or tuple of RGB values allowed in the output PNG. Should correspond to the number of rocks used in the SVG earth model. ((R,G,B),(R,G,B,))
Returns:

a numpy array of the RGB levels from the svg.

modelr.modelbuilder.svg2png(infile, layers)[source]

Convert an SVG file to PNG file. Uses calls to Imagemagick for the conversion.

Parameters:
  • infile – File object output from tempfile.NamedTemporaryFile containing the path to the SVG file.
  • layers – An array or tuple of RGB values allowed in the output PNG. Should correspond to the number of rocks used in the SVG earth model. ((R,G,B),(R,G,B,))
Returns:

a tempfile.NamedTemporaryFile containing the png of the of the model.

modelr.modelbuilder.web2array(url, colours)[source]

Given a URL string, make an SVG or PNG on the web into a NumPy array.

Parameters:
  • url – The url path to the SVG or PNG image.
  • colours – An array or tuple of RGB values allowed in the image ((R,G,B),(R,G,B), ....). Should map to the rocks in the model.

Returns an array of RGB values.

Table Of Contents

Previous topic

Web Framework

Next topic

Scientific Code

This Page