# ESSD Manuscript Scripts This folder contains the scripts used to regenerate the ESSD manuscript numbers, diagnostics, and figures from the released SeismicX-Cont files. ## Main Entry Points - `reproduce_manuscript_outputs.sh` regenerates the ESSD inventory, independent coverage audit, consistency report, and core figures from released files. - `audit_manuscript_numbers.py` regenerates the key inventory, annotation, and exact NSLC point-coverage values, including finite-sample checks for floating-point HDF5 arrays. Automatic-output diagnostics are excluded unless `--include-example-outputs` is supplied. - `build_reference_arrivals.py` exports an independent SQLite arrival table with C0 point coverage and configuration-specific C1--C3 window, component, sampling-rate, gap, and response fields. Selection is deterministic, components are not mixed across locations or families, response intervals are half-open, and response-qualified C3 requires exactly one epoch match for each selected component. - `audit_waveform_quality.py` checks every SQLite segment row for required fields, timing consistency, duplicate keys, exact-NSLC gaps, and overlaps, then compares index metadata with a deterministic stratified sample of HDF5 datasets and short waveform windows. - `check_manuscript_consistency.py` checks the regenerated inventory, annotation, and coverage values against the current manuscript. - `plot_dataset_overview.py` regenerates `figures/dataset_overview.pdf`. - `plot_monitoring_regime_characterization.py` regenerates the monitoring regime characterization figure and writes JSON/text summaries under `essd_scripts/outputs/`. - `plot_essd_qc_figures.py` regenerates the workflow, station-day coverage, and independently computed label-coverage figures. Legacy example-output figures require `--include-example-output-figures`. - `evaluate_picks.py` matches automatic picker JSONL outputs to reference labels one-to-one after P/Pg/Pn and S/Sg/Sn normalization. Its deterministic time-ordered assignment maximizes TP-tolerance matches before diagnostic-window matches and total absolute residual. `--reference-db` reuses the versioned C0--C3 flags without repeatedly reopening the HDF5 archive. Optional reference-window reporting intersects merged manual-reference windows with a selected output's station-time eligibility domain and reports both raw and effective processed-window duration; it is not conventional precision. - `regenerate_multimodel_phase_matching.sh` regenerates the optional `data/validation/multimodel_phase_matching/` records and summaries from the stored source JSONL files. These outputs are automated agreement and file- interoperability diagnostics, not a standardized workflow comparison. - `compare_associated_events.py` evaluates associated-event JSONL outputs against the reference catalog. ## Quick Checks ```bash ./essd_scripts/reproduce_manuscript_outputs.sh python essd_scripts/audit_manuscript_numbers.py --format text python essd_scripts/check_manuscript_consistency.py python essd_scripts/audit_waveform_quality.py python essd_scripts/build_reference_arrivals.py \ --window-before-s 30 --window-after-s 30 \ --required-components Z H1 H2 --require-response python essd_scripts/plot_dataset_overview.py python essd_scripts/plot_monitoring_regime_characterization.py python essd_scripts/plot_essd_qc_figures.py ./essd_scripts/regenerate_multimodel_phase_matching.sh ``` The one-command script runs the manuscript-number audit first, exports JSON, checks the current manuscript against regenerated numbers, then rebuilds the overview, monitoring-regime characterization, and QC figures. Outputs are written to `essd_scripts/outputs/` and `figures/`. The plotting scripts write manuscript figures under `figures/`. The audit script is read-only unless its output is redirected by the caller. ## Manuscript Coverage The scripts cover the manuscript outputs as follows: | Manuscript output | Reproduction source | |---|---| | Fig. 1, data-product workflow | `plot_essd_qc_figures.py`, using the released HDF5 directory, SQLite index, and annotation JSON for the displayed counts | | Fig. 2, inventory and monitoring-regime overview | `plot_dataset_overview.py`, using the annotation JSON, SQLite index, and HDF5 waveform files | | Fig. 3, waveform coverage matrix | `plot_essd_qc_figures.py`, using the SQLite waveform index | | Fig. 4, monitoring-regime characterization | `plot_monitoring_regime_characterization.py`, using the annotation JSON and SQLite waveform index | | Fig. 5, label coverage and provenance | `plot_essd_qc_figures.py`, using the annotation JSON, exact NSLC intervals in the SQLite index, and finite-sample checks in the HDF5 arrays | | Phase-reference composition and C0--C3 eligibility table | `audit_manuscript_numbers.py --format latex-reference` and `check_manuscript_consistency.py` | | Index timing, exact-NSLC gap/overlap, metadata agreement, and sampled waveform diagnostics | `audit_waveform_quality.py` | | Optional multi-output phase-agreement and JSONL interoperability records | `regenerate_multimodel_phase_matching.sh` and `evaluate_picks.py` | | Support-stratified and eligibility-normalized C0 manual-reference agreement | `scripts/validate_multi_output_candidates.py` | Non-standardized automatic-output files are optional software-interoperability fixtures and are not inputs to the manuscript's coverage or data-quality claims.