Skip to content

Commit

Permalink
feat: rename all instances of catalog_tools to seismostats
Browse files Browse the repository at this point in the history
  • Loading branch information
schmidni committed Oct 29, 2023
1 parent 64a4e86 commit 978fd98
Show file tree
Hide file tree
Showing 39 changed files with 280 additions and 260 deletions.
384 changes: 212 additions & 172 deletions catalog_Tools.ipynb

Large diffs are not rendered by default.

31 changes: 0 additions & 31 deletions catalog_tools/__init__.py

This file was deleted.

22 changes: 22 additions & 0 deletions seismostats/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
"""All functions that are to be used externally are initialized here"""
# flake8: noqa

# analysis
from seismostats.analysis.estimate_beta import (estimate_b_elst,
estimate_b_laplace,
estimate_b_tinti,
estimate_b_utsu,
estimate_beta_tinti,
shi_bolt_confidence)
# plots
from seismostats.plots.basics import (plot_cum_count, plot_cum_fmd, plot_fmd,
plot_mags_in_time)
from seismostats.plots.seismicity import plot_in_space
from seismostats.plots.statistical import plot_mc_vs_b
# seismicity
from seismostats.seismicity.catalog import Catalog, ForecastCatalog
from seismostats.seismicity.rategrid import ForecastGRRateGrid, GRRateGrid
# utils
from seismostats.utils.binning import bin_to_precision
from seismostats.utils.filtering import cat_intersect_polygon
from seismostats.utils.simulate_distributions import simulate_magnitudes
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@
import numpy as np
import pandas as pd

from catalog_tools.analysis.estimate_beta import estimate_beta_tinti
from catalog_tools.utils.binning import normal_round
from catalog_tools.utils.simulate_distributions import simulate_magnitudes
from seismostats.analysis.estimate_beta import estimate_beta_tinti
from seismostats.utils.binning import normal_round
from seismostats.utils.simulate_distributions import simulate_magnitudes


def fitted_cdf_discrete(
Expand Down Expand Up @@ -152,7 +152,7 @@ def ks_test_gr(
)

for i in range(n_samples):
simulated = simulated_all[n_sample * i : n_sample * (i + 1)].copy()
simulated = simulated_all[n_sample * i: n_sample * (i + 1)].copy()
x_emp, y_emp = empirical_cdf(simulated)
y_fit_int = np.interp(x_emp, x_fit, y_fit)

Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,16 @@
import pytest

# import functions to be tested
from catalog_tools.analysis.estimate_beta import (differences, estimate_b_elst,
estimate_b_laplace,
estimate_b_tinti,
estimate_b_utsu,
estimate_b_weichert,
estimate_beta_tinti,
shi_bolt_confidence)
from catalog_tools.utils.binning import bin_to_precision
from seismostats.analysis.estimate_beta import (differences, estimate_b_elst,
estimate_b_laplace,
estimate_b_tinti,
estimate_b_utsu,
estimate_b_weichert,
estimate_beta_tinti,
shi_bolt_confidence)
from seismostats.utils.binning import bin_to_precision
# import functions from other modules
from catalog_tools.utils.simulate_distributions import simulate_magnitudes
from seismostats.utils.simulate_distributions import simulate_magnitudes


def simulate_magnitudes_w_offset(
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import numpy as np
from numpy.testing import assert_allclose, assert_equal

from catalog_tools.analysis.estimate_mc import empirical_cdf, estimate_mc
from seismostats.analysis.estimate_mc import empirical_cdf, estimate_mc


def test_empirical_cdf():
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from numpy.testing import assert_almost_equal, assert_equal

from catalog_tools.analysis.magnitudes import apply_edwards
from seismostats.analysis.magnitudes import apply_edwards


def test_apply_edwards():
Expand Down
File renamed without changes.
4 changes: 2 additions & 2 deletions catalog_tools/io/client.py → seismostats/io/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
import pandas as pd
import requests

from catalog_tools import Catalog
from catalog_tools.io.parser import parse_quakeml_response
from seismostats import Catalog
from seismostats.io.parser import parse_quakeml_response


class FDSNWSEventClient():
Expand Down
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
from pandas.api.types import is_datetime64_any_dtype, is_numeric_dtype
from responses import matchers

from catalog_tools import Catalog
from catalog_tools.io.client import FDSNWSEventClient
from seismostats import Catalog
from seismostats.io.client import FDSNWSEventClient

PATH_RESOURCES = os.path.join(os.path.dirname(os.path.abspath(__file__)),
'query.xml')
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

import numpy as np

from catalog_tools.io.parser import QuakeMLHandler, parse_quakeml
from seismostats.io.parser import QuakeMLHandler, parse_quakeml

OUT = [{'depth': '1181.640625',
'depth_uncertainty': '274.9552879',
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import pandas as pd

# Own functions
from catalog_tools.utils.binning import get_cum_fmd, get_fmd
from seismostats.utils.binning import get_cum_fmd, get_fmd


def gutenberg_richter(magnitudes: np.ndarray, b_value: float,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,11 @@
import pandas as pd
from cartopy.io import shapereader
from cartopy.mpl.gridliner import LATITUDE_FORMATTER, LONGITUDE_FORMATTER

# for map plotting
from shapely.geometry import Polygon

# Own functions
from catalog_tools.plots.basics import dot_size
from seismostats.plots.basics import dot_size


def plot_in_space(
Expand Down
Original file line number Diff line number Diff line change
@@ -1,15 +1,12 @@
# standard
import matplotlib.pyplot as plt
import numpy as np

# statistical
from scipy.stats import norm

# Own functions
from catalog_tools.analysis.estimate_beta import (
estimate_b_elst,
estimate_b_tinti,
)
from seismostats.analysis.estimate_beta import (estimate_b_elst,
estimate_b_tinti)


def plot_mc_vs_b(
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import numpy as np
from numpy.testing import assert_allclose

from catalog_tools.plots.basics import dot_size
from seismostats.plots.basics import dot_size


def test_dot_size():
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@

import pandas as pd

from catalog_tools.io.parser import parse_quakeml, parse_quakeml_file
from catalog_tools.utils import (_check_required_cols, _render_template,
require_cols)
from catalog_tools.utils.binning import bin_to_precision
from seismostats.io.parser import parse_quakeml, parse_quakeml_file
from seismostats.utils import (_check_required_cols, _render_template,
require_cols)
from seismostats.utils.binning import bin_to_precision

REQUIRED_COLS_CATALOG = ['longitude', 'latitude', 'depth',
'time', 'magnitude']
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import numpy as np
import pandas as pd

from catalog_tools.utils import _check_required_cols, require_cols
from seismostats.utils import _check_required_cols, require_cols

REQUIRED_COLS_RATEGRID = [
'longitude_min', 'longitude_max',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@

import pandas as pd

from catalog_tools.seismicity.catalog import (REQUIRED_COLS_CATALOG, Catalog,
ForecastCatalog)
from catalog_tools.utils.binning import bin_to_precision
from seismostats.seismicity.catalog import (REQUIRED_COLS_CATALOG, Catalog,
ForecastCatalog)
from seismostats.utils.binning import bin_to_precision

RAW_DATA = {'name': ['Object 1', 'Object 2', 'Object 3'],
'magnitude': [10.0, 12.5, 8.2],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
import pandas as pd
import pytest

from catalog_tools.seismicity.rategrid import (REQUIRED_COLS_RATEGRID,
ForecastGRRateGrid, GRRateGrid)
from seismostats.seismicity.rategrid import (REQUIRED_COLS_RATEGRID,
ForecastGRRateGrid, GRRateGrid)

RAW_DATA = {
'longitude_min': [-180, -90, 0, 90],
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
from catalog_tools.utils.binning import normal_round_to_int, normal_round
from catalog_tools.utils.binning import bin_to_precision
from catalog_tools.utils.binning import get_fmd, get_cum_fmd


import pytest
import numpy as np
import pytest

from seismostats.utils.binning import (bin_to_precision, get_cum_fmd, get_fmd,
normal_round, normal_round_to_int)


@pytest.mark.parametrize(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

import unittest

from catalog_tools.utils.coordinates import CoordinateTransformer
from seismostats.utils.coordinates import CoordinateTransformer

WGS84_PROJ = "epsg:4326"
SWISS_PROJ = "epsg:2056"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import pandas as pd
import numpy as np
import pandas as pd

# import functions to be tested
from catalog_tools.utils.filtering import cat_intersect_polygon
from seismostats.utils.filtering import cat_intersect_polygon


def test_cat_intersect_polygon():
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import pytest

from catalog_tools.utils import require_cols
from seismostats.utils import require_cols

REQUIRED = ['longitude', 'latitude', 'depth',
'time', 'magnitude']
Expand Down
11 changes: 3 additions & 8 deletions setup.cfg
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[metadata]
name = catalog-tools
name = SeismoStats
version = 0.1
description = Best Catalog Tools
description = Library for statistical analysis of seismicity.
license = GNU AFFERO GENERAL PUBLIC LICENSE

[options]
Expand All @@ -11,23 +11,18 @@ install_requires =
cartopy
geopandas
jinja2
matplotlib
numpy
pandas
scipy
shapely


[options.packages.find]
include=catalog_tools*
include=seismostats*

[options.package_data]
* =
*.j2

[options.extras_require]
dev =
autopep8
flake8
isort
pytest
Expand Down

0 comments on commit 978fd98

Please sign in to comment.