Skip to content

Commit

Permalink
Merge pull request #166 from swiss-seismological-service/160-document…
Browse files Browse the repository at this point in the history
…ation_b_to_beta

added to docs, few changes to redfuces number of error messages when …
  • Loading branch information
aronsho committed Jun 21, 2024
2 parents fe92599 + cb5e89c commit ab23458
Show file tree
Hide file tree
Showing 7 changed files with 55 additions and 17 deletions.
11 changes: 11 additions & 0 deletions docs/source/reference/analysis.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
shi_bolt_confidence
analysis.estimate_b_tinti
analysis.estimate_b_positive
analysis.estimate_b_more_positive
analysis.estimate_b_utsu
analysis.estimate_b_laplace
analysis.estimate_b_weichert
Expand All @@ -27,4 +28,14 @@
analysis.mc_ks
analysis.mc_max_curvature
```

## Other
```{eval-rst}
.. autosummary::
:toctree: api/
analysis.make_more_incomplete
analysis.beta_to_b_value
analysis.b_value_to_beta
```
26 changes: 25 additions & 1 deletion docs/source/reference/catalog.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,35 @@
Catalog
```

## Transformation
## Modify Catalog

```{eval-rst}
.. autosummary::
:toctree: api/
Catalog.bin_magnitudes
Catalog.strip
Catalog.drop_ids
Catalog.drop_uncertainties
```

## Estimate from Catalog

```{eval-rst}
.. autosummary::
:toctree: api/
Catalog.estimate_b
Catalog.estimate_mc
```

## Transform from or to other format

```{eval-rst}
.. autosummary::
:toctree: api/
Catalog.to_quakeml
Catalog.from_quakeml
Catalog.from_dict
```
2 changes: 1 addition & 1 deletion docs/source/reference/utils.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
:toctree: api/
utils.simulate_magnitudes
utils.simulated_magnitudes_binned
utils.simulate_magnitudes_binned
```

Expand Down
10 changes: 5 additions & 5 deletions docs/source/user/getting_started.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,28 +8,28 @@ We didn't reinvent the wheel and rely on existing libraries and packages to perf

### GEOS
The plotting of the seismicity requires [GEOS](https://libgeos.org/), a C/C++ library for computational geometry. If `GEOS` is not installed on your machine, you will need to get it, for example on a linux machine with
```terminal
```console
sudo apt-get libgeos-dev
```
or on a mac with
```terminal
```console
brew install geos
```

## Using SeismoStats in another code

### Install from source
This way of installing `SeismoStats` in another environement allows you to use the static version.
```terminal
```console
pip install git+https://github.com/swiss-seismological-service/SeismoStats.git
```

If you want to install a specific branch:
```terminal
```console
pip install git+https://github.com/swiss-seismological-service/SeismoStats.git@feature/branch
```

To update your environment to the latest version of `SeismoStats`:
```terminal
```console
pip install --force-reinstall git+https://github.com/swiss-seismological-service/SeismoStats.git
```
5 changes: 4 additions & 1 deletion seismostats/analysis/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,8 @@
estimate_b_weichert,
estimate_b_kijko_smit,
estimate_b_more_positive,
make_more_incomplete)
make_more_incomplete,
beta_to_b_value,
b_value_to_beta
)
from seismostats.analysis.estimate_mc import mc_ks, mc_max_curvature
5 changes: 2 additions & 3 deletions seismostats/analysis/estimate_beta.py
Original file line number Diff line number Diff line change
Expand Up @@ -404,7 +404,7 @@ def make_more_incomplete(
Source:
E. Lippiello and G. Petrillo. Journal of Geophysical Research: Solid
- Earth, 129(2):e2023JB027849, 2024.
Earth, 129(2):e2023JB027849, 2024.
Args:
magnitudes: array of magnitudes, sorted in time (first
Expand All @@ -419,8 +419,7 @@ def make_more_incomplete(
magnitudes: filtered array of magnitudes
times: filtered array of datetime objects
idx: indices of the events that were kept
"""
"""

# sort magnitudes in time
idx_sort = np.argsort(times)
Expand Down
13 changes: 7 additions & 6 deletions seismostats/analysis/estimate_mc.py
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ def ks_test_gr(
)

for ii in range(n):
simulated = simulated_all[n_sample * ii : n_sample * (ii + 1)]
simulated = simulated_all[n_sample * ii: n_sample * (ii + 1)]
_, y_th = cdf_discrete_GR(simulated, mc=mc, delta_m=delta_m, beta=beta)
_, y_emp = empirical_cdf(simulated)

Expand Down Expand Up @@ -303,12 +303,13 @@ def mc_max_curvature(
catalogues: Estimating the magnitude of completeness and its
uncertainty.
Bulletin of the Seismological Society of America, 95(2), pp.684-698.
Args:
sample: Magnitudes to test
delta_m: Magnitude bins (sample has to be rounded to bins
beforehand)
correction_factor: Correction factor for the maximum curvature method
(default 0.2 after Woessner & Wiemer 2005)
sample: Magnitudes to test
delta_m: Magnitude bins (sample has to be rounded to bins beforehand)
correction_factor: Correction factor for the maximum curvature
method (default 0.2 after Woessner & Wiemer 2005)
Returns:
mc: estimated completeness magnitude
"""
Expand Down

0 comments on commit ab23458

Please sign in to comment.