Metadata-Version: 2.4
Name: sparspec4das
Version: 0.0.1a1
Summary: An early SPAR4DAS component for computing seismic source amplitude spectra
Author: Mariano Supino
License-Expression: GPL-3.0-only
Classifier: Development Status :: 3 - Alpha
Classifier: Programming Language :: Python :: 3
Classifier: Topic :: Scientific/Engineering :: Physics
Requires-Python: >=3.10
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: numpy<2,>=1.23
Dynamic: license-file

# SPARspec4DAS — early source-spectrum component

SPAR is developed by Mariano Supino to estimate earthquake source parameters
from seismic amplitude spectra. SPARspec4DAS is an early distribution of a small
component of this project: its generalized Brune source-spectrum calculation.
The full SPAR inversion software is still in development and is not included
in this distribution.

This alpha provides the same source-spectrum calculation as the initial
`spar4das` and `sparspec` alphas, under the `sparspec4das` Python namespace. The model is relevant
to the moment-equivalent spectra used for both conventional instruments and
distributed acoustic sensing (DAS).

## Install and use

```bash
python -m pip install --pre sparspec4das
```

```python
import numpy as np
from sparspec4das import log_moment_spectrum

frequencies_hz = np.array([0.0, 1.0, 4.0, 10.0])
log_amplitude = log_moment_spectrum(
    frequencies_hz, log_m0=12.7, fc_hz=4.0, gamma=2.0, t_star_s=0.02
)
amplitude_nm = 10.0 ** log_amplitude
```

The model returns

```text
log10 A(f) = log10 M0 - log10[1 + (f/fc)^gamma] - pi*f*t_star*log10(e)
```

Here `M0` is seismic moment in N m, `fc` is corner frequency in Hz,
`gamma` is the high-frequency decay exponent, and `t_star` is effective
attenuation time in seconds. For fixed Q it may be specified as travel time
divided by Q, plus any separately justified kappa term. All parameters except
frequency are scalars. Frequencies must be finite and nonnegative; corner
frequency and gamma must be positive; attenuation time must be nonnegative.

This is a moment-equivalent spectral model. It does not read waveform files,
convert raw instrument or DAS measurements to moment, or estimate parameters.
The alpha API may change as the complete SPAR package is developed.

## License

GNU General Public License version 3 only; see `LICENSE`.
