From bd35a5d3066142565efd898169bdaf5304632bae Mon Sep 17 00:00:00 2001 From: Aron Mirwald Date: Fri, 21 Jun 2024 14:52:28 +0200 Subject: [PATCH 1/2] added to docs, few changes to redfuces number of error messages when make server --- docs/source/reference/analysis.md | 11 +++++++++++ docs/source/reference/utils.md | 2 +- docs/source/user/getting_started.md | 10 +++++----- seismostats/analysis/__init__.py | 5 ++++- seismostats/analysis/estimate_beta.py | 5 ++--- seismostats/analysis/estimate_mc.py | 13 +++++++------ 6 files changed, 30 insertions(+), 16 deletions(-) diff --git a/docs/source/reference/analysis.md b/docs/source/reference/analysis.md index 32a18bb..70eebe8 100644 --- a/docs/source/reference/analysis.md +++ b/docs/source/reference/analysis.md @@ -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 @@ -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 ``` \ No newline at end of file diff --git a/docs/source/reference/utils.md b/docs/source/reference/utils.md index 430d5ec..2a1b675 100644 --- a/docs/source/reference/utils.md +++ b/docs/source/reference/utils.md @@ -23,7 +23,7 @@ :toctree: api/ utils.simulate_magnitudes - utils.simulated_magnitudes_binned + utils.simulate_magnitudes_binned ``` diff --git a/docs/source/user/getting_started.md b/docs/source/user/getting_started.md index ec9769e..608edc3 100644 --- a/docs/source/user/getting_started.md +++ b/docs/source/user/getting_started.md @@ -8,11 +8,11 @@ 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 ``` @@ -20,16 +20,16 @@ brew install geos ### 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 ``` \ No newline at end of file diff --git a/seismostats/analysis/__init__.py b/seismostats/analysis/__init__.py index 63494e2..553b6a1 100644 --- a/seismostats/analysis/__init__.py +++ b/seismostats/analysis/__init__.py @@ -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 diff --git a/seismostats/analysis/estimate_beta.py b/seismostats/analysis/estimate_beta.py index 7b063f7..61583cc 100644 --- a/seismostats/analysis/estimate_beta.py +++ b/seismostats/analysis/estimate_beta.py @@ -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 @@ -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) diff --git a/seismostats/analysis/estimate_mc.py b/seismostats/analysis/estimate_mc.py index 930414a..227f7e1 100644 --- a/seismostats/analysis/estimate_mc.py +++ b/seismostats/analysis/estimate_mc.py @@ -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) @@ -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 """ From cb5e89c47ef34b2ede04a66d8281042f5f3d9c9c Mon Sep 17 00:00:00 2001 From: Aron Mirwald Date: Fri, 21 Jun 2024 15:02:27 +0200 Subject: [PATCH 2/2] include Catalog methods in docs --- docs/source/reference/catalog.md | 26 +++++++++++++++++++++++++- 1 file changed, 25 insertions(+), 1 deletion(-) diff --git a/docs/source/reference/catalog.md b/docs/source/reference/catalog.md index bb44810..1780939 100644 --- a/docs/source/reference/catalog.md +++ b/docs/source/reference/catalog.md @@ -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 ``` \ No newline at end of file