Skip to content

Commit

Permalink
Merge pull request #4 from jpvantassel/dev
Browse files Browse the repository at this point in the history
In preparation for v1.0.0 release
  • Loading branch information
jpvantassel authored Nov 5, 2021
2 parents c1cfad9 + e3709af commit df5e40d
Show file tree
Hide file tree
Showing 7 changed files with 39 additions and 38 deletions.
18 changes: 10 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,13 @@
> Joseph P. Vantassel, The University of Texas at Austin
[![DOI](https://zenodo.org/badge/222287042.svg)](https://zenodo.org/badge/latestdoi/222287042)
[![PyPI - License](https://img.shields.io/pypi/l/hvsrpy)](https://github.com/jpvantassel/swprepost/blob/main/LICENSE.txt)
[![CircleCI](https://circleci.com/gh/jpvantassel/swprepost.svg?style=svg)](https://circleci.com/gh/jpvantassel/swprepost)
[![Documentation Status](https://readthedocs.org/projects/swprepost/badge/?version=latest)](https://swprepost.readthedocs.io/en/latest/?badge=latest)
[![Language grade: Python](https://img.shields.io/lgtm/grade/python/g/jpvantassel/swprepost.svg?logo=lgtm&logoWidth=18)](https://lgtm.com/projects/g/jpvantassel/swprepost/context:python)
[![Codacy Badge](https://app.codacy.com/project/badge/Grade/150eb75dee3848f5bbfac0d9f2c33644)](https://www.codacy.com/manual/jpvantassel/swprepost?utm_source=github.com&utm_medium=referral&utm_content=jpvantassel/swprepost&utm_campaign=Badge_Grade)
[![codecov](https://codecov.io/gh/jpvantassel/swprepost/branch/master/graph/badge.svg)](https://codecov.io/gh/jpvantassel/swprepost)
[![codecov](https://codecov.io/gh/jpvantassel/swprepost/branch/main/graph/badge.svg?token=N5kQxjr2RB)](https://codecov.io/gh/jpvantassel/swprepost)
![PyPI - Python Version](https://img.shields.io/pypi/pyversions/swprepost)

## Table of Contents

Expand Down Expand Up @@ -40,8 +42,8 @@ following:
_Note: For software, version specific citations should be preferred to general_
_concept citations, such as that listed above. To generate a version specific_
_citation for `swprepost`, please use the citation tool for that specific_
_version on the `swprepost` [archive](https://doi.org/10.5281/zenodo.3839998)._
_citation for _swprepost_, please use the citation tool for that specific_
_version on the _swprepost_ [archive](https://doi.org/10.5281/zenodo.3839998)._

For the motivation behind the development of _swprepost_ and its role in a
larger project focused on developing a complete and rigorous workflow for
Expand Down Expand Up @@ -116,11 +118,11 @@ plt.show()
so. A detailed set of instructions can be found
[here](https://jpvantassel.github.io/python3-course/#/intro/installing_python).

2. If you have not installed `swprepost` previously use
2. If you have not installed _swprepost_ previously use
`pip install swprepost`. If you are not familiar with `pip`, a useful tutorial
can be found [here](https://jpvantassel.github.io/python3-course/#/intro/pip).
If you have an earlier version and would like to upgrade to the latest version
of `swprepost` use `pip install swprepost --upgrade`.
of _swprepost_ use `pip install swprepost --upgrade`.

3. Confirm that `swprepost` has installed/updated successfully by examining the
last few lines of text displayed in the console.
Expand All @@ -133,13 +135,13 @@ last few lines of text displayed in the console.

2. Explore the Jupyter notebooks in the
[basic](https://github.com/jpvantassel/swprepost/tree/main/examples/basic)
directory for a no-coding-required introduction to the `swprepost` package.
directory for a no-coding-required introduction to the _swprepost_ package.
If you have not installed `Jupyter`, detailed instructions can be found
[here](https://jpvantassel.github.io/python3-course/#/intro/installing_jupyter).

3. Move to the [adv](https://github.com/jpvantassel/swprepost/tree/main/examples/adv)
directory and follow the Jupyter notebook title `SWinvertWorkflow.ipynb` for
an example application of `swprepost` to the SWinvert workflow
directory and follow the Jupyter notebook title `example_swinvert_workflow.ipynb` for
an example application of _swprepost_ to the SWinvert workflow
(Vantassel and Cox, 2021).

4. Enjoy!
2 changes: 1 addition & 1 deletion swprepost/dispersioncurve.py
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ def _parse_dc(cls, dc_data):
----------
dc_data : str
Dispersion curve data of the form `frequency, slowness`.
It is assumed that frequencies increases monitonically. If
It is assumed that frequencies increases monotonically. If
this assumption is not true, incorrect results will result.
See example below.
Expand Down
10 changes: 5 additions & 5 deletions swprepost/groundmodel.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <https: //www.gnu.org/licenses/>.

"""GroundModel class definiton."""
"""GroundModel class definition."""

import logging

Expand Down Expand Up @@ -85,7 +85,7 @@ def check_input_value(**kwargs):
Specifically:
1. Check that all `GroundModel` parameters are greater than
zero.
2. Check that identifer and misfit are greater than zero.
2. Check that identifier and misfit are greater than zero.
3. Check that `vp` > `vs`.
Parameters
Expand Down Expand Up @@ -357,7 +357,7 @@ def discretize(self, dmax, dy=0.5, parameter='vs'):
dmax : float
Maximum depth of discretization.
dy : float, optional
Linear step of discretizaton in terms of depth, default
Linear step of discretization in terms of depth, default
is 0.5 meter.
parameter : {'vp', 'vs', 'rh', 'pr'}, optional
Parameter to be discretized, default is 'vs'.
Expand Down Expand Up @@ -613,7 +613,7 @@ def write_to_txt(self, fname):

@classmethod
def _gm(cls):
"""Helper to allow conveinient subclassing."""
"""Helper to allow convenient subclassing."""
return GroundModel

@classmethod
Expand All @@ -630,7 +630,7 @@ def _parse_gm(cls, gm_data, identifier, misfit):
defining multiple GroundModels is provided only the first
one is parsed.
identifier : str
Indentifier string.
Identifier string.
misfit : str
Misfit string.
Expand Down
3 changes: 1 addition & 2 deletions swprepost/groundmodelsuite.py
Original file line number Diff line number Diff line change
Expand Up @@ -335,9 +335,8 @@ def from_geopsy(cls, fname, nmodels="all", sort=False):
"""
# TODO (jpv): Add warning if nsets < navailable.
# TODO (jpv): Strange if statement below.
if nmodels == "all":
nmodels = 1E9
nmodels = np.inf

with open(fname, "r") as f:
lines = f.read()
Expand Down
2 changes: 1 addition & 1 deletion swprepost/meta.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,4 @@

"""Metadata for swprepost."""

__version__ = "1.0.0rc0"
__version__ = "1.0.0"
38 changes: 19 additions & 19 deletions swprepost/parameter.py
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ def __init__(self, lay_min, lay_max, par_min, par_max, par_rev,
Indicate whether to allow parameter reversals, one
`bool` per layer.
lay_type : {'thickness', 'depth'}, optional
Inidcate whether the layers are defined in terms of
Indicate whether the layers are defined in terms of
depth or thickness.
"""
if lay_type == "thickness":
Expand Down Expand Up @@ -156,7 +156,7 @@ def from_fx(cls, value):
raise TypeError(msg)

if value <= 0:
raise ValueError("`value` must be postive.")
raise ValueError("`value` must be positive.")

obj = cls(lay_min=[1824], lay_max=[1883],
par_min=[value], par_max=[value], par_rev=[False])
Expand Down Expand Up @@ -245,7 +245,7 @@ def depth_ftl(nlayers, thickness):
def from_ftl(cls, nlayers, thickness, par_min, par_max, par_rev=False):
"""Alternate constructor to instantiate a `Parameter` using FTL.
Use Fixed Thickenss Layering (FTL) to define the
Use Fixed Thickness Layering (FTL) to define the
parameterization.
Parameters
Expand Down Expand Up @@ -294,12 +294,12 @@ def depth_ln_thickness(wmin, wmax, nlayers, depth_factor=2,
----------
wmin, wmax : float
Minimum and maximum measured wavelengths from the
fundemental mode Rayleigh wave dispersion respectively.
fundamental mode Rayleigh wave dispersion respectively.
nlayers : int
Desired number of layers.
depth_factor : [float, int], optional
Factor by which the maximum wavelength is
divided to estimate the maxium depth of profiling,
divided to estimate the maximum depth of profiling,
default is 2.
increasing : bool, optional
Indicate whether the layering thickness should be
Expand Down Expand Up @@ -342,7 +342,7 @@ def from_ln_thickness(cls, wmin, wmax, nlayers, par_min, par_max, par_rev,
----------
wmin, wmax : float
Minimum and maximum measured wavelength from the
fundemental mode Rayleigh wave disperison.
fundamental mode Rayleigh wave disperison.
nlayers : int
Desired number of layers.
par_min, par_max : float
Expand All @@ -353,15 +353,15 @@ def from_ln_thickness(cls, wmin, wmax, nlayers, par_min, par_max, par_rev,
default is `False` (i.e., no reversal allowed).
depth_factor : [float, int], optional
Factor by which the maximum wavelength is
divided to estimate the maxium depth of profiling,
divided to estimate the maximum depth of profiling,
default is 2.
increasing : bool, optional
Determines whether LN or LNI layering is used, default
is `False` meaning LN is used.
increasing_factor : float, optional
Factor by which each subsequent layer must be thicker
than the previous layer previous layer, default is 1.2.
Arguement is only used if `increasing=True`.
Argument is only used if `increasing=True`.
Returns
-------
Expand Down Expand Up @@ -398,12 +398,12 @@ def depth_ln_depth(wmin, wmax, nlayers, depth_factor=2):
----------
wmin, wmax : float
Minimum and maximum measured wavelength from the
fundemental mode Rayleigh wave disperison.
fundamental mode Rayleigh wave disperison.
nlayers : int
Desired number of layers.
depth_factor : [float, int], optional
Factor by which the maximum wavelength is
divided to estimate the maxium depth of profiling,
divided to estimate the maximum depth of profiling,
default is 2.
Returns
Expand Down Expand Up @@ -451,7 +451,7 @@ def from_ln_depth(cls, wmin, wmax, nlayers, par_min, par_max, par_rev,
----------
wmin, wmax : float
Minimum and maximum measured wavelength from the
fundemental mode Rayleigh wave disperison.
fundamental mode Rayleigh wave disperison.
nlayers : int
Desired number of layers.
par_min, par_max : float
Expand All @@ -462,7 +462,7 @@ def from_ln_depth(cls, wmin, wmax, nlayers, par_min, par_max, par_rev,
default is `False` (i.e., no reversal allowed).
depth_factor : [float, int], optional
Factor by which the maximum wavelength is
divided to estimate the maxium depth of profiling,
divided to estimate the maximum depth of profiling,
default is 2.
Returns
Expand Down Expand Up @@ -497,14 +497,14 @@ def depth_lr(wmin, wmax, lr, depth_factor=2):
----------
wmin, wmax : float
Minimum and maximum measured wavelength from the
fundemental mode Rayleigh wave dispersion.
fundamental mode Rayleigh wave dispersion.
lr : float
Layering Ratio, this controls the number of layers and
their potential thicknesses, refer to Cox and Teague
2016 for details.
depth_factor : [float, int], optional
Factor by which the maximum wavelength is
divided to estimate the maxium depth of profiling,
divided to estimate the maximum depth of profiling,
default is 2.
Returns
Expand Down Expand Up @@ -549,7 +549,7 @@ def depth_lr(wmin, wmax, lr, depth_factor=2):
layer_maxdepth.append(dmax+1) # Half-space
# ---> Otherwise, extend the current last layer
else:
# Extend the deepest potential depth of the bottomost layer
# Extend the deepest potential depth of the bottom-most layer
# to dmax.
layer_maxdepth[-2] = dmax
# Set the old last layer to the half-space
Expand All @@ -568,7 +568,7 @@ def from_lr(cls, wmin, wmax, lr, par_min, par_max, par_rev,
----------
wmin, wmax : float
Minimum and maximum measured wavelength from the
fundemental mode Rayleigh wave dispersion.
fundamental mode Rayleigh wave dispersion.
lr : float
Layering Ratio, this controls the number of layers and
their potential thicknesses, refer to Cox and Teague
Expand All @@ -581,7 +581,7 @@ def from_lr(cls, wmin, wmax, lr, par_min, par_max, par_rev,
default is `False` (i.e., no reversal allowed).
depth_factor : [float, int], optional
Factor by which the maximum wavelength is
divided to estimate the maxium depth of profiling,
divided to estimate the maximum depth of profiling,
default is 2.
Returns
Expand Down Expand Up @@ -628,7 +628,7 @@ def from_parameter_and_link(cls, par_min, par_max, par_rev,
Instantiated `Parameter` object to which you wish to link
the current parameter.
ptype : {'vs', 'pr', 'rh', 'vp'}, optional
Inversion parameter, representated by the
Inversion parameter, represented by the
`existing_parameter`, default is `vs`.
Returns
Expand Down Expand Up @@ -666,7 +666,7 @@ def make_rectangle(left, right, upper, lower):
return ([left, left, right, right],
[upper, lower, lower, upper])

def plot(self, ax=None, show_example=True):
def plot(self, ax=None, show_example=True): # pragma: no cover
# TODO (jpv): Add docstring.
if ax is None:
ax_was_none = True
Expand Down
4 changes: 2 additions & 2 deletions swprepost/parameterization.py
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ def from_min_max(cls, vp, pr, vs, rh, wv, factor=2):
If type = 'LR'
Layering follows the Layering Ratio, the next
arguement is the layering ratio followed by
argument is the layering ratio followed by
min, max, and bool.
Ex. ['LR', lr, min, max, reversal]
Expand Down Expand Up @@ -354,7 +354,7 @@ def from_param(cls, fname_prefix):
Returns
-------
Parameterization
Instantitated `Parameterization` object.
Instantiated `Parameterization` object.
Raises
------
Expand Down

0 comments on commit df5e40d

Please sign in to comment.