pyswapp package
Subpackages
- pyswapp.utils package
- Submodules
- pyswapp.utils.interactive module
- pyswapp.utils.inversion module
- pyswapp.utils.physics module
- pyswapp.utils.plot_settings module
- pyswapp.utils.plotting module
- pyswapp.utils.settings module
- pyswapp.utils.sql module
SQLSQL.array_to_blob()SQL.blob_to_array()SQL.check_data()SQL.delete_data()SQL.drop_table()SQL.duplicate_data()SQL.get_connection()SQL.get_geometry()SQL.get_proc_labels()SQL.get_settings()SQL.get_shotfile()SQL.get_table()SQL.get_tables()SQL.get_trafo_labels()SQL.get_wids()SQL.group_pd()SQL.read_FV()SQL.read_curve()SQL.read_curve_cc()SQL.read_data()SQL.read_f_from_pd()SQL.read_filter()SQL.read_geometry()SQL.read_pd()SQL.read_setting()SQL.read_sql()SQL.show_tables()SQL.to_sql()SQL.wids_exist()SQL.write_FV()SQL.write_curve()SQL.write_data()SQL.write_filter()SQL.write_pd()
StdevFunc
- pyswapp.utils.utils module
assert_exists()combine_dict()create_geometry()create_logging()create_projectdir()filter_df2dict()get_fileList()get_num_from_str()get_shotfiles_from_geometry()interp()natural_sort()nextpow2()print_inventory()read_DC_csv()read_filter()rename_files()safe_makedirs()save2csv()write_filter()
- Module contents
Submodules
pyswapp.curve module
- class pyswapp.curve.DispersionCurve(mode=0, wave='rayleigh')[source]
Bases:
objectclass to manipulate and save dispersion curve data
- filter(pmin=None, pmax=None, param='frequency', inplace=False)[source]
remove points outside of [pmin,pmax]
- plot(data=None, axes=None, outfile=None, fmt=None, show=True, show_orig=False, **kwargs)[source]
plot dispersion curve
- plotColumn(data=None, axes=None, outfile=None, fmt=None, show=True, **kwargs)[source]
plot dispersion curve data as 1D column to construct pseudosection
pyswapp.curves module
pyswapp.manager module
- class pyswapp.manager.BaseManager(prjdir, path2raw=None, path2geom=None, settings=None, database='swa.db', overwrite=False, **kwargs)[source]
Bases:
object- apply_filter(ftype='FK', points_top=None, points_bot=None, procset=None, use_windows=True, **kwargs)[source]
Apply manual filter from database.
- Parameters:
ftype (string, default 'FK', filter type)
points_top (list, top filter)
points_bot (list, bottom filter)
procset (str, identifier to set on which dataset the processing should be applied to)
use_windows (bool, default True, whether to apply the processing to windows)
kwargs
- apply_filter_2D(procset=None, apply_to='all', use_windows=True, ftype='FK', uniq_per_rep=True, uniq_per_wid=True, **kwargs)[source]
Apply filter to current selection or all data sets
- Parameters:
procset (str, identifier to set on which dataset the processing should be applied to)
apply_to (str, default 'all', whether to apply function to all streams or just the current selection)
use_windows (bool, default True, whether to apply the processing to windows)
ftype (string, default 'FK', filter type)
uniq_per_rep (bool, default True, whether a unique filter exists for each rep)
uniq_per_wid (bool, default True, whether a unique filter exists for each wid)
- extract(procset=None, use_windows=True, method='max', **kwargs)[source]
apply dispersion curve extraction to a stream
- Parameters:
procset (str, identifier to set on which dataset the processing should be applied to)
use_windows (bool, default True, whether to apply the processing to windows)
method (str, default 'max', extraction method)
kwargs (arguments for the extraction)
- gui_interact(type='pick', domain='FV', procset=None, use_windows=True, **kwargs)[source]
interactive figure switcher
- Parameters:
type (str, plot type)
procset (str, identifier to set on which dataset the processing should be applied to)
use_windows (bool, default True, whether to apply the processing to windows)
- gui_view(type='', procset=None, use_windows=True, **kwargs)[source]
figure switcher
- Parameters:
type (str, plot type)
procset (str, identifier to set on which dataset the processing should be applied to)
use_windows (bool, default True, whether to apply the processing to windows)
- import_filter(fname)[source]
Read filter from file in tabular format
- Parameters:
fname (str, filename to import)
- plot(type='seismogram', procset=None, use_windows=True, **kwargs)[source]
plot portions of the stream data
- Parameters:
type (str, plot type)
procset (str, identifier to set on which dataset the processing should be applied to)
use_windows (bool, default True, whether to apply the processing to windows)
- plot_curve(procset=None, use_windows=True, method='phaseshift', **kwargs)[source]
plot a dispersion curve
- Parameters:
procset (str, identifier to set on which dataset the processing should be applied to)
method (str, method used to obtain dispersion curve)
use_windows (bool, default True, whether to apply the processing to windows)
- plot_pseudosection(procset=None, **kwargs)[source]
plot the Rayleigh wave phase velocity pseudosection
- Parameters:
procset (str, identifier to set on which dataset the processing should be applied to)
- preprocess(type, procset=None, use_windows=True, **kwargs)[source]
apply preprocessing steps to current selection or all data sets
- Parameters:
type (str, which processing method to call)
procset (str, identifier to set on which dataset the processing should be applied to)
use_windows (bool, default True, whether to apply the processing to windows)
kwargs (arguments for the processing)
- process_curve(type, procset=None, method=None, dc_mode=0, use_windows=True, **kwargs)[source]
apply a process to a dispersion curve
- Parameters:
type (str, which processing method to call)
procset (str, identifier to set on which dataset the processing should be applied to)
method (str, method used to obtain dispersion curve)
dc_mode (int, default 0, mode of propagation)
use_windows (bool, default True, whether to apply the processing to windows)
kwargs (arguments for the processing)
- read_filter(ftype='FK', procset=None, use_windows=True, uniq_per_rep=True, uniq_per_wid=True)[source]
Read manual filter from database.
- Parameters:
ftype (string, default 'FK', filter type)
procset (str, identifier to set on which dataset the processing should be applied to)
use_windows (bool, default True, whether to apply the processing to windows)
uniq_per_rep (bool, default True, whether a unique filter exists for each rep)
uniq_per_wid (bool, default True, whether a unique filter exists for each wid)
- Return type:
points_top (list), points_bot (list)
- save(procset=None, method=None, dc_mode=0, use_windows=True, **kwargs)[source]
save a dispersion curve for a defined source location, repetition and window id
- Parameters:
procset (str, identifier to set on which dataset the processing should be applied to)
method (str, method used to obtain dispersion curve)
dc_mode (int, default 0, mode of propagation)
use_windows (bool, default True, whether to apply the processing to windows)
- save_filter(fname='filter.csv', ftype='FK', procset=None)[source]
Save filter to file in tabular format
- Parameters:
fname (str, filename to save data to disk)
procset (str, identifier to set on which dataset the processing should be applied to)
ftype (string, default 'FK', filter type)
- select_data(sin=1, rep=1, inplace=True, verbose=True)[source]
Select one stream object based on source location and shot repetition indices
- Parameters:
sin (int, shot index number)
rep (int, repeated shot index number)
inplace (bool, default True, whether to modify the stream object rather than creating a new one)
verbose (print current selection to console)
- Return type:
stream object
- transform(method='phaseshift', procset=None, use_windows=True, **kwargs)[source]
apply wavefield transformation to current selection or all data sets
- Parameters:
method (str, default 'phaseshift', which transformation method to apply to the data)
procset (str, identifier to set on which dataset the processing should be applied to)
use_windows (bool, default True, whether to apply the processing to windows)
kwargs (arguments for the processing)
- class pyswapp.manager.MASW2DManager(prjdir, path2raw=None, path2geom=None, settings=None, database='swa.db', **kwargs)[source]
Bases:
BaseManager- apply_filter(procset=None, apply_to='all', use_windows=True, ftype='FK', uniq_per_rep=True, uniq_per_wid=True, **kwargs)[source]
Apply filter to current selection or all data sets
- Parameters:
procset (str, identifier to set on which dataset the processing should be applied to)
apply_to (str, default 'all', whether to apply function to all streams or just the current selection)
use_windows (bool, default True, whether to apply the processing to windows)
ftype (string, default 'FK', filter type)
uniq_per_rep (bool, default True, whether a unique filter exists for each rep)
uniq_per_wid (bool, default True, whether a unique filter exists for each wid)
- combine(procset=None, method=None, filter=True, dc_mode=0, use_windows=True, **kwargs)[source]
Combine dispersion curves with same receiver spread location
- Parameters:
procset (str, identifier to set on which dataset the processing should be applied to)
method (str, method used to obtain dispersion curves)
filter (, bool, manually filter curves if True)
dc_mode (int, default 0, mode of propagation)
use_windows (bool, default True, whether to apply the processing to windows)
- extract(procset=None, method='max', apply_to='all', use_windows=True, **kwargs)[source]
Extract dispersion curves
- Parameters:
procset (str, identifier to set on which dataset the processing should be applied to)
method (str, default 'max', method for dispersion curve extraction)
apply_to (str, default 'all', whether to apply function to all streams or just the current selection)
use_windows (bool, default True, whether to apply the processing to windows)
- extract_curves(procset=None, method='max', apply_to='all', use_windows=True, **kwargs)[source]
Extract dispersion curves
- Parameters:
procset (str, identifier to set on which dataset the processing should be applied to)
method (str, default 'max', method for dispersion curve extraction)
apply_to (str, default 'all', whether to apply function to all streams or just the current selection)
use_windows (bool, default True, whether to apply the processing to windows)
- moving_window(procset=None, apply_to='all', **kwargs)[source]
Apply windowing to current selection or all data sets
- Parameters:
procset (str, identifier to set on which dataset the processing should be applied to)
apply_to (str, default 'all', whether to apply function to all streams or just the current selection)
kwargs (window settings)
- plot(type='seismogram', procset=None, apply_to='all', use_windows=True, **kwargs)[source]
Plot the stream data
- Parameters:
type (str, plot type)
procset (str, identifier to set on which dataset the processing should be applied to)
apply_to (str, default 'all', whether to apply function to all streams or just the current selection)
use_windows (bool, default True, whether to apply the processing to windows)
- plot_CC(procset=None, method=None, dc_mode=0, pseudosection=True, **kwargs)[source]
Plot the combined dispersion curves
- Parameters:
procset (str, identifier to set on which dataset the processing should be applied to)
method (str, method used to obtain dispersion curve)
dc_mode (int, default 0, mode of propagation)
pseudosection (bool, plot as pseudosection)
kwargs (arguments for the processing)
- plot_curves(procset=None, method=None, dc_mode=0, apply_to='all', use_windows=True, **kwargs)[source]
Plot a dispersion curve
- Parameters:
procset (str, identifier to set on which dataset the processing should be applied to)
method (str, method used to obtain dispersion curve)
dc_mode (int, default 0, mode of propagation)
apply_to (str, default 'all', whether to apply function to all streams or just the current selection)
use_windows (bool, default True, whether to apply the processing to windows)
- plot_streams(type='seismogram', procset=None, apply_to='all', use_windows=True, **kwargs)[source]
Plot the stream data
- Parameters:
type (str, plot type)
procset (str, identifier to set on which dataset the processing should be applied to)
apply_to (str, default 'all', whether to apply function to all streams or just the current selection)
use_windows (bool, default True, whether to apply the processing to windows)
- preprocess(type='trim', procset=None, apply_to='all', use_windows=True, **kwargs)[source]
Apply preprocessing steps to current selection or all data sets
- Parameters:
type (str, processing type)
procset (str, identifier to set on which dataset the processing should be applied to)
apply_to (str, default 'all', whether to apply function to all streams or just the current selection)
use_windows (bool, default True, whether to apply the processing to windows)
- preprocess_streams(type='trim', procset=None, apply_to='all', use_windows=True, **kwargs)[source]
Apply preprocessing steps to current selection or all data sets
- Parameters:
type (str, processing type)
procset (str, identifier to set on which dataset the processing should be applied to)
apply_to (str, default 'all', whether to apply function to all streams or just the current selection)
use_windows (bool, default True, whether to apply the processing to windows)
- process_CC(type='smooth', procset=None, method=None, dc_mode=0, **kwargs)[source]
Process the combined dispersion curves
- Parameters:
type (str, which processing method to call)
procset (str, identifier to set on which dataset the processing should be applied to)
method (str, method used to obtain dispersion curve)
dc_mode (int, default 0, mode of propagation)
kwargs (arguments for the processing)
- process_curves(type='smooth', procset=None, method=None, dc_mode=0, apply_to='all', use_windows=True, **kwargs)[source]
Apply a process to a dispersion curve
- Parameters:
type (str, which processing method to call)
procset (str, identifier to set on which dataset the processing should be applied to)
method (str, method used to obtain dispersion curve)
dc_mode (int, default 0, mode of propagation)
apply_to (str, default 'all', whether to apply function to all streams or just the current selection)
use_windows (bool, default True, whether to apply the processing to windows)
kwargs (arguments for the processing)
- save(procset=None, method=None, dc_mode=0, apply_to='all', use_windows=True, **kwargs)[source]
Save the dispersion curves based on receiver spread midpoint
- Parameters:
procset (str, identifier to set on which dataset the processing should be applied to)
method (str, method used to obtain dispersion curve)
dc_mode (int, default 0, mode of propagation)
apply_to (str, default 'all', whether to apply function to all streams or just the current selection)
use_windows (bool, default True, whether to apply the processing to windows)
- save_CC(procset=None, method=None, dc_mode=0, format='csv', **kwargs)[source]
Save the dispersion curves based on receiver spread midpoint
- Parameters:
procset (str, identifier to set on which dataset the processing should be applied to)
method (str, method used to obtain dispersion curve)
dc_mode (int, default 0, mode of propagation)
format (str, default 'csv', in which format the dispersion curve should be saved (dinver and ParkSeis support))
- save_curves(procset=None, method=None, dc_mode=0, apply_to='all', use_windows=True, **kwargs)[source]
Save the dispersion curves based on receiver spread midpoint
- Parameters:
procset (str, identifier to set on which dataset the processing should be applied to)
method (str, method used to obtain dispersion curve)
dc_mode (int, default 0, mode of propagation)
apply_to (str, default 'all', whether to apply function to all streams or just the current selection)
use_windows (bool, default True, whether to apply the processing to windows)
- transform(method='phaseshift', procset=None, apply_to='all', use_windows=True, **kwargs)[source]
Apply wavefield transformation to current selection or all data sets
- Parameters:
type (str, transformation method)
procset (str, identifier to set on which dataset the processing should be applied to)
apply_to (str, default 'all', whether to apply function to all streams or just the current selection)
use_windows (bool, default True, whether to apply the processing to windows)
- transform_streams(method='phaseshift', procset=None, apply_to='all', use_windows=True, **kwargs)[source]
Apply wavefield transformation to current selection or all data sets
- Parameters:
method (str, transformation method)
procset (str, identifier to set on which dataset the processing should be applied to)
apply_to (str, default 'all', whether to apply function to all streams or just the current selection)
use_windows (bool, default True, whether to apply the processing to windows)
- class pyswapp.manager.Tomo2DManager(prjdir, path2raw=None, path2geom=None, settings=None, database='swa.db', **kwargs)[source]
Bases:
BaseManager- apply_filter(procset=None, apply_to='all', use_windows=True, ftype='FK', uniq_per_rep=True, uniq_per_wid=True, **kwargs)[source]
Apply filter to current selection or all data sets
- Parameters:
procset (str, identifier to set on which dataset the processing should be applied to)
apply_to (str, default 'all', whether to apply function to all streams or just the current selection)
use_windows (bool, default True, whether to apply the processing to windows)
ftype (string, default 'FK', filter type)
uniq_per_rep (bool, default True, whether a unique filter exists for each rep)
uniq_per_wid (bool, default True, whether a unique filter exists for each wid)
- compute_phasediff(procset=None)[source]
Compute phase differences and store in database
- Parameters:
procset (str, identifier to set on which dataset the processing should be applied to)
- plot(type='seismogram', procset=None, apply_to='all', use_windows=True, **kwargs)[source]
Plot the stream data
- Parameters:
type (str, plot type)
procset (str, identifier to set on which dataset the processing should be applied to)
apply_to (str, default 'all', whether to apply function to all streams or just the current selection)
use_windows (bool, default True, whether to apply the processing to windows)
- plot_curves(procset=None, method='tomo2D', dc_mode=0, **kwargs)[source]
Plot dispersion curves
- Parameters:
procset (str, identifier to set on which dataset the processing should be applied to)
method (str, method used to obtain dispersion curve)
dc_mode (int, default 0, mode of propagation)
- plot_streams(type='seismogram', procset=None, apply_to='all', use_windows=True, **kwargs)[source]
Plot the stream data
- Parameters:
type (str, plot type)
procset (str, identifier to set on which dataset the processing should be applied to)
apply_to (str, default 'all', whether to apply function to all streams or just the current selection)
use_windows (bool, default True, whether to apply the processing to windows)
- prepare_streams(min_offset=-inf, max_offset=inf, min_rec=6, max_rec=None, procset=None)[source]
retrieve subsets of the data based on forward and reverse offset shots
- Parameters:
min_offset (float, minimum offset (in m) to consider for trimming stream)
max_offset (float, maximum offset (in m) to consider for trimming stream)
min_rec (int, mininum number of receivers to keep for trimming down data)
max_rec (int, maximum number of receivers to keep for trimming down data)
procset (str, identifier to set on which dataset the processing should be applied to)
- preprocess(type='trim', procset=None, apply_to='all', use_windows=True, **kwargs)[source]
Apply preprocessing steps to current selection or all data sets
- Parameters:
type (str, processing type)
procset (str, identifier to set on which dataset the processing should be applied to)
apply_to (str, default 'all', whether to apply function to all streams or just the current selection)
use_windows (bool, default True, whether to apply the processing to windows)
- preprocess_streams(type='trim', procset=None, apply_to='all', use_windows=True, **kwargs)[source]
Apply preprocessing steps to current selection or all data sets
- Parameters:
type (str, processing type)
procset (str, identifier to set on which dataset the processing should be applied to)
apply_to (str, default 'all', whether to apply function to all streams or just the current selection)
use_windows (bool, default True, whether to apply the processing to windows)
- process_curves(type='smooth', procset=None, method='tomo2D', dc_mode=0, **kwargs)[source]
Apply a process to a dispersion curve
- Parameters:
type (str, which processing method to call)
procset (str, identifier to set on which dataset the processing should be applied to)
method (str, method used to obtain dispersion curve)
dc_mode (int, default 0, mode of propagation)
kwargs (arguments for the processing)
- run(min_offset=3, max_offset=1000000.0, lam=1, abs_err=None, rel_err=None, procset=None, opt_lam=False, scale=0.6, lam_max=200, **kwargs)[source]
Run the tomographic like approach
- Parameters:
min_offset (float, minimum offset to consider for trimming stream)
max_offset (float, maximum offset to consider for trimming stream)
lam (int, regularization strength)
rel_err (float or None, default None, error to consider in the error-weighted least-squares approach)
procset (str, identifier to set on which dataset the processing should be applied to)
opt_lam (bool, use constant lambda or find optimum lambda per iteration)
scale (float, percentage value to decrease lambda)
lam_max (int, maximum value of lambda)
- save(procset=None, method='tomo2D', dc_mode=0, format='csv', **kwargs)[source]
Save the dispersion curves based on receiver spread midpoint
- Parameters:
procset (str, identifier to set on which dataset the processing should be applied to)
method (str, method used to obtain dispersion curve)
dc_mode (int, default 0, mode of propagation)
format (str, default 'csv', in which format the dispersion curve should be saved (dinver and ParkSeis support))
- save_curves(procset=None, method='tomo2D', dc_mode=0, format='csv', **kwargs)[source]
Save the dispersion curves based on receiver spread midpoint
- Parameters:
procset (str, identifier to set on which dataset the processing should be applied to)
method (str, method used to obtain dispersion curve)
dc_mode (int, default 0, mode of propagation)
format (str, default 'csv', in which format the dispersion curve should be saved (dinver and ParkSeis support))
pyswapp.qtapps module
- class pyswapp.qtapps.CurveFilter(data)[source]
Bases:
QWidgetUser interface to manually remove points from multiple curves
- class pyswapp.qtapps.DataSwitcherBase(data, sql, plot='TX', use_windows=False, interaction_class=None, procset=None, procsets=None, btn_label='Click me', window_label='SHOTFILES', window_title='SWA Viewer', select_plot=True, **kwargs)[source]
Bases:
QWidgetBase user interface to manipulate seismic dataset
- index_changed
- index_pair_changed
- plot_changed
- procset_changed
- class pyswapp.qtapps.DataSwitcherFilter(data, sql, plot='FK', use_windows=False, procset=None, procsets=None, select_plot=True, interaction_class=None, **kwargs)[source]
Bases:
DataSwitcherBaseManual filter interface.
- class pyswapp.qtapps.DataSwitcherFilterFK(data, sql, plot='FK', use_windows=False, procset=None, procsets=None, select_plot=True, **kwargs)[source]
Bases:
DataSwitcherFilterManual FK filter interface.
- class pyswapp.qtapps.DataSwitcherFilterTX(data, sql, plot='TX', use_windows=False, procset=None, procsets=None, select_plot=True, **kwargs)[source]
Bases:
DataSwitcherFilterManual FK filter interface.
- class pyswapp.qtapps.DataSwitcherPick(data, sql, plot='FV', use_windows=False, procset=None, procsets=None, select_plot=True, **kwargs)[source]
Bases:
DataSwitcherBaseManual dispersion curve picking interface
pyswapp.stream module
python class for manipulating an Obspy stream
- class pyswapp.stream.SeismicStream(fname, settings=None, channel_nr=1001, pre_trigger=0)[source]
Bases:
objectclass to manipulate a seismic record for the analysis of surface waves
- apply_geometry(source_coordinates, receiver_coordinates)[source]
Apply the survey geometry to the seismic data
- compute_phasediffs()[source]
compute phase differences between adjacent receivers for one shot file
- dcpicking(pck_mode='auto', auto_method='max', **kwargs)[source]
automatic or interactive dispersion curve picking
- moving_window(**kwargs)[source]
Move a window along the trace data to select a subset and store it in a dictionary
- property offset
- preprocess_windows(windows, type='filter', **kwargs)[source]
run a preprocessing step on all windows
- read_data(fname, channel_nr=1001, pre_trigger=0, extract_geometry=False)[source]
read a shotfile and extract relevant information
- Parameters:
fname (str, file name)
channel_nr (int, optional)
pre_trigger (float, optional)
extract_geometry (bool, True if geometry should be extracted, False otherwise)
- resample(sampling_rate, window='hann', no_filter=True, strict_length=False)[source]
resample data in all traces using the method from obspy method