{ "cells": [ { "cell_type": "markdown", "id": "67a5d713", "metadata": {}, "source": [ "# Step 7: Prepare and Launch Dashboards\n" ] }, { "cell_type": "markdown", "id": "981fe94b", "metadata": {}, "source": [ "This notebook prepares the files used by the interactive Spatial-VTK dashboards. You will export dashboard-ready Parquet data, create summary tables, and build portable commands for the metrics and QC dashboards.\n" ] }, { "cell_type": "markdown", "id": "be25de52", "metadata": {}, "source": [ "## Imports\n", "\n", "These helpers write dashboard datasets and make readable dashboard table previews.\n" ] }, { "cell_type": "code", "execution_count": 1, "id": "34183421", "metadata": { "execution": { "iopub.execute_input": "2026-06-07T01:51:21.882825Z", "iopub.status.busy": "2026-06-07T01:51:21.882461Z", "iopub.status.idle": "2026-06-07T01:51:44.591560Z", "shell.execute_reply": "2026-06-07T01:51:44.590526Z" } }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Run time: 1.16 s\n" ] } ], "source": [ "from spatial_vtk.config.notebook import notebook_timer, register_svtk_cell_timer\n", "\n", "with notebook_timer():\n", " import pandas as pd\n", "\n", " from spatial_vtk.config import SpatialVTKConfig\n", " from spatial_vtk.io import load_output_table, write_output_table\n", " from spatial_vtk.visualize.dashboard import (\n", " display_table,\n", " write_dashboard_metric_dataset,\n", " write_dashboard_summary_dataset,\n", " )\n", " register_svtk_cell_timer()" ] }, { "cell_type": "markdown", "id": "cf4a1981", "metadata": {}, "source": [ "## Configuration\n", "\n", "Load the config and choose dashboard output folders and ports.\n" ] }, { "cell_type": "code", "execution_count": 2, "id": "955b197f", "metadata": { "execution": { "iopub.execute_input": "2026-06-07T01:51:44.595060Z", "iopub.status.busy": "2026-06-07T01:51:44.594725Z", "iopub.status.idle": "2026-06-07T01:51:44.619585Z", "shell.execute_reply": "2026-06-07T01:51:44.618683Z" } }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Run time: 20.9 ms\n" ] } ], "source": [ "from pathlib import Path\n", "\n", "# Use the repository root so paths match the public source checkout.\n", "repo_root = Path.cwd()\n", "config_path = repo_root / \"data/examples/configuration/example_spatial_vtk_config.yaml\"\n", "\n", "# Load the tutorial run scenario and make it the active config for later package calls.\n", "cfg = SpatialVTKConfig.from_file(config_path, run_scenario=\"tutorial\").activate()\n", "\n", "notebook_overrides = {\"metrics_port\": 8501, \"qc_port\": 8502}" ] }, { "cell_type": "markdown", "id": "0e7d1c85", "metadata": {}, "source": [ "## Write Dashboard Datasets\n", "\n", "The metrics dashboard reads Parquet files. Summary tables keep common filters and views fast.\n" ] }, { "cell_type": "code", "execution_count": 3, "id": "546fb2f3", "metadata": { "execution": { "iopub.execute_input": "2026-06-07T01:51:44.622802Z", "iopub.status.busy": "2026-06-07T01:51:44.622341Z", "iopub.status.idle": "2026-06-07T01:52:26.026376Z", "shell.execute_reply": "2026-06-07T01:52:26.025622Z" } }, "outputs": [ { "data": { "text/html": [ "
| \n", " | event_id | \n", "station | \n", "network | \n", "component | \n", "model | \n", "band | \n", "metric | \n", "metric_group | \n", "period_s | \n", "value_obs | \n", "... | \n", "strike | \n", "dip | \n", "rake | \n", "usgs_url | \n", "observed_pickle | \n", "event_json | \n", "synthetic_mseed | \n", "selected_station_count | \n", "overlapping_broadband_station_count | \n", "event_count | \n", "
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 0 | \n", "ci38038071 | \n", "BFS | \n", "CI | \n", "Z | \n", "cvmsi | \n", "1-2 sec | \n", "PGA | \n", "amplitude | \n", "NaN | \n", "0.118 | \n", "... | \n", "312.0 | \n", "79.0 | \n", "178.0 | \n", "https://earthquake.usgs.gov/earthquakes/eventp... | \n", "data/examples/example_five_event_subset/obser... | \n", "data/examples/example_five_event_subset/obser... | \n", "data/examples/example_five_event_subset/synth... | \n", "30 | \n", "52 | \n", "4.0 | \n", "
| 1 | \n", "ci38038071 | \n", "BHP | \n", "CI | \n", "Z | \n", "cvmsi | \n", "1-2 sec | \n", "PGV | \n", "amplitude | \n", "NaN | \n", "5.410 | \n", "... | \n", "312.0 | \n", "79.0 | \n", "178.0 | \n", "https://earthquake.usgs.gov/earthquakes/eventp... | \n", "data/examples/example_five_event_subset/obser... | \n", "data/examples/example_five_event_subset/obser... | \n", "data/examples/example_five_event_subset/synth... | \n", "30 | \n", "52 | \n", "5.0 | \n", "
| 2 | \n", "ci38695658 | \n", "BLC | \n", "CI | \n", "R | \n", "cvmsi | \n", "2-3 sec | \n", "PSA | \n", "spectral | \n", "2.0 | \n", "0.284 | \n", "... | \n", "96.0 | \n", "48.0 | \n", "108.0 | \n", "https://earthquake.usgs.gov/earthquakes/eventp... | \n", "data/examples/example_five_event_subset/obser... | \n", "data/examples/example_five_event_subset/obser... | \n", "data/examples/example_five_event_subset/synth... | \n", "30 | \n", "75 | \n", "4.0 | \n", "
| 3 | \n", "ci39812319 | \n", "BRE | \n", "CI | \n", "T | \n", "cvmsi | \n", "3-5 sec | \n", "FAS | \n", "spectral | \n", "3.0 | \n", "0.037 | \n", "... | \n", "122.0 | \n", "85.0 | \n", "179.0 | \n", "https://earthquake.usgs.gov/earthquakes/eventp... | \n", "data/examples/example_five_event_subset/obser... | \n", "data/examples/example_five_event_subset/obser... | \n", "data/examples/example_five_event_subset/synth... | \n", "30 | \n", "77 | \n", "5.0 | \n", "
| 4 | \n", "ci38695658 | \n", "CAC | \n", "CI | \n", "Z | \n", "cvmsi | \n", "1-2 sec | \n", "PGA | \n", "amplitude | \n", "NaN | \n", "0.096 | \n", "... | \n", "96.0 | \n", "48.0 | \n", "108.0 | \n", "https://earthquake.usgs.gov/earthquakes/eventp... | \n", "data/examples/example_five_event_subset/obser... | \n", "data/examples/example_five_event_subset/obser... | \n", "data/examples/example_five_event_subset/synth... | \n", "30 | \n", "75 | \n", "NaN | \n", "
5 rows × 47 columns
\n", "| \n", " | Event ID | \n", "Station | \n", "Component | \n", "Period Band | \n", "Metric | \n", "Observed Value | \n", "Synthetic Value | \n", "Log2 Residual | \n", "Anderson 2004 GOF | \n", "
|---|---|---|---|---|---|---|---|---|---|
| 0 | \n", "ci38038071 | \n", "BFS | \n", "Z | \n", "1-2 sec | \n", "Peak acceleration (PGA) | \n", "0.118 | \n", "0.104 | \n", "0.184 | \n", "8.7 | \n", "
| 1 | \n", "ci38038071 | \n", "BHP | \n", "Z | \n", "1-2 sec | \n", "Peak velocity (PGV) | \n", "5.410 | \n", "6.220 | \n", "-0.201 | \n", "7.9 | \n", "
| 2 | \n", "ci38695658 | \n", "BLC | \n", "R | \n", "2-3 sec | \n", "Pseudo-spectral acceleration (PSA) | \n", "0.284 | \n", "0.211 | \n", "0.429 | \n", "8.2 | \n", "
| 3 | \n", "ci39812319 | \n", "BRE | \n", "T | \n", "3-5 sec | \n", "Fourier amplitude spectrum (FAS) | \n", "0.037 | \n", "0.052 | \n", "-0.491 | \n", "7.4 | \n", "
| 4 | \n", "ci38695658 | \n", "CAC | \n", "Z | \n", "1-2 sec | \n", "Peak acceleration (PGA) | \n", "0.096 | \n", "0.089 | \n", "0.109 | \n", "8.9 | \n", "