pySW4.plotting.image module

Plotting routines for SW4 images of Maps or Cross-Sections.

author:

Shahar Shani-Kadmiel (€€€€)

Omry Volk (omryv@post.bgu.ac.il)

Tobias Megies (megies@geophysik.uni-muenchen.de)

copyright:

Shahar Shani-Kadmiel (s.shanikadmiel@tudelft.nl)

Omry Volk (omryv@post.bgu.ac.il)

Tobias Megies (megies@geophysik.uni-muenchen.de)

license:

This code is distributed under the terms of the GNU Lesser General Public License, Version 3 (https://www.gnu.org/copyleft/lesser.html)

create_image_plots(input_file, folder=None, stf=None, frames_per_second=5, cmap=None, movies=True)[source]

Create all image plots/movies for a SW4 run.

Currently always only uses first patch in each SW4 image file. If the path/filename of the SW4 input file is provided, additional information is included in the plots (e.g. receiver/source location, automatic determination of source time function type, etc…)

Parameters:

input_file : str

Filename (potentially with absolute/relative path) of SW4 input file used to control the simulation. Use None to work on folder with SW4 output without using metadata from input file.

folder : str

Folder with SW4 output files or None if output folder location can be used from input file. Only needed when no input file is specified or if output folder was moved to a different location after the simulation.

stf : str

'displacement' or 'velocity'.

frames_per_second : int or float

Image frames to show per second in output videos.

cmap : str or Colormap

Matplotlib colormap or colormap string understood by matplotlib.

movies : bool

Whether to produce movies from image files present at different cycles of the simulation. Needs ffmpeg to be installed and callable on command line.

image_files_to_movie(input_filenames, output_filename, input_file=None, stf=None, patch_number=0, frames_per_second=5, overwrite=False, global_colorlimits=True, debug=False, **plot_kwargs)[source]

Convert SW4 images to an mp4 movie using command line ffmpeg.

Parameters:

input_filenames : str or list

Wildcarded filename pattern or list of individual filenames.

output_filename : str

Output movie filename (‘.mp4’ extension will be appended if not already present).