Inspired by bruges, bruces aims to be a collection of lightweight codes/tools for seismology with an emphasis on computational efficiency.
The recommended way to install bruces and all its dependencies is through the Python Package Index:
pip install bruces[full] --user
Otherwise, clone and extract the package, then run from the package location:
pip install .[full] --user
To test the integrity of the installed package, check out this repository and run:
pytest
Refer to the online documentation for detailed description of the API and examples.
Alternatively, the documentation can be built using Sphinx:
pip install -r doc/requirements.txt
sphinx-build -b html doc/source doc/build
The following code snippet will decluster a catalog downloaded with pycsep using the nearest-neighbor method:
from datetime import datetime
import csep
import matplotlib.pyplot as plt
import bruces
# Download catalog using pycsep
catalog = csep.query_comcat(
start_time=datetime(2008, 1, 1),
end_time=datetime(2018, 1, 1),
min_magnitude=3.0,
min_latitude=35.0,
max_latitude=37.0,
min_longitude=-99.5,
max_longitude=-96.0,
)
# Decluster pycsep catalog
cat = bruces.from_csep(catalog)
eta_0 = cat.fit_cutoff_threshold()
catd = cat.decluster(method="thinning", eta_0=eta_0)
# Display declustering result
fig, ax = plt.subplots(1, 2, figsize=(12, 6))
cat.plot_time_space_distances(eta_0=eta_0, eta_0_diag=eta_0, ax=ax[0])
catd.plot_time_space_distances(eta_0=eta_0, eta_0_diag=eta_0, ax=ax[1])
Please refer to the Contributing Guidelines to see how you can help. This project is released with a Code of Conduct which you agree to abide by when contributing.
bruces Copyright (c) 2022, The Regents of the University of California, through Lawrence Berkeley National Laboratory (subject to receipt of any required approvals from the U.S. Dept. of Energy). All rights reserved. If you have questions about your rights to use or distribute this software, please contact Berkeley Lab's Intellectual Property Office at [email protected].
This Software was developed under funding from the U.S. Department of Energy and the U.S. Government consequently retains certain rights. As such, the U.S. Government has been granted for itself and others acting on its behalf a paid-up, nonexclusive, irrevocable, worldwide license in the Software to reproduce, distribute copies to the public, prepare derivative works, and perform publicly and display publicly, and to permit others to do so.