Pynoddy modules, classes and functions¶
Basic modules (low-level access)¶
The modules in this section provide low-level access to the functionality in Noddy. Basically, these modules provide parsers for Noddy input and output files and class definitions for suitable Noddy elements.
Main module¶
Package initialization file for pynoddy
-
pynoddy.
compute_model
(history, output_name, **kwds)[source]¶ Call Noddy and compute the history file
- Arguments:
- history = string : filename of history file
- output_name = string : basename for output files
- Optional Keywords:
- sim_type = ‘BLOCK’, ‘GEOPHYSICS’, ‘SURFACES’, ‘BLOCK_GEOPHYS’,
- ‘TOPOLOGY’, ‘BLOCK_SURFACES’, ‘ALL’:
- type of Noddy simulation (default: ‘BLOCK’)
- program_name = string : name of program
(default: noddy.exe or noddy, both checked)
verbose = bool: verbose mode, print out information for debugging (default = False)
- Returns:
- -Returns any text outputted by the noddy executable.
-
pynoddy.
compute_topology
(rootname, **kwds)[source]¶ Call the topology executable to compute a models topology.
- Arguments:
- rootname = string : rootname of the noddy model to calculate topology for
- Optional Keywords:
- ensure_discrete_volumes = True if topological units are broken down into
separate, spatially continuous volumes. Otherwise some topological units may represent two separate rock volumes (eg. if a folded unit has been truncated by an unconformity). Default is True, though this is a global variable (pynoddy.ensure_discrete_volumes) so it can be changed during runtime.
- null_volume_threshold = The smallest non-null volume. volumes smaller than this are
ignored by the topology algorithm (as they represent pixelation artefacts). The default is 20 voxels, though this is a global variable and can be changed with pynoddy.null_volume_threshold.
- Returns
- -Returns any text outputted by the topology executable, including errors.
History file parser: pynoddy.history¶
Noddy history file wrapper Created on 24/03/2014
@author: Florian Wellmann
-
class
pynoddy.history.
NoddyHistory
(history=None, **kwds)[source]¶ Bases:
object
Class container for Noddy history files
-
add_event
(event_type, event_options, **kwds)[source]¶ Add an event type to history
- Arguments:
- event_type = string : type of event, legal options to date are:
‘stratigraphy’, ‘fault’, ‘fold’, ‘unconformity’ - event_options = list : required options to create event (event dependent)
- Optional keywords:
- event_num = int : event number (default: implicitly defined with increasing counter)
-
change_cube_size
(cube_size, **kwds)[source]¶ Change the model cube size (isotropic)
- Arguments:
- cube_size = float : new model cube size
-
change_event_params
(changes_dict)[source]¶ Change multiple event parameters according to settings in changes_dict
- Arguments:
- changes_dict = dictionary : entries define relative changes for (multiple) parameters
Per default, the values in the dictionary are added to the event parameters.
Create model footer (with all settings) from template
-
determine_events
(**kwds)[source]¶ Determine events and save line numbers
Note
- Parsing of the history file is based on a fixed Noddy output order.
- If this is, for some reason (e.g. in a changed version of Noddy) not the case, then this parsing might fail!
- Optional Keywords:
- verbose = True if this function is should write to the print bufffer, otherwise False. Default is False.
-
get_cube_size
(**kwds)[source]¶ Determine cube size for model export Optional Args
-type: choose geology or geophysics cube size to return. Should be either ‘Geology’ (default) or ‘Geophysics’
-
get_drillhole_data
(x, y, **kwds)[source]¶ Get geology values along 1-D profile at position x,y with a 1 m resolution
The following steps are performed: 1. creates a copy of the entire object, 2. sets values of origin, extent and geology cube size, 3. saves model to a temporary file, 4. runs Noddy on that file 5. opens and analyses output 6. deletes temporary files
Note: this method only works if write access to current directory is enabled and noddy can be executed!
- Arguments:
- x = float: x-position of drillhole
- y = float: y-position of drillhole
- Optional Arguments:
- z_min = float : minimum depth of drillhole (default: model range)
- z_max = float : maximum depth of drillhole (default: model range)
- resolution = float : resolution along profile (default: 1 m)
-
get_event_param
(event_number, name)[source]¶ Returns the value of a given parameter for a given event.
- Arguments:
- event_number = the event to get a parameter for (integer)
- name = the name of the parameter to retreive (string)
- Returns
- Returns the value of the request parameter, or None if it does not exists.
-
get_event_params
(event_number)[source]¶ Returns the parameter dictionary for a given event.
- Arguments:
- event_number = the event to get a parameter for (integer)
- Returns
- Returns the parameter dictionary for the requested event
-
get_extent
()[source]¶ Get model extent and return and store in local variables
Returns: (extent_x, extent_y, extent_z)
Get the footer lines from self.history_lines
The footer contains everything below events (all settings, etc.)
-
get_info_string
(**kwds)[source]¶ Get model information as string
- Optional keywords:
- events_only = bool : only information on events
-
get_origin
()[source]¶ Get coordinates of model origin and return and store in local variables
Returns: (origin_x, origin_y, origin_z)
-
info
(**kwds)[source]¶ Print out model information
- Optional keywords:
- events_only = bool : only information on events
-
load_history
(history)[source]¶ Load Noddy history
- Arguments:
- history = string : Name of Noddy history file
-
load_history_from_url
(url)[source]¶ Directly load a Noddy history from a URL
This method is useful to load a model from the Structural Geophysics Atlas on the pages of the Virtual Explorer. See: http://tectonique.net/asg
- Arguments:
- url : url of history file
-
reorder_events
(reorder_dict)[source]¶ Reorder events accoring to assignment in reorder_dict
- Arguments:
- reorder_dict = dict : for example {1 : 2, 2 : 3, 3 : 1}
-
set_event_params
(params_dict)[source]¶ set multiple event parameters according to settings in params_dict
- Arguments:
- params_dict = dictionary : entries to set (multiple) parameters
-
set_extent
(extent_x, extent_y, extent_z)[source]¶ Set model extent and update local variables
- Arguments:
- extent_x = float : extent in x-direction
- extent_y = float : extent in y-direction
- extent_z = float : extent in z-direction
-
set_origin
(origin_x, origin_y, origin_z)[source]¶ Set coordinates of model origin and update local variables
- Arguments:
- origin_x = float : x-location of model origin
- origin_y = float : y-location of model origin
- origin_z = float : z-location of model origin
-
Output file parser: pynoddy.output¶
Noddy output file analysis Created on 24/03/2014
@author: Florian Wellmann, Sam Thiele
-
class
pynoddy.output.
NoddyGeophysics
(output_name)[source]¶ Bases:
object
Definition to read, analyse, and visualise calculated geophysical responses
-
class
pynoddy.output.
NoddyOutput
(output_name)[source]¶ Bases:
object
Class definition for Noddy output analysis
-
determine_unit_volumes
()[source]¶ Determine volumes of geological units in the discretized block model
-
export_to_vtk
(**kwds)[source]¶ Export model to VTK
Export the geology blocks to VTK for visualisation of the entire 3-D model in an external VTK viewer, e.g. Paraview.
..Note:: Requires pyevtk, available for free on: https://github.com/firedrakeproject/firedrake/tree/master/python/evtk
- Optional keywords:
- vtk_filename = string : filename of VTK file (default: output_name)
- data = np.array : data array to export to VKT (default: entire block model)
-
get_section_lines
(direction='y', position='center', **kwds)[source]¶ Create and returns a list of lines representing a section block through the model
- Arguments:
direction = ‘x’, ‘y’, ‘z’ : coordinate direction of section plot (default: ‘y’)
- position = int or ‘center’ : cell position of section as integer value
or identifier (default: ‘center’)
Returns: A tuple of lists of dictionaries.... ie: ( [ dictionary of x coordinates, with lithology pairs as keys, separated by an underscore],
[ dictionary of y coordinates, with lithology pairs as keys, separated by an underscore], [ dictionary of z coordinates, with lithology pairs as keys, separated by an underscore], [ dictionary of colours, with lithologies as keys])For example: get_section_lines()[0][“1_2”] returns a list of all the x coordinates from the contact between lithology 1 and lithology 2. Note that the smaller lithology index always comes first in the code.
-
get_section_voxels
(direction='y', position='center', **kwds)[source]¶ Create and returns section block through the model
- Arguments:
direction = ‘x’, ‘y’, ‘z’ : coordinate direction of section plot (default: ‘y’)
- position = int or ‘center’ : cell position of section as integer value
or identifier (default: ‘center’)
- Optional Keywords:
- data = np.array : data to plot, if different to block data itself
- litho_filter = a list of lithologies to draw. All others will be ignored.
-
get_surface_grid
(lithoID, **kwds)[source]¶ Returns a grid of lines that define a grid on the specified surface. Note that this cannot handle layers that are repeated in the z direction...
- Arguments:
- lithoID - the top surface of this lithology will be calculated. If a list is passed,
the top surface of each lithology in the list is calculated.
- Keywords:
- res - the resolution to sample at. Default is 2 (ie. every second voxel is sampled).
- Returns:
- a tuple containing lists of tuples of x, y and z coordinate dictionaries and colour dictionaries, one containing the east-west lines and one the north-south lines: ((x,y,z,c),(x,y,z,c)). THe dictionary keys are the lithoID’s passed in the lithoID parameter.
-
plot_section
(direction='y', position='center', **kwds)[source]¶ Create a section block through the model
- Arguments:
direction = ‘x’, ‘y’, ‘z’ : coordinate direction of section plot (default: ‘y’)
- position = int or ‘center’ : cell position of section as integer value
or identifier (default: ‘center’)
- Optional Keywords:
ax = matplotlib.axis : append plot to axis (default: create new plot)
figsize = (x,y) : matplotlib figsize
colorbar = bool : plot colorbar (default: True)
- colorbar_orientation = ‘horizontal’ or ‘vertical’ : orientation of colorbar
(default: ‘vertical’)
title = string : plot title
savefig = bool : save figure to file (default: show directly on screen)
cmap = matplotlib.cmap : colormap (default: YlOrRd)
fig_filename = string : figure filename
ve = float : vertical exaggeration
layer_labels = list of strings: labels for each unit in plot
layers_from = noddy history file : get labels automatically from history file
data = np.array : data to plot, if different to block data itself
litho_filter = a list of lithologies to draw. All others will be ignored.
-
-
class
pynoddy.output.
NoddyTopology
(noddy_model, **kwds)[source]¶ Bases:
object
Definition to read, analyse, and visualise calculated voxel topology
-
calculate_difference
(G2, data=False)[source]¶ Calculates the difference between this NoddyTopology and another NoddyTopology or networkX graph
- Arguments
- G2 = a valid NoddyTopology object or NetworkX graph that this topology is to be compared with
- Returns
- A tuple containing: - The number of different edges - a list of these edges
-
calculate_overlap
(G2)[source]¶ Calculates the overlap between this NoddyTopology and another NoddyTopology or networkX graph
- Arguments
- G2 = a valid NoddyTopology object or NetworkX graph that this topology is to be compared with
- Returns
- The number of overlapping edges
- A list of these edges
-
static
calculate_unique_topologies
(topology_list, **kwds)[source]¶ Calculates the number of unique topologies in a list of NoddyTopologies
- Arguments:
- topology_list = The list of NoddyTopologies to search through.
- Optional Keywords:
output = A File or list to write cumulative observed topologies distribution. Default is None (nothing written).
- ids = A list to write the unique topology id’s for each topology in the provided topology_list (in that
order). Default is None.
frequency = A list to write frequency counts to.
- Returns:
- Returns a list of unique topologies.
-
collapse_stratigraphy
()[source]¶ Collapses all stratigraphic edges in this network to produce a network that only contains structurally bound rock volumes. Essentially this is a network built only with Topology codes and ignoring lithology
- Returns
- a new NoddyTopology object containing the collapsed graph. The original object is not modified.
-
collapse_structure
(verbose=False)[source]¶ Collapses all topology codes down to the last (most recent) difference. Information regarding specific model topology is generalised, eg. lithology A has a fault and stratigrappic contact with B (regardless of how many different faults are involved).
- Optional Arguments:
- verbose = True if this function should write to the print buffer. Default is False.
- Returns
- a new NoddyTopology object containing the collapsed graph. The original object is not modified.
-
static
combine_topologies
(topology_list)[source]¶ Combines a list of topology networks into a weighted ‘super-network’. This is designed for estimating the likelyhood of a given edge occuring using a series of networks generated in a Monte-Carlo type analysis.
- Arguments
- topology_list = A list of networkX graphs or NoddyTopology objects to build supernetwork from.
- Returns
- A NetworkX graph object containing all edges from the input graphs and weighted (‘weight’ parameter) according to their observed frequency.
-
draw_3d_network
(**kwds)[source]¶ Draws a 3D network using matplotlib.
- Optional Keywords:
- show = If True, the 3D network is displayed immediatly on-screen in an
interactive matplotlib viewer. Default is True.
output = If defined an image of the network is saved to this location.
node_size = The size of the nodes. Default is 40.
geology = a NoddyOutput object to draw with the network
res = resolution to draw geology at. Default is 4 (ie 1/4 of all voxels are drawn)
- horizons = a list of geology surfaces to draw. Default is nothing (none drawn). Slow!
See NoddyOutput.get_surface_grid for details.
sections = draw geology sections. Default is True.
-
draw_adjacency_matrix
(**kwds)[source]¶ Draws an adjacency matrix representing this topology object.
- Keywords:
- path = The path to save this image to. If not provided, the image is drawn to the screen
- dpi = The resolution to save this image. Default is 300
- size = The size of the image to save (in inches). This value will be used as the width and the height
-
draw_difference_matrix
(G2, **kwds)[source]¶ Draws an adjacency matrix containing the difference between this topology and the provided topology
- Arguments:
- G2 = A different NoddyTopology or NetworkX Graph to compare to
- Optional Keywords:
- strat = A dictionary linking node names to stratigraphic heights and names. Should be as follows { node_name : (height,name) }.
- path = The path to save this image to. If not provided, the image is drawn to the screen
- dpi = The resolution to save this image. Default is 300
- size = The size of the image to save (in inches). This value will be used as the width and the height
-
static
draw_graph_matrix
(G, **kwds)[source]¶ Draws an adjacency matrix representing the specified graph object. Equivalent to NoddyTopology.draw_matrix_image() but for a networkX graph object.
- Keywords:
- strat = A dictionary linking node names to stratigraphic heights and names. Should be as follows { node_name : (height,name) }.
- path = The path to save this image to. If not provided, the image is drawn to the screen
- dpi = The resolution to save this image. Default is 300
- size = The size of the image to save (in inches). This value will be used as the width and the height
-
draw_mayavi
(**kwds)[source]¶ Draws this network with mayavi. This requires the Mayavi python library (mayavi.mlab)
- Optional Keywords:
- node_size = The size of the nodes. Default is 40.
- edge_thickness = The thickness of the edges. Default is 4
- show = If true, the model is displayed in the mayavi viewer after exporting. Default is True
- path = A path to save the mayavi vtk file to after generating it.
-
static
draw_mayavi_graph
(G, **kwds)[source]¶ Draws the provided network with mayavi. This requires the Mayavi python library (mayavi.mlab)
- Optional Keywords:
- node_size = The size of the nodes. Default is 40.
- edge_thickness = The thickness of the edges. Default is 4
- show = If true, the model is displayed in the mayavi viewer after exporting. Default is True
- path = A path to save the mayavi vtk file to after generating it.
-
draw_network_hive
(**kwds)[source]¶ Draws a network hive plot (see https://github.com/ericmjl/hiveplot). The axes of the hive are: node lithology, edge age & edge area.
ie. the top axis lists the nodes in stratigraphic order. The second axis lists edges in structural age & thrid axis lists edges by surface area.
Nodes are joined to edge-nodes by lines on the graph if they are topologically linked (ie. if an edge has that node as an end point).
Optional Keywords - path = the path to save this figure - dpi = the resolution of the figure - bg = the background color. Default is black. - axes = The color of the axes and labels.
-
draw_network_image
(outputname='', **kwds)[source]¶ Draws a network diagram of this NoddyTopology to the specified image
- Arguments
- outputname = the path of the image being written. If left as ‘’ the image is written to the same directory as the basename.
- Optional Keywords
dimension = ‘2D’ for a 2D network diagram or ‘3D’ for a 3D network diagram. Default is ‘2D’.
axis = the axis to view on for 3D network diagrams
perspective = True to use perspective projection, or False for orthographic projection. Default is False.
node_size = The size that nodes are drawn. Default is 1500.
- layout = The layout algorithm used in 2D. Options are ‘spring_layout’ (default), ‘shell_layout’, ‘circular_layout’
and ‘spectral_layout’.
verbose = True if this function is allowed to write to the print buffer, otherwise false. Default is False.
-
filter_node_volumes
(min_volume=50)[source]¶ Removes all nodes with volumes less than the specified size
- Arguments:
- min_volume = the threshold volume. Nodes with smaller volumes are deleted.
- Returns
- returns the number of deleted nodes
-
find_first_match
(known)[source]¶ Identical to is_unique, except that the index of the first match is returned if this matches, otherwise -1 is returned. Arguments:
-known = a list of valid NoddyTopology objects or NetworkX graphs to compare with.- Returns:
- Returns the index of the first matching topology object, or -1
-
find_matching
(known)[source]¶ Finds the first matching NoddyTopology (or NetworkX graph) in the specified list
- Arguments:
- -known = a list of valid NoddyTopology objects or NetworkX graphs to compare with.
- Returns:
- Returns the first matching object (jaccard coefficient = 1), or otherwise None
-
is_unique
(known)[source]¶ Returns True if the topology of this model is different (ie. forms a different network) to a list of models.
- Arguments:
- -known = a list of valid NoddyTopology objects or NetworkX graphs to compare with.
- Returns:
- Returns true if this topology is unique, otherwise false
-
jaccard_coefficient
(G2)[source]¶ Calculates the Jaccard Coefficient (ratio between the intersection & union) of the graph representing this NOddyTopology and G2.
- Arguments
- G2 = a valid NoddyTopology object or NetworkX graph that this topology is to be compared with
- Returns
- The jaccard_coefficient
-
write_summary_file
(path, append=True)[source]¶ Writes summary information about this network to a file
- Optional Arguments
- append = True if summary information should be appended to the file. If so the file is written as a csv spreadsheet.
Default is true. If False is passed, a single, detailed summary is written for this network.
-
Additional useful classes¶
pynoddy.events¶
Module for reading and manipulating geological events Created on Mar 26, 2014
@author: Florian Wellmann
-
class
pynoddy.events.
Dyke
(**kwds)[source]¶ Bases:
pynoddy.events.Event
Dyke event
-
class
pynoddy.events.
Event
(**kwds)[source]¶ Bases:
object
Main class container for geological events
Include here all elements that events have in common (position, etc. - possibly even things like color and other aspects that are defined in the history... Parse for equal settings and include here!)
-
class
pynoddy.events.
Fault
(**kwds)[source]¶ Bases:
pynoddy.events.Event
Fault event
-
class
pynoddy.events.
Fold
(**kwds)[source]¶ Bases:
pynoddy.events.Event
Folding event
-
class
pynoddy.events.
Plug
(**kwds)[source]¶ Bases:
pynoddy.events.Event
Plug event
-
class
pynoddy.events.
Shear
(**kwds)[source]¶ Bases:
pynoddy.events.Event
Shear zone event
-
class
pynoddy.events.
Strain
(**kwds)[source]¶ Bases:
pynoddy.events.Event
Strain event
-
class
pynoddy.events.
Stratigraphy
(**kwds)[source]¶ Bases:
pynoddy.events.Event
Sedimentary pile with defined stratigraphy
-
class
pynoddy.events.
Tilt
(**kwds)[source]¶ Bases:
pynoddy.events.Event
Tilt event
-
class
pynoddy.events.
Unconformity
(**kwds)[source]¶ Bases:
pynoddy.events.Event
Unconformity event
-
change_height
(val)[source]¶ Change the vertical position (i.e. height) of the entire stratigraphic pile above the unconformity
Note
This is not identical to changing only the ‘Z’ property as the height of all layers has to be adjusted for (geological) consistency
- Arguments:
- val = float : value added to current z-values
-
Modules for Kinematic experiments¶
The modules described in this section are designed to provide a high-level access to the kinematic modelling functionality in Noddy. The modules encapsulate the required aspects of complete experiments, including input file generation, adaptation of parameters, random number generation, model computation, and postprocessing.
Base classes for pynoddy experiments¶
The base class for any type of experiments is defined in the pynoddy.experiment module.
Base class from which PyNoddy experiments should inherit.
Much basic functionality (random perturbation, plotting etc. is defined here).
Thought: perhaps drawing functions etc. should be moved into NoddyOutput class?
@author: flohorovicic, samthiele
-
class
pynoddy.experiment.
Experiment
(history=None, **kwds)[source]¶ Bases:
pynoddy.history.NoddyHistory
,pynoddy.output.NoddyOutput
Noddy experiment container, inheriting from both noddy history and output methods
-
export_to_vtk
(**kwds)[source]¶ Export model to VTK
Export the geology blocks to VTK for visualisation of the entire 3-D model in an external VTK viewer, e.g. Paraview.
..Note:: Requires pyevtk, available for free on: https://github.com/firedrakeproject/firedrake/tree/master/python/evtk
- Optional keywords:
- vtk_filename = string : filename of VTK file (default: output_name)
- data = np.array : data array to export to VKT (default: entire block model)
- recompute = bool : recompute the block model (default: True)
- model_type = ‘current’, ‘base’ : model type (base “freezed” model can be plotted for comparison)
..Note:: If data is defined, the model is not recomputed and the data from this array is plotted
-
freeze
(**kwds)[source]¶ Freeze the current model state: store the event settings for later comparison
-
get_sampling_line_data
(xyz_from, xyz_to)[source]¶ Get computed model along a line, for example as a drillhole position
- Arguments:
- xyz_from = [x, y, z] : list of float values for starting position
- xyz_to = [x, y, z] : list of float values for starting position
-
get_section
(direction='y', position='center', **kwds)[source]¶ Get geological section of the model (re-computed at required resolution) as noddy object
- Arguments:
direction = ‘x’, ‘y’, ‘z’ : coordinate direction of section plot (default: ‘y’)
- position = int or ‘center’ : cell position of section as integer value
or identifier (default: ‘center’)
- Optional arguments:
- resolution = float : set resolution for section (default: self.cube_size)
- model_type = ‘current’, ‘base’ : model type (base “freezed” model can be plotted for comparison)
- compute_output = bool : provide output from command line call (default: True)
-
is_up_to_date
¶ Model state
-
load_parameter_file
(filename, **kwds)[source]¶ Load parameter statistics from external csv file
The csv file should contain a header row with the relevant keywords identifying columns. In order to be read in correctly, the header should contain the labels:
- ‘event’ : event id
- ‘parameter’ : Noddy parameter (‘Dip’, ‘Dip Direction’, etc.)
- ‘mean’ : mean parameter value
- ‘type’ = ‘normal’, ‘vonmises’ or ‘uniform’.
In addition, it is necessary to define PDF type and parameters. For now, the following settings are supported: - ‘+-‘ = Defines the 2.5th and 97.5th percentiles of the distribution,
similar to a 95% confidence interval.- ‘stdev’ = standard deviation. Only works if type=’normal’.
- ‘min’ = The minimum value of a uniform distribution (if type=’uniform’)
- ‘max’ = The maximum value of a uniform distribution (if type=’uniform’)
- Arguments:
- filename = string : filename
- Optional arguments:
- delim = string : delimiter (default: ‘,’ or ‘;’, both checked)
-
plot_section
(direction='y', position='center', **kwds)[source]¶ Extended version of plot_section method from pynoddy.output class
- Arguments:
direction = ‘x’, ‘y’, ‘z’ : coordinate direction of section plot (default: ‘y’)
- position = int or ‘center’ : cell position of section as integer value
or identifier (default: ‘center’)
- Optional Keywords:
ax = matplotlib.axis : append plot to axis (default: create new plot)
figsize = (x,y) : matplotlib figsize
colorbar = bool : plot colorbar (default: True)
- colorbar_orientation = ‘horizontal’ or ‘vertical’ : orientation of colorbar
(default: ‘vertical’)
title = string : plot title
savefig = bool : save figure to file (default: show directly on screen)
cmap = matplotlib.cmap : colormap (default: YlOrRd)
fig_filename = string : figure filename
ve = float : vertical exaggeration
layer_labels = list of strings: labels for each unit in plot
layers_from = noddy history file : get labels automatically from history file
resolution = float : set resolution for section (default: self.cube_size)
model_type = ‘current’, ‘base’ : model type (base “freezed” model can be plotted for comparison)
data = np.array : data to plot, if different to block data itself
-
random_draw
(**kwds)[source]¶ Perform a random draw for parameter distributions as defined, and calculate model
This method is based on the model “base-state”, and not the current state (as opposed to the self.random_perturbation() method).
- Optional Keywords:
- verbose = bool: print out parameter changes as they happen (default: False)
- store_params = bool : store random parameter set (default: True)
-
random_perturbation
(**kwds)[source]¶ Perform a random perturbation of the model according to parameter statistics defined in self.param_stats.
Note that by default, this function is identical to random_draw. If model_type is set to ‘current’, then parameters are varied according using the current values as distribution means - this allows ‘random walk’ away from the initial model state, which is usually not desired.
- Optional arguments:
store_params = bool : store random parameter set (default: True)
verbose = bool: print out parameter changes as they happen (default: False)
- model_type = ‘base’, ‘current’ : perturb on basis of current model,
or use base model (default: ‘base’ model)
-
reset_random_seed
()[source]¶ Reset random seed to defined value (stored in self.seed, set with self.set_random_seed)
-
set_parameter_statistics
(param_stats)[source]¶ Define parameter statistics for uncertainty simulation and sensitivity analysis
param_stats = list : list with relevant statistics defined for event parameters list is organised as: param_stats[event_id][parameter_name][stats_type] = value
Example: param_stats[2][“Dip”][“min”] = 200.
- Possible statistics are:
- min = float : minimum bound
- max = float : maximum bound
- type = ‘normal’, ‘uniform’ : distribution type
- stdev = float : standard deviation (if normal distribution)
-
set_random_seed
(random_seed)[source]¶ Set random seed for reproducible experiments
- Arguments:
- random_seed = int (or array-like) : define seed
-
MonteCarlo class¶
This class provides the basic functionality to perform MonteCarlo error propagation experiments with Noddy.