pysep.recsec#

RECord SECtion plotting tool for seismic waveforms (observed and synthetic)

This is a refactor of Pysep’s Python utility plotw_rs, a record section plotting script. The intent of this script is to plot multiple time series’ based on source-receiver characteristics (i.e., src-rcv distance, backazimuth).

Note

Code History: - Written by Carl Tape (11/21/2011) and Yun Wang (11/2011) in Matlab - Translated to Python by Nealy Sims (1/2021) - Upgraded by Aakash Gupta (9/2021) - Refactored by Bryant Chow (3/2022) - Currently maintained by adjTomo Dev Team

Module Contents#

Classes#

Dict

Simple dictionary overload for nicer get/set attribute characteristics

RecordSection

Record section plotting tool which takes ObsPy streams and:

Functions#

parse_args()

Parse command line arguments to set record section parameters dynamically

plotw_rs(*args, **kwargs)

Plot Waveform Record Section (main call function for RecordSection)

main()

Convenience 'main' function to play nice with entry scripts

Attributes#

DEG

pysep.recsec.DEG = '°'[source]#
class pysep.recsec.Dict[source]#

Bases: dict

Simple dictionary overload for nicer get/set attribute characteristics

Initialize self. See help(type(self)) for accurate signature.

__setattr__(key, value)[source]#

Implement setattr(self, name, value).

__getattr__(key)[source]#
class pysep.recsec.RecordSection(pysep_path=None, syn_path=None, stations=None, cmtsolution=None, st=None, st_syn=None, sort_by='default', scale_by=None, time_shift_s=None, zero_pad_s=None, move_out=None, min_period_s=None, max_period_s=None, preprocess=None, max_traces_per_rs=None, integrate=0, xlim_s=None, components='ZRTNE12', y_label_loc='default', y_axis_spacing=1, amplitude_scale_factor=1, azimuth_start_deg=0.0, distance_units='km', tmarks=None, geometric_spreading_factor=0.5, geometric_spreading_k_val=None, geometric_spreading_exclude=None, geometric_spreading_ymax=None, geometric_spreading_save=None, figsize=(9, 11), show=True, save='./record_section.png', overwrite=False, log_level='DEBUG', cartesian=False, synsyn=False, **kwargs)[source]#

Record section plotting tool which takes ObsPy streams and:

  1. preprocesses and filters waveforms,

  2. sorts source-receiver pairs based on User input,

  3. produces record section waveform figures.

Note

Used for reading in Pysep-generated waveforms

Parameters:

pysep_path (str) – path to Pysep output, which is expected to contain trace-wise SAC waveform files which will be read in.

Note

Used for reading in SPECFEM-generated synthetic waveforms

Parameters:
  • syn_path (str) – full path to directory containing synthetic seismograms that have been outputted by SPECFEM. The synthetics are expected in the format: ‘??..*.sem?*’, which generally matches SPECFEM files like ‘NZ.BFZ.BXE.semd’

  • stations (str) – full path to STATIONS file used to define the station coordinates. Format is dictated by SPECFEM

  • cmtsolution (str) – required for synthetics, full path to SPECFEM source file, which was used to generate SPECFEM synthetics. Example filenames are CMTSOLUTION, FORCESOLUTION, SOURCE.

  • cartesian (bool) – lets RecSec know that the domain is set in Cartesian coordinates (SPECFEM2D or SPECFEM3D_CARTESIAN in UTM), such that data/metadata reading will need to adjust acoordingly because the ObsPy tools used to read metadata will fail for domains defined in XYZ

  • synsyn (bool) – flag to let RecSec know that we are plotting two sets of synthetic seismograms. Such that both pysep_path and syn_path will be both attempt to read in synthetic data. Both sets of synthetics MUST share the same cmtsolution and stations metadata

Note

Used for defining user-input waveforms data

Parameters:
  • st (obspy.core.stream.Stream) – Stream objects containing observed time series to be plotted on the record section. Can contain any number of traces

  • st_syn (obspy.core.stream.Stream) – Stream objects containing synthetic time series to be plotted on the record section. Must be same length as st

Note

Waveform plotting organization parameters

Parameters:
  • sort_by (str) –

    How to sort the Y-axis of the record section, available:

    • ’default’: Don’t sort, just iterate directly through Stream

    • ’alphabetical’: sort alphabetically A->Z. Components sorted

      separately with parameter components

    • ’azimuth’: sort by source-receiver azimuth (deg) with constant

      vertical spacing on the y-axis. Requires azimuth_start_deg

    • ’backazimuth’: sort by source-receiver backazimuth (deg) with

      constant vertical spacing. Requires azimuth_start_deg

    • ’distance’: sort by source-receiver distance (km) with constant
      vertical spacing. Smallest distances at the top of the figure.

      Requires distance_units

    • ’abs_distance’: absolute vertical spacing of waveforms defined by

      source-receiver distance. Smallest distance at the top of the figure. Requires distance_units

    • ’abs_azimuth’: absolute vertical spacing of waveforms defined

      by source-receiver azimuth (deg).

    • ’abs_backazimuth’: absolute vertical spacing of waveforms by

      source-receiver backazimuth (deg).

    • *_r’: Add a ‘_r’ to any of the values about to REVERSE the sort,

      e.g., ‘alphabetical_r’ sort will go Z->A

  • scale_by (str) –

    scale amplitude of waveforms by available:

    • None: Not set, no amplitude scaling, waveforms shown raw

    • ’normalize’: scale each trace by the maximum amplitude,

      i.e., > a /= max(abs(a)) # where ‘a’ is time series amplitudes

    • ’global_norm’: scale by the largest amplitude to be displayed on

      the screen. Will not consider waveforms which have been excluded on other basis (e.g., wrong component) i.e., > st[i].max /= max([max(abs(tr.data)) for tr in st])

    • ’geometric_spreading’: scale amplitudes by expected reduction

      through geometric spreading. Related parameters are:

      • geometric_spreading_factor

      • geometric_spreading_k_val

      • geometric_spreading_exclude

      • geometric_spreading_ymax A

      Equation is A(d) = k / sin(d) ** f

      Where A(d) is the amplitude reduction factor as a function of distnace, d. ‘k’ is the geometric_spreading_k_val and ‘f’ is the geometric_spreading_factor. ‘k’ is calculated automatically if not given.

  • time_shift_s (float OR list of float OR str) –

    apply static time shift to waveforms, two options:

    1. float (e.g., -10.2), will shift ALL waveforms by

      that number (i.e., -10.2 second time shift applied)

    2. list (e.g., [5., -2., … 11.2]), will apply individual time

      shifts to EACH trace in the stream. The length of this list MUST match the number of traces in your input stream.

    3. str: apply time shift based on a theoretical TauP phase arrival

      if available in the SAC header. These should have been appended by PySEP during data download. If no value is available in the SAC header, defaults to 0. This may have unintended consequences so you should manually check that all values are okay. Available options are: - ‘first_arrival_time’: shift based on earliest phase arrival - ‘p_arrival_time’: shift based on earliest P phase arrival - ‘s_arrival_time’: shift based on earliest S phase arrival

  • zero_pad_s (list) –

    zero pad data in units of seconsd. applied after tapering and before filtering. Input as a tuple of floats,

    • (start, end): a list of floats will zero-pad the START and END

      of the trace. Either can be 0 to ignore zero-padding at either end

  • amplitude_scale_factor (float OR list of float) –

    apply scale factor to all amplitudes. Used as a dial to adjust amplitudes manually. Defaults to 1. Two options:

    1. float (e.g., 1.2), will multiply ALL waveforms by that number

    2. list (e.g., [5., -2., … 11.2]), will apply individual amplitude

      scale to EACH trace in the stream. The length of this list MUST match the number of traces in your input stream.

  • move_out (float) – Optional. A velocity value that will be used to calculate move out, which will time shift seismograms based on their source receiver distance. This parameter will be ADDED to time_shift_s (both float and list), if it is provided. Should be in units of distance_units/s

  • azimuth_start_deg (float) – If sorting by azimuth, this defines the azimuthal angle for the waveform at the top of the figure. Set to 0 for default behavior

  • distance_units (str) – Y-axis units when sorting by epicentral distance ‘km’: kilometers on the sphere ‘deg’: degrees on the sphere ‘km_utm’: kilometers on flat plane, UTM coordinate system

Note

Data processing parameters

Parameters:
  • preprocess (str) –

    choose which data to preprocess, options are:

    • None: do not run preprocessing step, including filter (Default)

    • ’st’: process waveforms in st

    • ’st_syn’: process waveforms in st_syn. st still must be given

    • ’both’: process waveforms in both st and st_syn

  • min_period_s (float) – minimum filter period in seconds

  • max_period_s (float) – maximum filter period in seconds

  • components (str) – a sequence of strings representing acceptable components from the data. Also determines the order these are shown EVEN when sorted by other variables. For example, components==’ZR’ would only display Z and R components, and Z components would be should BEFORE R components for the SAME station.

  • integrate (int) –

    apply integration integrate times on all traces. acceptable values [-inf, inf], where positive values are integration and negative values are differentiation

    e.g., if integrate == 2, will integrate each trace twice. or if integrate == -1, will differentiate once or if integrate == 0, do nothing (default)

Note

Geometric spreading parameters, used for amplitude scaling

Parameters:
  • geometric_spreading_factor (float) – factor to scale amplitudes by predicting the expected geometric spreading amplitude reduction and correcting for this factor. Related optional parameter: geometric_spreading_k_val. For Rayleigh waves, geometric_spreading_factor == 0.5 (default)

  • geometric_spreading_k_val (float) – Optional constant scaling value used to scale the geometric spreading factor equation. If not given, calculated automatically using max amplitudes Value should be between 0.5 and 1.0 for regional surface waves.

  • geometric_spreading_exclude (list) – a list of station names that should match the input stations. Used to exclude stations from the automatic caluclation of the geometric

  • geometric_spreading_ymax (float) – Optional value for geometric spreading plot. Sets the max y-value on the plot. If not set, defaults to whatever the peak y-value plotted is.

  • geometric_spreading_save (str) – file id to save separate geometric spreading scatter plot iff `scale_by`==’geometric_spreading’. If NoneType, will not save. By default, turned OFF

Note

Figure generation control parameters

Parameters:
  • max_traces_per_rs (int) – maximum number of traces to show on a single record section plot. Defaults to all traces in the Stream

  • xlim_s (list of float) – [start, stop] in units of time, seconds, to set the xlimits of the figure

  • y_axis_spacing (float) – spacing between adjacent seismograms applied to Y-axis on relative (not absolute) scales. Defaults to 1.

  • y_label_loc (str) –

    Location to place waveform labels on the y-axis

    • ’default’: auto choose the best location based on sort_by

    • ’y_axis’: Replace tick labels on the y-axis (left side of figure),

      This won’t work if using absolute sorting and will be over- written by ‘default’

    • ’y_axis_abs’: For absolute y-axis only. waveform labels plotted

      on the left side outside border, with y-axis labels overlapping (showing distance or azimuth)

    • ’y_axis_abs_right’: For absolute y-axis only. waveform labels

      plotted on the right side outside border, with y-axis labels on the left side of the figure (showing distance or azimuth)

    • ’y_axis_right’: Replace tick labels on the right side of the

      y-axis. This option won’t work with absolute sorting

    • ’x_min’: Place labels on top of the waveforms at the global min

      x-value on the figure

    • ’x_max’: Place labels on top of the waveforms at the global max

      x-value on the figure

    • None: Don’t plot any text labels

  • tmarks (list of float) – place vertical lines at given reference times. Used for marking reference times such as the event origin, or phase arrival. Input as a list of times in units of seconds (where T=0 is the event origin time). For example `tmarks`=[0, 100, 200] would set vertical lines at 0s, 100s and 200s

  • figsize (tuple of float) – size the of the figure, passed into plt.subplots()

  • show (bool) – show the figure as a graphical output

  • save (str) – path to save output figure, will create the parent directory if it doesn’t exist. If None, will not save (default).

Note

Internal RecSec parameters

Parameters:
  • overwrite (bool) – if the path defined by save exists, will overwrite the existing figure

  • log_level (str) – level of the internal logger. In order of ascending verbosity: ‘CRITICAL’, ‘WARNING’, ‘INFO’, ‘DEBUG’.

Raises:

AssertionError – if any parameters are set incorrectly

_generate_synthetic_stream(syn_path, source, stations, cartesian=False, fmt='*.*.*.sem?*')[source]#

Convenience fucntion to read in synthetic seismograms from SPECFEM2D, SPECFEM3D or SPECFEM3D_GLOBE. Can be used to read in both st and st_syn

Parameters:
  • syn_path (str) – full path to directory containing synthetic seismograms

  • source (str) – path to source file which defined the source that generated the synthetics. Acceptable values are CMTSOLUTION (from SPECFEM3D/GLOBE), and SOURCE (from SPECFEM2D)

  • stations (str) – full path to STATIONS file used to define the station coordinates. Format is dictated by SPECFEM

  • fmt (str) – the expected filename format of the sythetics. Based on ASCII style files generated by SPECFEM. Defaults to ‘??..*.sem?*’. Expected filename looks something like: ‘NN.SSS.BXC.semd’

Return type:

obspy.core.stream.Stream

Returns:

Stream object with synthetic waveforms

check_parameters()[source]#

Check that parameters are set properly and in line with how they are expected by the program

Note

Not using assertions here because we want all incorrect parameters to be evaluated together and displayed at once, that way the user doesn’t have to run this function multiple times to figure out how to set their parameters correctly

Raises:

AssertionError – If any parameters are not set as expected by plotw_rs functionality

get_skip_idx()[source]#

Get a list of any traces that don’t adhere to user-defined boundaries such as dist, az, baz, id, or component matches. Don’t actually remove the traces from the stream but rather just collect indices we can use to skip when plotting.

TODO add distance, azi and backazi skip criteria

Return type:

np.array

Returns:

returns an indexing list which can be used to skip over traces that don’t adhere to certain criteria

get_parameters()[source]#

Calculate parameters in a specific order and based on the user-defined information.

Note

The order of function calls here is important! Some of the ‘get’ functions require the results of other ‘get’ functions.

Calculated Parameters

np.array idx:
    a linear indexing of all the traces in the stream
np.array station_ids:
    an ordered list of station ids, used to get station names
    that match the index defined in `idx`
np.array max_amplitudes:
    abs max amplitudes of each trace, used for normalization
np.array amplitude_scaling:
    An array to scale amplitudes based on user choices
np.array time_shift_s:
    An array to time shift time series based on user choices
np.array y_axis:
    Y-Axis values based on sorting algorithm, used for plotting
np.array distances:
    source-receiver distances in `distance_units` units
np.array azimuths:
    source-receiver azimuths in degrees
np.array backazimuths:
    source-receiver backazimuths in degrees
np.array sorted_idx:
    sorted indexing on all the traces of the stream based on the
    chosen sorting algorithm
get_xlims(st=None)[source]#

The x-limits of each trace depend on the overall time shift (either static or applied through move out), as well as the sampling rate of each trace (which can vary). Retrieve an index-dependent list of x-limits which can be used to truncate the time series during plotting.

Note

Requires that get_time_shifts() has already been run

Parameters:

st (obspy.core.stream.Stream) – stream object to get xlims for. By default this is the ‘data’ stored in st but it can also be given st_syn to get synthetic x limits which may differ

Return type:

np.array

Returns:

an array of tuples defining the start and stop indices for EACH trace to be used during plotting. Already includes time shift information so xlim can be applied DIRECTLY to the time shifted data

get_srcrcv_stats()[source]#

Get source receiver information such as min max values, and count-related numbers (e.g., num stations) to be used mainly for print statements and text information

Stats Arguments

np.array event_names:
    unique event names taken from the SAC header
int nevents:
    number of unique events in the stream
np.array unique_sta_ids:
    unique station codes taken from trace stats
int nstation_ids:
    number of unique station codes
np.array network_codes:
    unique network codes taken from station ids
int nnetwork:
    number of unique network codes
np.array station_codes:
    unique station codes taken from station ids
int nstation:
    number of unique station codes
np.array location_codes:
    unique location codes taken from station ids
int nlocation:
    number of unique location codes
np.array channel_codes:
    unique channel codes taken from station ids
int nchannel:
    number of unique channel codes
bool reverse_sort:
    determine if the user wants to reverse their sort, they do this
    by appending '_r' to the end of the `sort_by` argument
get_time_offsets()[source]#

Find time shift to data constituting difference between trace start time and event origin time. Both synthetics and data should have the correct timing. Time offsets will be used during plotting to make sure all traces have the same T=0

Note

Appends time offset directly to the stats header, overwriting any value that might have been there already

get_time_shifts()[source]#

Very simple function which allows float inputs for time shifts and ensures that time shifts are always per-trace arrays Applies the move out by calculating a time shift using src-rcv distance

Return type:

np.array

Returns:

a stream-lengthed array of time shifts that can be applied per trace

get_srcrcv_dist_az_baz()[source]#

Convenience function to wrap _get_srcrcv_dist_az_baz_trace into a loop over the whole stream and return lists of distances, azimuths, and backazimuths

Rtype distances:

np.array

Return distances:

source-receiver distances in user-defined units in the original order of Stream

Rtype azimuths:

np.array

Return azimuths:

source-receiver azimuths (deg) in the original order of Stream

Rtype backazimuths:

np.array

Return backazimuths:

source-receiver azimuths (deg) in the original order of Stream

_get_srcrcv_dist_az_baz_trace(tr=None, idx=0)[source]#

Check the source-receiver characteristics such as src-rcv distance, azimuth, backazimuth for a given trace.

Note

This function ASSUMES that SAC headers have been written to the traces. Otherwise we will need more complicated ways to get event lat and lon

Parameters:
  • tr (obspy.core.trace.Trace) – trace to get srcrcv information for. If None, will use idx

  • idx (int) – if `tr`==None, user can provide index of self.st (Stream) defaults to index 0

Rtype gcdist:

float

Return gcdist:

great circle distance in units specified by distance_units, can be ‘km’ or ‘deg’

Rtype az:

float

Return az:

azimuth (degrees) between source and receiver

Rtype baz:

float

Return baz:

azimuth (degrees) between source and receiver

get_amplitude_scaling(_choice='st')[source]#

Scale the amplitudes of all the waveforms by producing a Stream dependent scale factor based on user choice. It is expected that the output array will be DIVIDED by the data arrays:

i.e., st[i].data /= self.amplitude_scaling[i]

Note

Needs to be run AFTER preprocessing because filtering etc. will affect the final amplitudes of the waveforms

Parameters:

_choice (str) – Internal choice only required for ‘normalize’ scaling. st for amplitude scaling w.r.t data array, st_syn for amplitude scaling w.r.t synthetics

Return type:

np.array

Returns:

an array corresponding to the Stream indexes which provides a per-trace scaling coefficient

calculate_geometric_spreading()[source]#

Stations with larger source-receiver distances will have their amplitude scaled by a larger value.

For information on geometric spreading, see Stein and Wysession, Section 4.3.4, Eq 20 (for Rayleigh waves, geometrical spreading factor = 0.5). For our purposes, this will fold the attenuation factor into the same single factor that accounts for geometric spreading.

Equation is for amplitude reduction ‘A’ as a factor of distance ‘d’:

A(d) = k / sin(d) ** f

where ‘k’ is the geometric_spreading_k_val and ‘f’ is the geometric_spreading_factor. ‘k’ is calculated automatically if not given by the User. In the code, A(d) is represented by w_vector

Note

This does not take into account the variation in amplitude from focal mechanism regions

TODO
  • Look in Stein and Wysession and figure out vector names

  • Allow ignoring specific components, currently only allowed to

    exclude on a per-station basis

Return type:

list

Returns:

scale factor per trace in the stream based on theoretical geometrical spreading factor. This is meant to be MULTIPLIED by the data arrays

get_sorted_idx()[source]#

Sort the source-receiver pairs by the chosen parameters. Except for in default sorting, always maintains component ordering defined by the user, i.e., for the same station, components will be ordered by the component parameter.

Return type:

np.array

Returns:

returns an indexing list which is sorted based on the user defined sort_by argument.

_sort_by_alphabetical()[source]#

Sort by full station name in order. That is, network is sorted, then within network, station is sorted, and so on. Components are sorted last and NOT in alphabetical order. They are ordered based on the user-input components parameter.

Return type:

np.array

Returns:

indexing of networks and stations sorted alphabetically

_get_component_order()[source]#

When we are sorting, we want components to be sorted by the preferred order (i.e, ZRT, Z index is 0, T is 2), which means the components have to be reordered to adhere to the sorting algorithm. ALSO we need to ensure that we honor component order even if everything else is being sorted reverse alphabetically so the components entry needs to be the opposite of stats.reverse_sort

Return type:

list

Returns:

components converted to integer values which can be used for sorting algorithms.

get_y_axis_positions()[source]#

Determine how seismograms are vertically separated on the Y-Axis when plotting. Allows for constant separation, or absolute separation based on distance or (back)azimuth separation.

Return type:

np.array

Returns:

an array of actual y-axis positions that can be passed directly to plt.plot() (or similar)

get_x_axis_tick_values()[source]#

Determine, based on the length of the plotted traces, how often tick marks should be applied so that they are spaced as aesthetically pleasing values.

process_st()[source]#

Preprocess the Stream with optional filtering in place.

Note

Data in memory will be irretrievably altered by running preprocess.

TODO Add feature to allow list-like periods to individually filter

seismograms. At the moment we just apply a blanket filter.

plot(subset=None, page_num=None, **kwargs)[source]#

Plot record sections based on all the available information

Parameters:
  • subset (list of int) – subset of sorted_idx if there are too many waveforms to plot on one page (set by max_traces_per_rs). e.g., to get the first 10 entries, subset=[0,10]

  • page_num (int) – If multiple pages are required due to exceeding max_traces_per_rs, page_num will make adjustments to the figure name and title to differentiate different pages of the same record section

_log_relative_information(start=0, stop=None)[source]#

If both st and st_syn are being plotted, then write some relative information about their amplitudes to the main logger.

Related to #116

_plot_trace(idx, y_index, choice='st')[source]#

Plot a single trace on the record section, with amplitude scaling, time shifts, etc. Observed waveforms are black, synthetics are red.

Parameters:
  • idx (int) – index of the trace to plot and all trace-ordered values like amplitude scaling and time shifts

  • y_index (int) – numerical order which this trace was plotted, as each trace is plotted on top of the previous one. y_index should be iterated linearly in the loop that calls this function.

  • choice (str) – choice of ‘st’ or ‘st_syn’ depending on whether you want to plot the observed or synthetic waveforms

_plot_tmarks()[source]#

Plot vertical lines at given reference times based on user input values

_plot_azimuth_bins(start=None, stop=None)[source]#

If plotting by azimuth, create visual bin separators so the user has a visual understanding of radiation patterns etc.

Parameters:
  • start (int) – optional starting index to determine the bounds of the azimuth bins

  • stop (int) – optional stop index to determine the bounds of the azimuth bins

_plot_axes(start=0, stop=None)[source]#

Contains the logic in how to handle the x- and y-axis labels, ticks etc.

Logic options for how to plot the y-axis: - Relative: Relative plotting means the yticklabels will get replaced

by station information. This can either be on the right or left side but will be attached to the actual axis

  • Absolute: Absolute plotting means the y-axis actual represents

    something (e.g., distance, azimuth). That means labels can not replace the y-ticks and they have to be placed within the figure

Note

Relative plotting can also place labels OFF the y-axis, at which point the y-axis is turned off because it contains no usable information

Parameters:
  • start (int) – optional starting index for creating text labels

  • stop (int) – optional stop index for creating text labels

_set_y_axis_absolute()[source]#

If ‘abs_’ in sort_by, then the Y-axis should be shown in absolute scale. That means we need to format the text labels, add some labelling etc.

_set_y_axis_text_labels(start=0, stop=-1, loc='y_axis')[source]#

Plot a text label next to each trace describing the station, azimuth and source-receiver distance. We need to do this all at once because we have to replace all ticks and tick labels at once.

Note

if using the ‘subset’ option in plot, need to also tell the y-axis plotter that we are only plotting a subset of data by using the start and stop parameters

Parameters:
  • start (int) – starting index for plotting, default to start 0

  • stop (int) – stop index for plotting, default to end -1

  • loc (str) –

    location to place the y_axis text labels, available: - y_axis: Place labels along the y-axis (left side of the figure)

    Will replace the actual y-tick labels so not applicable for absolute sorting which requries the y-axis labels

    • y_axis_abs: for absolute plotting, place waveform labels to the

      left side of the figure (outside border), co-existing with y-axis labels

    • y_axis_right: same as y_axis but set on the right side of figure

    • x_min: Place labels on the waveforms at the minimum x value

    • x_max: Place labels on the waveforms at the maximum x value

_plot_title(nwav=None)[source]#

Create the title of the plot based on event and station information Allow dynamic creation of title based on user input parameters

Parameters:

nwav (int) – if using subset, the title needs to know how many waveforms it’s showing on the page. self.plot() should tell it

run()[source]#

Convenience run function to run the RecordSection workflow in order. No internal logic for breaking the figure up into multiple record sections. For that see main function plotw_rs.

pysep.recsec.parse_args()[source]#

Parse command line arguments to set record section parameters dynamically This arg parser provides a simplified interface for working with plotw_rs BUT it limits the flexibility of the code because things like long lists are prohibitively verbose and not included in the arguments.

Kwargs can be passed in in the same format thanks to:

https://stackoverflow.com/questions/37367331/is-it-possible-to-use- argparse-to-capture-an-arbitrary-set-of-optional-arguments

Note

Not all parameters are set here, some are left as default values Also some parameters are set different than the class defaults, so that when the user runs record_section.py without arguments, they get a reasonable result

Note

Do NOT use the command line if you want to exploit the expanded capabilities of the record section plotter, rather script it or call from an interactive environment.

pysep.recsec.plotw_rs(*args, **kwargs)[source]#

Plot Waveform Record Section (main call function for RecordSection)

Instantiates the RecordSection class, runs processing and parameter getting, and then plots record section. Contains additional logic for breaking up figures into multiple pages if requested by the user, while keeping sort order and waveform spacing consistent across multiple reord sections.

Note

See RecordSection.__init__() for acceptable args and kwargs

pysep.recsec.main()[source]#

Convenience ‘main’ function to play nice with entry scripts

$ recsec -h