BayesISOLA documentation

BayesISOLA is an open-source module for Python for solution of seismic source inverse problem. It uses the point source approximation and describes the source in terms of centroid moment tensor.

Copyright: Jiří Vackář
Version: developer’s snapshot 2016-09-13
License: GNU Lesser General Public License, Version 3 (



The used method is described in the following paper: Vackář, Gallovič, Burjánek, and Zahradník, Bayesian ISOLA: new tool for automated centroid moment tensor inversion, submitted. PDF

Important note

The code is still under development. We would be very happy for your feedback.


  • NumPy: Fundamental package for scientific computing with Python.
  • matplotlib: Python 2D plotting library which produces publication quality figures in a variety of hardcopy formats and interactive.
  • ObsPy: Python framework for processing seismological data.
  • SciPy: Python-based ecosystem of open-source software for mathematics, science, and engineering.
  • pyproj: Python interface to PROJ4 library for cartographic transformations
  • psycopg2: PostgreSQL adapter for the Python programming language.
  • other modules: math, subprocess, shutil, multiprocessing, re, fractions, warnings, os
  • own module (part of the package): MouseTrap



  • Download the example bellow
  • Unzip to a folder
  • Compile files green/gr_xyz.for and green/elemse.for with a Fortran compiler (tested with ifort), the binaries should be at green/gr_xyz and green/elemse, respectively.
  • Try to run src/ (Example 1) or src/ (Example 2)


Example 1: SAC files

Find a centroid moment tensor for a Corinth Gulf (Greece) Apr 25, 2012 earthquake (Sokos and Zahradník, SRL, 2013). Network configuration is described in file network.stn, event information are in event.isl, crustal model in crustal.dat, and waveforms are in form of SAC files.

Download: example directory (zip) and desired output (zip)

Example 2: SAC files with covariance matrix

Find a centroid moment tensor for Sargans (St. Gallen, Switzerland) Dec 12, 2013 earthquake. Network configuration is described in file network.stn, event information are in event.isl, crustal model in crustal.dat, and waveforms are in form of SAC files.

Download: example directory (zip) and desired output (zip)

Function summary

ISOLA([location_unc, depth_unc, time_unc, ...]) Class for moment tensor inversion.
ISOLA.log(s[, newline, printcopy]) Write text into log file
ISOLA.read_crust(source[, output]) Copy a file or files with crustal model definition to location where code Axitra expects it
ISOLA.read_event_info(filename) Read event coordinates, magnitude, and time from a file in specified format (see below)
ISOLA.set_event_info(lat, lon, depth, mag, t) Sets event coordinates, magnitude, and time from parameters given to this function
ISOLA.read_network_info_DB(db, host[, port, ...]) Reads station coordinates from SeisComp3 database.
ISOLA.read_network_coordinates(filename[, ...]) Read informations about stations from file in ISOLA format.
ISOLA.create_station_index() Creates self.stations_index which serves for accesing self.stations items by the station name.
ISOLA.write_stations([filename]) Write file with carthesian coordinates of stations.
ISOLA.add_NEZ(filename, network, station, ...) Read stream from four column file (t, N, E, Z) (format used in ISOLA).
ISOLA.add_SAC(filename[, filename2, filename3]) Reads data from SAC.
ISOLA.load_files([dir, prefix, suffix, ...]) Loads SAC files from specified directory.
ISOLA.load_streams_ArcLink(host[, user, ...]) Loads waveform from ArcLink server for stations listed in self.stations.
ISOLA.check_a_station_present() Checks whether at least one station is present, otherwise raises error.
ISOLA.detect_mouse([mouse_len, mouse_onset, ...]) Wrapper for MouseTrap
ISOLA.set_frequencies(fmax[, fmin, wavelengths]) Sets frequency range for each station according its distance.
ISOLA.count_components([log]) Counts number of components, which should be used in inversion (e.g.
ISOLA.correct_data() Corrects self.data_raw for the effect of instrument.
ISOLA.trim_filter_data([noise_slice, ...]) Filter self.data_raw using function prefilter_data() and my_filter().
ISOLA.covariance_matrix([crosscovariance, ...]) Creates covariance matrix C_D from self.noise.
ISOLA.prefilter_data(st) Drop frequencies above Green’s function computation high limit using numpy.fft.fft().
ISOLA.decimate_shift() Generate self.data_shifts where are multiple copies of (needed for plotting).
ISOLA.set_working_sampling([multiple8]) Determine maximal working sampling as at least 8-multiple of maximal inverted frequency (self.fmax).
ISOLA.min_time(distance[, mag, v]) Defines the beginning of inversion time window in seconds from location origin time.
ISOLA.max_time(distance[, mag, v]) Defines the end of inversion time window in seconds from location origin time.
ISOLA.set_time_window() Determines number of samples for inversion (self.npts_slice) and for Green’s function calculation (self.npts_elemse and self.npts_exp) from self.min_time and self.max_time.
ISOLA.set_Greens_parameters() Sets parameters for Green’s function calculation:
ISOLA.write_Greens_parameters() Writes file grdat.hed - parameters for gr_xyz (Axitra)
ISOLA.verify_Greens_parameters() Check whetrer parameters in file grdat.hed (probably used in Green’s function calculation) are the same as used now.
ISOLA.verify_Greens_headers() Checked whether elementary-seismogram-metadata files (created when the Green’s functions were calculated) agree with curent grid points positions.
ISOLA.calculate_or_verify_Green() If self.use_precalculated_Green is True, verifies whether the pre-calculated Green’s functions were calculated on the same grid and with the same parameters (verify_Greens_headers() and verify_Greens_parameters()) Otherwise calculates Green’s function (write_Greens_parameters() and calculate_Green()).
ISOLA.set_grid([min_depth]) Generates grid self.grid of points, where the inverse problem will be solved.
ISOLA.set_time_grid() Sets equidistant time grid defined by self.shift_min, self.shift_max, and self.shift_step (in seconds).
ISOLA.calculate_Green() Runs Green_wrapper() (Green’s function calculation) in parallel.
ISOLA.run_inversion() Runs function invert() in parallel.
ISOLA.find_best_grid_point() Set self.centroid to a grid point with higher variance reduction – the best solution of the inverse problem.
ISOLA.print_solution() Write into log the best solution self.centroid.
ISOLA.print_fault_planes([precision, tool]) Decompose the moment tensor of the best grid point by decompose() and writes the result to the log.
ISOLA.plot_MT([outfile, facecolor]) Plot the beachball of the best solution self.centroid.
ISOLA.plot_uncertainty([outfile, n, ...]) Generates random realizations based on the calculated solution and its uncertainty and plots these mechanisms and histograms of its parameters.
ISOLA.plot_maps([outfile, beachball_size_c]) Plot figures showing how the solution is changing across the grid.
ISOLA.plot_slices([outfile, point, ...]) Plot vertical slices through the grid of solutions in point point.
ISOLA.plot_maps_sum([outfile]) Plot map and vertical slices through the grid of solutions showing the posterior probability density function (PPD).
ISOLA.plot_map_backend(x, y, s, CN, MT, ...) The plotting back-end for functions plot_maps(), plot_slices() and plot_maps_sum().
ISOLA.plot_3D([outfile]) Creates an animation with the grid of solutios.
ISOLA.plot_seismo([outfile, comp_order, ...]) Plots the fit between observed and simulated seismogram.
ISOLA.plot_covariance_function([outfile, ...]) Plots the covariance functions on whose basis is the data covariance matrix generated
ISOLA.plot_noise([outfile, comp_order, ...]) Plots the noise records from which the covariance matrix is calculated together with the inverted data
ISOLA.plot_stations([outfile, network, ...]) Plot a map of stations used in the inversion.
ISOLA.plot_covariance_matrix([outfile, ...]) Plots figure of the data covariance matrix C_D.
next_power_of_2(n) Return next power of 2 greater than or equal to n
lcmm(b, *args) Returns generelized least common multiple.
a2mt(a[, system]) Convert the coefficients of elementary seismograms to moment tensor components.
decompose(mt) Decomposition of the moment tensor using eigenvalues and eigenvectors according to paper Vavrycuk, JoSE.
histogram(data[, outfile, bins, range, ...]) Plots a histogram of a given data.
my_filter(data, fmin, fmax) Filter used for filtering both elementary and observed seismograms
decimate(a[, n]) Decimates given sequence.
read_elemse(nr, npts, filename, stations) Reads elementary seismograms file generated by code Axitra.
attach_ISOLA_paz(tr, paz_file) Attaches to a trace a paz AttribDict containing poles zeros and gain.
Green_wrapper(i, model, x, y, z, npts_exp, ...) Evaluate Green’s function using code Axitra (programs gr_xyz and elemse) in a given grid point.
invert(point_id, d_shifts, norm_d, Cd_inv, ...) Solves inverse problem in a single grid point for multiple time shifts.

Indices and tables

Table Of Contents

Next topic

class_isola module

This Page