← 返回 Skills 市场
wu-uk

seisbench-model-api

作者 wu-uk · GitHub ↗ · v0.1.0 · MIT-0
cross-platform ✓ 安全检测通过
90
总下载
0
收藏
0
当前安装
1
版本数
在 OpenClaw 中安装
/install earthquake-phase-association-seisbench-model-api
功能描述
An overview of the core model API of SeisBench, a Python framework for training and applying machine learning algorithms to seismic data. It is useful for an...
使用说明 (SKILL.md)

SeisBench Model API

Installing SeisBench

The recommended way is installation through pip. Simply run:

pip install seisbench

Overview

SeisBench offers the abstract class WaveformModel that every SeisBench model should subclass. This class offers two core functions, annotate and classify. Both of the functions are automatically generated based on configurations and submethods implemented in the specific model.

The SeisBenchModel bridges the gap between the pytorch interface of the models and the obspy interface common in seismology. It automatically assembles obspy streams into pytorch tensors and reassembles the results into streams. It also takes care of batch processing. Computations can be run on GPU by simply moving the model to GPU.

The annotate function takes an obspy stream object as input and returns annotations as stream again. For example, for picking models the output would be the characteristic functions, i.e., the pick probabilities over time.

stream = obspy.read("my_waveforms.mseed")
annotations = model.annotate(stream)  # Returns obspy stream object with annotations

The classify function also takes an obspy stream as input, but in contrast to the annotate function returns discrete results. The structure of these results might be model dependent. For example, a pure picking model will return a list of picks, while a picking and detection model might return a list of picks and a list of detections.

stream = obspy.read("my_waveforms.mseed")
outputs = model.classify(stream)  # Returns a list of picks
print(outputs)

Both annotate and classify can be supplied with waveforms from multiple stations at once and will automatically handle the correct grouping of the traces. For details on how to build your own model with SeisBench, check the documentation of WaveformModel. For details on how to apply models, check out the Examples.

Loading Pretrained Models

For annotating waveforms in a meaningful way, trained model weights are required. SeisBench offers a range of pretrained model weights through a common interface. Model weights are downloaded on the first use and cached locally afterwards. For some model weights, multiple versions are available. For details on accessing these, check the documentation at from_pretrained.

import seisbench.models as sbm

sbm.PhaseNet.list_pretrained()                  # Get available models
model = sbm.PhaseNet.from_pretrained("original")  # Load the original model weights released by PhaseNet authors

Pretrained models can not only be used for annotating data, but also offer a great starting point for transfer learning.

Speeding Up Model Application

When applying models to large datasets, run time is often a major concern. Here are a few tips to make your model run faster:

  • Run on GPU. Execution on GPU is usually faster, even though exact speed-ups vary between models. However, we note that running on GPU is not necessarily the most economic option. For example, in cloud applications it might be cheaper (and equally fast) to pay for a handful of CPU machines to annotate a large dataset than for a GPU machine.

  • Use a large batch_size. This parameter can be passed as an optional argument to all models. Especially on GPUs, larger batch sizes lead to faster annotations. As long as the batch fits into (GPU) memory, it might be worth increasing the batch size.

  • Compile your model (torch 2.0+). If you are using torch in version 2.0 or newer, compile your model. It's as simple as running model = torch.compile(model). The compilation will take some time but if you are annotating large amounts of waveforms, it should pay off quickly. Note that there are many options for compile that might influence the performance gains considerably.

  • Use asyncio interface. Load data in parallel while executing the model using the asyncio interface, i.e., annotate_asyncio and classify_asyncio. This is usually substantially faster because data loading is IO-bound while the actual annotation is compute-bound.

  • Manual resampling. While SeisBench can automatically resample the waveforms, it can be faster to do the resampling manually beforehand. SeisBench uses obspy routines for resampling, which (as of 2023) are not parallelised. Check the required sampling rate with model.sampling_rate. Alternative routines are available, e.g., in the Pyrocko library.

Models Integrated into SeisBench

You don't have to build models from scratch if you don't want to. SeisBench integrates the following notable models from the literature for you to use. Again, as they inherit from the common SeisBench model interface, all these deep learning models are constructed through PyTorch. Where possible, the original trained weights are imported and made available. These can be accessed via the from_pretrained method.

Integrated Model Task
BasicPhaseAE Phase Picking
CRED Earthquake Detection
DPP Phase Picking
DepthPhaseNet Depth estimation from depth phases
DepthPhaseTEAM Depth estimation from depth phases
DeepDenoiser Denoising
SeisDAE Denoising
EQTransformer Earthquake Detection/Phase Picking
GPD Phase Picking
LFEDetect Phase Picking (Low-frequency earthquakes)
OBSTransformer Earthquake Detection/Phase Picking
PhaseNet Phase Picking
PhaseNetLight Phase Picking
PickBlue Earthquake Detection/Phase Picking
Skynet Phase Picking
VariableLengthPhaseNet Phase Picking

Currently integrated models are capable of earthquake detection and phase picking, waveform denoising, depth estimation, and low-frequency earthquake phase picking. Furthermore, with SeisBench you can build ML models to perform general seismic tasks such as magnitude and source parameter estimation, hypocentre determination etc.

Best Practices

  • If the waveform data happen to be extremely small in scale (\x3C=1e-10), there might be risk of numerical instability. It is acceptable to increase the value first (by multiplying a large number like 1e10) before normalization or passing to the model.

  • Although the seisbench model API will normalize the waveform for you, it is still highly suggested to apply normalization yourself. Since seisbench's normalization scheme uses an epsilon (waveform - mean(waveform)) / (std(waveform) + epsilon), for extremely small values (such as \x3C=1e-10), their normalization can destroy the signals in the waveform.

  • The seisbench model API can process a stream of waveform data of arbitrary length. Hence, it is not necessary to segment the data yourself. In addition, you should not assume a stream of waveform can only contain one P-wave and one S-wave. It is the best to treat the stream like what it is: a stream of continuous data.

安全使用建议
This skill is documentation/instructions for using the SeisBench Python library. Before installing or running examples: (1) Expect `pip install seisbench` and PyPI/network downloads; verify you trust PyPI and your environment's packages. (2) The `from_pretrained` calls will fetch pretrained model weights from the network and cache them locally—check available disk space and your network policy. (3) No secrets or credentials are requested by the skill. (4) If you run code produced by the agent, run it in a controlled environment (virtualenv/conda, sandbox) if you are concerned about package side effects. Overall the skill is internally consistent with its stated purpose.
功能分析
Type: OpenClaw Skill Name: earthquake-phase-association-seisbench-model-api Version: 0.1.0 The skill bundle provides documentation and usage instructions for SeisBench, a legitimate Python framework for seismic data analysis. The content in SKILL.md consists of standard library installation steps, code examples for model inference, and performance optimization tips, with no evidence of malicious intent, data exfiltration, or prompt injection.
能力标签
cryptocan-make-purchases
能力评估
Purpose & Capability
The name and description match the instructions: documentation and usage examples for SeisBench model API. Required capabilities (installing seisbench, loading/preprocessing waveforms, downloading pretrained weights) are appropriate for the stated purpose.
Instruction Scope
SKILL.md contains examples that read seismic files (obspy.read), construct models, call annotate/classify, and documents that pretrained weights are downloaded and cached. It does not instruct reading unrelated system files, other credentials, or exfiltrating data to unexpected endpoints.
Install Mechanism
There is no built-in install spec (instruction-only). The file recommends running `pip install seisbench`, and SeisBench's `from_pretrained` will download model weights at first use. This implies network downloads and disk writes but is expected for this skill; users should be aware of network and PyPI activity.
Credentials
The skill declares no required environment variables, no credentials, and no config paths. That is proportionate: using SeisBench needs no extraneous secrets. The documented behavior (downloading model weights) is consistent with no additional credentials being required.
Persistence & Privilege
always is false and there is no install-time or runtime behavior that attempts to persist or change other skills or system-wide agent configuration. The skill is user-invocable and can be invoked autonomously (platform default), which is expected for an instruction-only integration.
如何使用
  1. 确保已安装 OpenClaw(本地或 Docker 部署)
  2. 在对话框中输入安装命令:/install earthquake-phase-association-seisbench-model-api
  3. 安装完成后,直接呼叫该 Skill 的名称或使用 /earthquake-phase-association-seisbench-model-api 触发
  4. 根据 Skill 的参数说明提供必要输入,即可获得结构化输出
版本历史
v0.1.0
Bulk publish from all-task-skills-dedup
元数据
Slug earthquake-phase-association-seisbench-model-api
版本 0.1.0
许可证 MIT-0
累计安装 0
当前安装数 0
历史版本数 1
常见问题

seisbench-model-api 是什么?

An overview of the core model API of SeisBench, a Python framework for training and applying machine learning algorithms to seismic data. It is useful for an... 它是一个面向 Claude Code / OpenClaw 的 AI Agent Skill 插件,目前累计下载 90 次。

如何安装 seisbench-model-api?

在 OpenClaw 或 Claude Code 对话框中运行命令「/install earthquake-phase-association-seisbench-model-api」即可一键安装,无需额外配置。

seisbench-model-api 是免费的吗?

是的,seisbench-model-api 完全免费,采用 MIT-0 许可证,可自由下载、安装和使用。

seisbench-model-api 支持哪些平台?

seisbench-model-api 跨平台运行,可在任意部署了 OpenClaw / Claude Code 的环境中使用(cross-platform)。

谁开发了 seisbench-model-api?

由 wu-uk(@wu-uk)开发并维护,当前版本 v0.1.0。

💬 留言讨论