{"id":49780848,"url":"https://github.com/wamriewdan/ae_arrival_picker","last_synced_at":"2026-05-11T20:01:40.414Z","repository":{"id":357133098,"uuid":"1229825008","full_name":"wamriewdan/ae_arrival_picker","owner":"wamriewdan","description":"Python package for automatic first-arrival time picking in acoustic emission and microseismic data using AIC, STA/LTA, and energy-based methods.","archived":false,"fork":false,"pushed_at":"2026-05-11T14:15:12.000Z","size":6776,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2026-05-11T14:30:48.278Z","etag":null,"topics":["acoustic-emission","aic","arrival-time-picking","geophysics","microseismic","python","seismology","signal-processing","sta-lta","waveform-analysis"],"latest_commit_sha":null,"homepage":"https://github.com/wamriewdan/ae_arrival_picker","language":"Jupyter Notebook","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/wamriewdan.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2026-05-05T12:21:49.000Z","updated_at":"2026-05-11T14:20:35.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/wamriewdan/ae_arrival_picker","commit_stats":null,"previous_names":["wamriewdan/ae_arrival_picker"],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/wamriewdan/ae_arrival_picker","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wamriewdan%2Fae_arrival_picker","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wamriewdan%2Fae_arrival_picker/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wamriewdan%2Fae_arrival_picker/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wamriewdan%2Fae_arrival_picker/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/wamriewdan","download_url":"https://codeload.github.com/wamriewdan/ae_arrival_picker/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wamriewdan%2Fae_arrival_picker/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32910635,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-11T17:09:15.040Z","status":"ssl_error","status_checked_at":"2026-05-11T17:08:45.420Z","response_time":120,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["acoustic-emission","aic","arrival-time-picking","geophysics","microseismic","python","seismology","signal-processing","sta-lta","waveform-analysis"],"created_at":"2026-05-11T20:01:39.654Z","updated_at":"2026-05-11T20:01:40.408Z","avatar_url":"https://github.com/wamriewdan.png","language":"Jupyter Notebook","funding_links":[],"categories":[],"sub_categories":[],"readme":"# ae-picker\n\n[DOI: 10.5281/zenodo.20126965](https://doi.org/10.5281/zenodo.20126965)\n\n\n`ae-picker` is a Python package for automatic first-arrival time picking in\nacoustic emission (AE) and microseismic waveform data.\n\nIt includes waveform readers, multiple picking algorithms, batch processing,\nand plotting helpers for review and comparison.\n\n## Algorithm notes\n\n### AIC picker\n\nThe AIC picker treats the waveform as two segments split at sample `k` and\nselects the split that minimizes the Akaike Information Criterion:\n\n```text\nAIC(k) = k * log(var(x[0:k])) + (N - k - 1) * log(var(x[k+1:N]))\n```\n\nShort explanation:\n\n- Before the arrival, the signal is assumed to behave like background noise.\n- After the arrival, the variance changes because the waveform contains the\n  first motion and subsequent energy.\n- The best onset is the sample where this two-segment model fits best.\n\n### Refined STA/LTA picker\n\nThe refined STA/LTA picker in this package is a two-stage method:\n\n1. A recursive STA/LTA trigger finds a coarse onset window.\n2. A Hilbert-envelope refinement step walks back to the earliest persistent\n   onset inside that window.\n\nThe STA/LTA trigger is based on the ratio\n\n```text\nCFT(i) = STA(i) / LTA(i)\n```\n\nwhere the fallback implementation in this package uses\n\n```text\nSTA(i) = mean(|x[i-nsta:i]|)\nLTA(i) = mean(|x[i-nlta:i]|)\n```\n\nand triggers when `CFT(i)` rises above the on-threshold and ends when it falls\nbelow the off-threshold.\n\nThe envelope-refinement stage uses the analytic-signal envelope\n\n```text\ne(i) = |H{x}(i)|\n```\n\nand robust noise statistics\n\n```text\nsigma ~= 1.4826 * MAD(e_noise)\nthr_high = median(e_noise) + k_high * sigma\nthr_low  = median(e_noise) + k_low  * sigma\n```\n\nShort explanation:\n\n- STA/LTA provides a stable first trigger for emergent arrivals.\n- The envelope stage then refines that trigger by requiring a persistent rise\n  above a lower threshold, which improves onset timing.\n- In this repository, the \"refined STA/LTA\" picker is this package-specific\n  combination of recursive STA/LTA and envelope-based onset refinement.\n\n\n## Plotting\n\n### `plot_sta_lta_overlay` — STA/LTA diagnostic plot\n\nProduces a three-panel figure for diagnosing the STA/LTA picker on a single\nchannel:\n\n1. **Waveform** — raw amplitude time series.\n2. **STA \u0026 LTA envelopes** — centered moving averages of `|amp|` showing how\n   the short- and long-term averages evolve around the arrival.\n3. **STA/LTA characteristic function** — the recursive ratio with trigger-on\n   and trigger-off threshold lines, and optional onset marker lines.\n\n```python\nfrom ae_picker import refined_stalta_picker, plot_sta_lta_overlay\n\namp, time = channels[0][\"amp\"], channels[0][\"time\"]\nN = len(time)\n\npick_idx, cft, triggers = refined_stalta_picker(\n    amp, time,\n    sta_s=2e-6, lta_s=100e-6,\n    sta_thresh=2.5, lta_thresh=1.5,\n    search_start=int(0.5 * N),   # filtered records: no triggers before t=0\n)\n\nfig, axes = plot_sta_lta_overlay(\n    amp, time,\n    sta_s=2e-6, lta_s=100e-6,\n    sta_thresh=2.5, lta_thresh=1.5,\n    triggers=triggers,            # draws onset vline on all panels\n    tlim_us=(-100, 200),          # zoom to ±µs around arrival (relative to time[0])\n)\n```\n\nKey parameters:\n\n| Parameter | Description | Default |\n|---|---|---|\n| `sta_s`, `lta_s` | STA and LTA window lengths (seconds) | `5e-6`, `50e-6` |\n| `sta_thresh`, `lta_thresh` | Trigger on/off threshold lines | `2.5`, `1.5` |\n| `triggers` | `[[onset, offset], ...]` sample pairs from `refined_stalta_picker` | `None` |\n| `manual_picks_s` | Additional pick times (seconds) to overlay | `None` |\n| `tlim_us` | X-axis limits in microseconds relative to `time[0]` | `None` (full record) |\n| `savepath` | File path to save the figure | `None` |\n\n---\n\n### `plot_wave_and_spectrogram` — waveform + PSD spectrogram\n\nProduces a two-panel figure with the normalised waveform above and the\nPower Spectral Density spectrogram (Hann window, Welch method) below, sharing\nthe same time axis.  Suitable for journal figures.\n\n```python\nfrom ae_picker import plot_wave_and_spectrogram\n\nfig, (ax_wave, ax_spec) = plot_wave_and_spectrogram(\n    amp, time,\n    fmax=500e3,              # Hz — clip frequency axis at 500 kHz\n    tmin=time[0],            # display window start (seconds)\n    tmax=time[-1],           # display window end   (seconds)\n    dyn_range_db=80,         # colour dynamic range\n    title=\"Channel 1\",\n    savepath=\"ch1_spec.png\",\n)\n```\n\nKey parameters:\n\n| Parameter | Description | Default |\n|---|---|---|\n| `fmax` | Upper frequency limit for the spectrogram (Hz) | `None` (Nyquist) |\n| `nperseg` | STFT window length (samples); `None` → auto (~2 ms) | `None` |\n| `overlap` | Fractional window overlap `[0, 1)` | `0.90` |\n| `dyn_range_db` | Colour dynamic range in dB | `80` |\n| `norm_percentile` | Percentile used to normalise the waveform | `99.9` |\n| `tmin`, `tmax` | Display window start/end (seconds) | `None` (full record) |\n| `savepath` | File path to save the figure | `None` |\n\n## Features\n\n- AIC, envelope-based, and STA/LTA picking workflows\n- Readers for the repository's filtered and unfiltered waveform formats\n- Batch processing that writes a single `picks_summary.csv`\n- Plot helpers for waveform review and picker comparison\n- A command-line interface exposed as `ae-picker`\n\n## Installation\n\nInstall from PyPI after the package is published:\n\n```bash\npip install ae-picker\n```\n\nInstall from a local checkout:\n\n```bash\ngit clone https://github.com/wamriewdan/ae_arrival_picker\ncd ae_arrival_picker\npip install .\n```\n\nOptional extras:\n\n```bash\npip install -e \".[dev]\"\npip install \".[obspy]\"\n```\n\nThe package is installed as `ae-picker` but imported as `ae_picker`.\n\n## Quick start\n\nBatch process a dataset with the Python API:\n\n```python\nfrom ae_picker import run\n\ndf = run(\"path/to/your/data_dir\", plot=False, save_plots=False)\nprint(df.head())\n```\n\nRun the CLI:\n\n```bash\nae-picker path/to/your/data_dir --save-plots\n```\n\nPick a single file:\n\n```python\nfrom ae_picker import aic_picker, plot_channels, read_unfiltered\n\nmeta, channels = read_unfiltered(\"my_ae_file.txt\")\n\naic_picks = []\nfor ch in channels:\n    idx, _ = aic_picker(ch[\"amp\"], search_start=1, search_end=10)\n    aic_picks.append(idx)\n    print(f\"P arrival at {ch['time'][idx] * 1e6:.1f} us\")\n\nfig = plot_channels(meta, channels, picks={\"AIC\": aic_picks})\nfig.savefig(\"picks.png\", dpi=150)\n```\n\n\n## Batch input layout\n\nThe batch runner expects a root directory containing one or both of these\nsubdirectories:\n\n```text\nyour_data_dir/\n|-- unfiltered_signals/\n`-- filtered_signals/\n```\n\n`run()` and `ae-picker` scan those folders, infer the signal type from the\nfolder name, and write results to `picks_output/picks_summary.csv` by default.\n\n## References\n\n1. Maeda, N. (1985). *A Method for Reading and Checking Phase Time in\n   Auto-Processing System of Seismic Wave Data*. Zisin, 38(3), 365-379.\n   https://doi.org/10.4294/zisin1948.38.3_365\n2. Allen, R. V. (1978). *Automatic Earthquake Recognition and Timing from\n   Single Traces*. Bulletin of the Seismological Society of America, 68(5),\n   1521-1532. https://doi.org/10.1785/BSSA0680051521\n3. Beyreuther, M., Barsch, R., Krischer, L., Megies, T., Behr, Y., and\n   Wassermann, J. (2010). *ObsPy: A Python Toolbox for Seismology*.\n   Seismological Research Letters, 81(3), 530-533.\n   https://doi.org/10.1785/gssrl.81.3.530\n\n## Citation\n\nIf you use `ae-picker`, please cite:\n\n1. Wamriew, D. (2026). ae-picker. Zenodo. https://doi.org/10.5281/zenodo.20126965\n\n## License\n\nMIT\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwamriewdan%2Fae_arrival_picker","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fwamriewdan%2Fae_arrival_picker","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwamriewdan%2Fae_arrival_picker/lists"}