Package: disba
disbais a computationally efficient Python library for the modeling of surface wave dispersion that implements a subset of codes fromComputer Programs in Seismology (CPS)in Python compiledjust-in-timewithnumba. Such implementation alleviates the usual prerequisite for a Fortran compiler needed by other libraries also based on CPS (e.g.,pysurf96,srfpythonandPyLayeredModel) which often leads to further installation troubleshooting, especially on Windows platform.disbaaims to be lightweight and portable without compromising on the performance. For both Rayleigh-wave and Love-wave, it is significantly faster than CPS’ssurf96program compiled withf2py, noticeably for large number of layers.FeaturesForward modeling:Compute Rayleigh-wave phase or group dispersion curves usingDunkin’s matrixorfast delta matrixalgorithms,Compute Love-wave phase or group dispersion curves usingThomson-Haskellmethod,Compute Rayleigh-wave ellipticity.Eigenfunctions and sensitivity kernels:Compute Rayleigh- and Love- wave eigenfunctions,Compute Rayleigh- and Love- wave phase or group velocity, and Rayleigh-wave ellipticity sensitivity kernels with respect to layer thickness, P- and S- wave velocities, and density.InstallationThe recommended way to installdisbaand all its dependencies is through the Python Package Index:pipinstalldisba[full]--userOtherwise, clone and extract the package, then run from the package location:pipinstall.[full]--userTo test the integrity of the installed package, check out this repository and run:pytestDocumentationRefer to the onlinedocumentationfor detailed description of the API and examples.Alternatively, the documentation can be built usingSphinx:pipinstall-rdoc/requirements.txtsphinx-build-bhtmldoc/sourcedoc/buildUsageThe following example computes the Rayleigh- and Love- wave phase velocity dispersion curves for the 3 first modes.importnumpyasnpfromdisbaimportPhaseDispersion# Velocity model# thickness, Vp, Vs, density# km, km/s, km/s, g/cm3velocity_model=np.array([[10.0,7.00,3.50,2.00],[10.0,6.80,3.40,2.00],[10.0,7.00,3.50,2.00],[10.0,7.60,3.80,2.00],[10.0,8.40,4.20,2.00],[10.0,9.00,4.50,2.00],[10.0,9.40,4.70,2.00],[10.0,9.60,4.80,2.00],[10.0,9.50,4.75,2.00],])# Periods must be sorted starting with low periodst=np.logspace(0.0,3.0,100)# Compute the 3 first Rayleigh- and Love- wave modal dispersion curves# Fundamental mode corresponds to mode 0pd=PhaseDispersion(*velocity_model.T)cpr=[pd(t,mode=i,wave="rayleigh")foriinrange(3)]cpl=[pd(t,mode=i,wave="love")foriinrange(3)]# pd returns a namedtuple (period, velocity, mode, wave, type)Likewise,GroupDispersioncan be used for group velocity.disba’s API is consistent across all its classes which are initialized and called in the same fashion. Thus, eigenfunctions are calculated as follow:fromdisbaimportEigenFunctioneigf=EigenFunction(*velocity_model.T)eigr=eigf(20.0,mode=0,wave="rayleigh")eigl=eigf(20.0,mode=0,wave="love")# eigf returns a namedtuple#  - (depth, ur, uz, tz, tr, period, mode) for Rayleigh-wave#  - (depth, uu, tt, period, mode) for Love-wavePhase velocity sensitivity kernels (GroupSensitivityfor group velocity):fromdisbaimportPhaseSensitivityps=PhaseSensitivity(*velocity_model.T)parameters=["thickness","velocity_p","velocity_s","density"]skr=[ps(20.0,mode=0,wave="rayleigh",parameter=parameter)forparameterinparameters]skl=[ps(20.0,mode=0,wave="love",parameter=parameter)forparameterinparameters]# ps returns a namedtuple (depth, kernel, period, velocity, mode,wave, type, parameter)Ellipticity and ellipticity sensitivity kernels:fromdisbaimportEllipticity,EllipticitySensitivityell=Ellipticity(*velocity_model.T)rel=ell(t,mode=0)# ell returns a namedtuple (period, ellipticity, mode)es=EllipticitySensitivity(*velocity_model.T)ek=[es(20.0,mode=0,parameter=parameter)forparameterinparameters]# es returns a namedtuple (depth, kernel, period, velocity, mode, wave, type, parameter)ContributingPlease refer to theContributing
Guidelinesto see how you can help. This project is released with aCode of Conductwhich you agree to abide by when contributing.