test_recsec

Test the general functionality of the RECord SECtion plotter.

Note

This test suite simply creates some plots to make sure the general machinery is working as expected, but otherwise has no real solid checks on the outputs. If this code grows more cumbersome, we will want to do figure matching checks or something more sophisticated.

Attributes

Functions

recsec(tmpdir)

Initiate a RecordSection instance

recsec_w_synthetics(tmpdir)

Initiate a RecordSection instance

test_plot_recsec(recsec)

Simply test out the functinoality of plotw_rs

test_plot_recsec_w_synthetics(recsec_w_synthetics)

Simply test out the functinoality of plotw_rs

test_plot_recsec_sort_by(recsec)

Simply test out the functinoality of plotw_rs

test_plot_recsec_scale_by(recsec)

scale by option testing

test_plot_recsec_time_shift(recsec)

apply a whole bunch of time shift elements

test_plot_recsec_time_shift_array(recsec)

apply an array of time shifts to shift each trace differently

test_plot_recsec_time_shift_syn_same_as_obs(tmpdir)

apply the same time shift to data and synthetics

test_plot_recsec_time_shift_syn_array(recsec_w_synthetics)

apply an array of time shifts to shift each trace differently

test_plot_recsec_time_shift_syn(recsec_w_synthetics)

apply different time shift to data and synthetics

test_plot_recsec_time_shift_syn_zero(recsec_w_synthetics)

make sure zero synthetic time shift works

test_plot_recsec_time_shift_zero_w_syn(recsec_w_synthetics)

make sure zero time shift and nonzero synthetic time shift works

test_plot_recsec_preprocess(recsec)

preprocess and filter the record section

test_plot_recsec_y_label_loc(recsec)

test all available y_label locations options

test_plot_recsec_distance_units(recsec)

test all available distance units

test_plot_recsec_plot_options(recsec)

test plotting options

test_recsec_calc_time_offset_no_trim(recsec_w_synthetics)

testing that synthetics and data which do not share origin time

test_recsec_calc_time_offset_w_trim(recsec_w_synthetics)

testing that synthetics and data which do not share origin time

test_recsec_zero_amplitude(recsec)

waveforms that have zero amplitude and are normalized should be able

test_recsec_mismatched_locations_fails(recsec_w_synthetics)

Test that when RecSec encounters stations with different location codes,

test_recsec_mismatched_locations(recsec_w_synthetics)

Test when RecSec encounters stations that match all their station code

test_plot_recsec_zero_pad(recsec)

Ensure that zero pad only adds zeros to the start and end of the waveform

Module Contents

test_recsec.SHOW = False[source]
test_recsec.recsec(tmpdir)[source]

Initiate a RecordSection instance

test_recsec.recsec_w_synthetics(tmpdir)[source]

Initiate a RecordSection instance

test_recsec.test_plot_recsec(recsec)[source]

Simply test out the functinoality of plotw_rs

test_recsec.test_plot_recsec_w_synthetics(recsec_w_synthetics)[source]

Simply test out the functinoality of plotw_rs

test_recsec.test_plot_recsec_sort_by(recsec)[source]

Simply test out the functinoality of plotw_rs

test_recsec.test_plot_recsec_scale_by(recsec)[source]

scale by option testing

test_recsec.test_plot_recsec_time_shift(recsec)[source]

apply a whole bunch of time shift elements

test_recsec.test_plot_recsec_time_shift_array(recsec)[source]

apply an array of time shifts to shift each trace differently

test_recsec.test_plot_recsec_time_shift_syn_same_as_obs(tmpdir)[source]

apply the same time shift to data and synthetics

test_recsec.test_plot_recsec_time_shift_syn_array(recsec_w_synthetics)[source]

apply an array of time shifts to shift each trace differently

test_recsec.test_plot_recsec_time_shift_syn(recsec_w_synthetics)[source]

apply different time shift to data and synthetics

test_recsec.test_plot_recsec_time_shift_syn_zero(recsec_w_synthetics)[source]

make sure zero synthetic time shift works

test_recsec.test_plot_recsec_time_shift_zero_w_syn(recsec_w_synthetics)[source]

make sure zero time shift and nonzero synthetic time shift works

test_recsec.test_plot_recsec_preprocess(recsec)[source]

preprocess and filter the record section

test_recsec.test_plot_recsec_y_label_loc(recsec)[source]

test all available y_label locations options

test_recsec.test_plot_recsec_distance_units(recsec)[source]

test all available distance units

test_recsec.test_plot_recsec_plot_options(recsec)[source]

test plotting options

test_recsec.test_recsec_calc_time_offset_no_trim(recsec_w_synthetics)[source]

testing that synthetics and data which do not share origin time plot together correctly by checking that the time offsets are calced

test_recsec.test_recsec_calc_time_offset_w_trim(recsec_w_synthetics)[source]

testing that synthetics and data which do not share origin time plot together correctly by checking that trim is applied

test_recsec.test_recsec_zero_amplitude(recsec)[source]

waveforms that have zero amplitude and are normalized should be able to bypass normalizations which lead to weird plotting (see #131).

Note

This does not really test that the method is working correctly because dividing a NumPy array by zero leads to NaNs in the array which just won’t plot. This is more of a visual test to make sure that the zero amplitude is plotting correctly, look for green lines

test_recsec.test_recsec_mismatched_locations_fails(recsec_w_synthetics)[source]

Test that when RecSec encounters stations with different location codes, it fails the parameter check

test_recsec.test_recsec_mismatched_locations(recsec_w_synthetics)[source]

Test when RecSec encounters stations that match all their station code except for location code, which is sometimes used as a free-floating parameter to indicate e.g., synthetics or something and doesn’t always determine that waveforms do not match.

test_recsec.test_plot_recsec_zero_pad(recsec)[source]

Ensure that zero pad only adds zeros to the start and end of the waveform but does NOT time shift it.

Note

This is a visual check for now so unskip this test and set constant SHOW==True to have a look at the waveforms that get plotted. In the future we could do a check on the time of the max amplitude but I did not think it was worth the investment to write that test.