Installation and Configuration
Installation via pip
SeisPolarity can be installed through two methods. In either case, it is recommended to install SeisPolarity in a virtual environment, such as using conda.
Standard Installation
SeisPolarity is directly available via pip. To install locally, run:
pip install seispolarity
Installation from Source
To install the latest version from source, clone the repository and run:
git clone https://github.com/Chuan1937/SeisPolarity.git
cd SeisPolarity
pip install -e .
Documentation Dependencies
To build the documentation, install the documentation dependencies:
pip install seispolarity[docs]
Configuration
Cache Directory Configuration
SeisPolarity automatically downloads datasets and models. By default, all cached content is stored in the ~/.seispolarity/ directory:
Datasets:
~/.seispolarity/datasetsModels:
~/.seispolarity/modelsWaveform data:
~/.seispolarity/waveforms
To configure a custom cache directory:
1from seispolarity import configure_cache
2
3configure_cache(cache_root="/path/to/cache")
Or set the SEISPOLARITY_CACHE_ROOT environment variable:
export SEISPOLARITY_CACHE_ROOT=/path/to/cache
Remote Repositories
SeisPolarity uses remote repositories to provide datasets and model weights. You can configure the remote repositories:
1import seispolarity
2
3# View current remote root directories
4print(seispolarity.remote_root) # Data repository
5print(seispolarity.remote_model_root) # Model repository
GPU Support
SeisPolarity is built on PyTorch, which supports CUDA for GPU acceleration.
GPU Installation
To install PyTorch with CUDA support, follow the official PyTorch installation guide.
ModelScope Access (China Users)
For users in China, SeisPolarity supports ModelScope for faster downloads:
1from seispolarity import get_dataset_path
2
3# Use ModelScope instead of Hugging Face
4data_path = get_dataset_path("SCSN", use_hf=False)