pyswapp.utils package
Submodules
pyswapp.utils.interactive module
- class pyswapp.utils.interactive.DCPickingInteractive(ax, points=None, data=None, freq=None, vel=None, power=None, offsets=None, picks=None, **kwargs)[source]
Bases:
DraggablePointsclass for drawing boundaries for dispersion curve extraction
- property picks
- property polygons
- class pyswapp.utils.interactive.DraggablePoints(ax, points=None, **kwargs)[source]
Bases:
object- property points
pyswapp.utils.inversion module
- pyswapp.utils.inversion.lambda_search(f, A, dphi, w, scale=0.6, lam_max=200)[source]
Search for optimum weight
- Parameters:
f (float, frequency value of the analysis)
A (np.ndarray, design matrix)
dphi (np.ndarray, phase differences)
w (np.ndarray, weights)
scale (float, percentage value to decrease lambda)
lam_max (int, maximum value of lambda)
- Returns:
lam
- Return type:
int, optimal lambda
- pyswapp.utils.inversion.linear_LSQR(x, y, w=None)[source]
Estimate coefficients of a line y = k*x+phi0
- Parameters:
x (np.ndarray, offsets)
y (np.ndarray, phases)
w (np.ndarray, weights)
- Returns:
k (float, wavenumber)
phi0 (float, shift)
- pyswapp.utils.inversion.tomo2D_phasediff(lam, f, A, dphi, w)[source]
Tomographic like approach (Barone et al., 2019)
- Parameters:
lam (int, regularization strength)
f (float, frequency value of the analysis)
A (np.ndarray, design matrix)
dphi (np.ndarray, phase differences)
w (np.ndarray, weights)
- Returns:
phi_vel (np.ndarray, phase velocities)
phi_model (np.ndarray, predicted phase differences)
pyswapp.utils.physics module
- pyswapp.utils.physics.lorentzian_err(offsets, vel, f, nchannels=24, dx=1, **kwargs)[source]
Estimate dispersion-curve uncertainty after O’Neill et al. (2003).
- Parameters:
offsets (array-like or None) – Receiver offsets. If provided, dx and nchannels are inferred from it.
vel (float or array-like) – Phase velocity.
f (float or array-like) – Frequency.
nchannels (int, optional) – Number of channels (ignored if offsets provided).
dx (float, optional) – Receiver spacing (ignored if offsets provided).
maxerr (float) – Maximum relative velocity error (e.g., 0.4 means ≤40% of velocity).
minvelerr (float) – Minimum absolute velocity error (m/s).
a (float) – Parameter controlling error-bar tightening.
- Returns:
deltac – Estimated dispersion-curve error.
- Return type:
float or np.ndarray
References
O’Neill, A., Dentith, M., & List, R., 2003. Full-waveform P-SV reflectivity inversion of surface waves for shallow engineering applications, Exploration Geophysics, 34(3), 158–173.
pyswapp.utils.plot_settings module
pyswapp.utils.plotting module
- pyswapp.utils.plotting.calculate_new_limit(fixed, dependent, limit)[source]
Calculates the min/max of the dependent axis given a fixed axis with limits
- pyswapp.utils.plotting.discrete_cmap(N, base_cmap=None)[source]
Create an N-bin discrete colormap from the specified input map
- pyswapp.utils.plotting.draw1DColumn(ax, x, val, thk=None, depth=None, width=1, vmin=1, vmax=1000, cmap=None)[source]
draw a 1D column based on thicknesses or depths
- pyswapp.utils.plotting.plot_colorBar(ax, vmin, vmax, orientation='vertical', size=0.2, pad=None, **kwargs)[source]
create and plot a colorbar
pyswapp.utils.settings module
- pyswapp.utils.settings.create_settings(zero_padding=False, freq_step=1, normalize=True, local_max=True, fmin=0, fmax=100, vmin=100, vmax=1000, velstep=1, SFR_time=2, kmin=0, kmax=None, normalize_power=True, local_max_power=False, window_length=10, window_min_offset=-inf, window_max_offset=inf, window_move_increment=1)[source]
create settings dictionary
- Parameters:
zero_padding (bool, add zeros to increase signal length)
freq_step (int, desired frequency step for zero padding)
normalize (bool, normalize amplitudes)
local_max (bool, normalize each trace based on local maximum)
fmin (float, minimum frequency to analyse)
fmax (float, maximum frequency to analyse)
vmin (float, minimum testing velocity)
vmax (float, maximum testing velocity)
velstep (float, velocity increment)
SFR_time (float, time for computing swept-frequency record (SFR))
kmin (float, minimum wavenumber)
kmax (float, maximum wavenumber)
normalize_power (bool, normalize amplitudes)
local_max_power (bool, normalize each trace based on local maximum)
window_length (int, spatial window length)
window_min_offset (float, minimum offset to exclude near-field)
window_max_offset (float, maximum offset to exclude near-field)
window_move_increment (int, move increment of spatial window)
pyswapp.utils.sql module
- class pyswapp.utils.sql.SQL(database)[source]
Bases:
objectHandle an SQLite database.
- get_geometry(sin, rep=1)[source]
Return source/receiver coordinates for one source location and shot index.
- read_FV(sin, rep, procset='proc1', method='phaseshift', wid=-1)[source]
read dispersive energy data from SQL table ‘dispersive_energy’
- read_geometry(geometry_file)[source]
Read geometry CSV file and populate geometry, shots, and receivers tables.
- read_pd(sin, procset='proc1', calc='NONE', columns='*')[source]
Read phase-difference data from SQL table ‘phase_differences’.
- to_sql(df, name, if_exists='fail', **kwargs)[source]
Write data stored in a DataFrame to a SQL database.
- write_FV(data, sin, rep, procset='proc1', wid=-1)[source]
write dispersive energy data to SQL table ‘dispersive_energy’
- write_curve(data, sin, rep, procset='proc1', wid=-1, xmid=0)[source]
Write dispersion curve data to SQL table ‘curves’.
- write_data(data, sin, rep, procset, wid=-1)[source]
Write amplitude data in TX domain to SQL table ‘amplitudes’.
pyswapp.utils.utils module
- pyswapp.utils.utils.create_geometry(path2raw: str, path2geom: str = 'geometry.csv') None[source]
create a geometry.csv from seismic shot files (.sgy and .sg2 file formats)
This function can be used to convert the source and geophone coordinate information contained in the seismic raw data to the geometry file format. The geometry file is a csv file that stores an abstract representation of the survey layout, that can be optionally passed to some modules. Check out docs/geometry_file.pdf for a description of the format.
- Parameters:
path2raw (str, paths to shot files)
path2geom (str, path to geometry file)
- pyswapp.utils.utils.get_fileList(path2raw)[source]
get the paths to the shot files from the geometry.csv file
- pyswapp.utils.utils.get_shotfiles_from_geometry(path2raw, shot_files, extension='.sg2', sort_ascending=True)[source]
get the paths to the shot files from the geometry.csv file