Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
e5be6c1
update the depandancy.
Pamicoding Mar 24, 2026
9a59c77
update the format helper function.
Pamicoding Mar 24, 2026
2a04a39
testing waveform and its PZ.
Pamicoding Mar 24, 2026
96822f9
update scripts related to CI.
Pamicoding Mar 25, 2026
a9dc953
Update scripts and examples related to unit test.
Pamicoding Mar 25, 2026
3aee257
update OOP features that needs to check.
Pamicoding Mar 25, 2026
5177c1a
Merge branch 'main' into feature-oop
Pamicoding May 29, 2026
0310ca8
testing data upload.
Pamicoding May 29, 2026
2b095ea
Improve entrypoint
Pamicoding Jun 10, 2026
5f10c43
Fix and Optimiza the flow.
Pamicoding Jun 16, 2026
97f1b13
using conda to download onnx's modules is fine.
Pamicoding Jun 17, 2026
d82ee20
remove duplicated key result_path, and fix some bugs.
Pamicoding Jun 17, 2026
c5a39f0
Update fixtures.
Pamicoding Jun 17, 2026
7629958
Tidy up
Pamicoding Jun 18, 2026
f018fe4
Update devcontainer.
Pamicoding Jun 18, 2026
ca73968
Update testing and demo.
Pamicoding Jun 18, 2026
e6001ce
Add output display for each cell.
Pamicoding Jun 18, 2026
aeb01fa
ignore E501.
Pamicoding Jun 18, 2026
0673df0
Ignore E402 as well.
Pamicoding Jun 18, 2026
df9442e
correcting relative path of testing file.
Pamicoding Jun 18, 2026
bfa41e0
Revert "correcting relative path of testing file."
Pamicoding Jun 18, 2026
99eeb8f
Update env name.
Pamicoding Jun 18, 2026
aadacdb
Remove redundant example dataset.
Pamicoding Jun 18, 2026
df0cbac
update readme.
Pamicoding Jun 18, 2026
62c8cb5
Tidy up
Pamicoding Jun 18, 2026
49177ef
Set resample argument's default as true
Pamicoding Jun 25, 2026
7a923f0
Make pol_mag_to_dout founction backward compatible.
Pamicoding Jun 26, 2026
48e7032
Clarify helper function for gafocal.
Pamicoding Jun 26, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions .devcontainer/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -52,9 +52,8 @@ RUN groupadd --gid $USER_GID $USERNAME \
&& mkdir -p /home/$USERNAME/.vscode-server /home/$USERNAME/.vscode-server-insiders \
&& chown ${USER_UID}:${USER_GID} /home/$USERNAME/.vscode-server*

# Copy environment files (use lightweight env-codespace.yml for Codespaces)
# Copy the Codespaces environment definition (CPU torch + Jupyter).
COPY env-codespace.yml /tmp/env.yml
COPY requirements.txt /tmp/requirements.txt

# Create conda environment with mamba and aggressive cleanup to save space
RUN mamba env create -f /tmp/env.yml && \
Expand Down
60 changes: 26 additions & 34 deletions .devcontainer/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,51 +20,44 @@ This devcontainer provides a standardized development environment for the AutoQu

### Environment
- **Python 3.10.13** with conda/mamba package management
- **AutoQuake conda environment** with all dependencies from `env.yml`
- **AutoQuake conda environment** built from `env-codespace.yml` (CPU-only PyTorch)
- **Scientific computing stack**: NumPy, Pandas, SciPy, Matplotlib, ObsPy
- **Machine Learning**: PyTorch, scikit-learn
- **Seismology tools**: ObsPy, PyGMT, Pyrocko
- **Development tools**: Black, isort, flake8, pre-commit
- **Machine Learning**: PyTorch (CPU), scikit-learn, ONNX Runtime
- **Seismology / geospatial tools**: ObsPy, PyGMT, Cartopy, pyproj
- **Development tools**: Ruff, pre-commit

### VS Code Extensions
- Python development suite (Python, Pylance, Jupyter)
- Code formatting and linting (Black, Ruff, flake8)
- Linting & formatting with Ruff
- Git integration (GitLens, GitHub tools)
- Documentation tools (Markdown, autodocstring)
- Scientific computing support

### Development Tools
- **Ruff** for linting and formatting (replaces black + isort + flake8)
- **Pre-commit hooks** for code quality
- **Jupyter Lab** ready to use
- **Code formatting** with Black and isort
- **Linting** with flake8 and Ruff

## 🛠️ Development Workflow

### Environment Activation
The conda environment `AutoQuake_v0` is automatically activated. You can also use:
The conda environment `AutoQuake_v0` is activated automatically in new terminals.
To activate it manually:
```bash
aq # Quick alias to activate environment
conda activate AutoQuake_v0
```

### Development Tools
```bash
# You can create your own aliases if needed, such as:
conda activate AutoQuake_v0 # Activate environment
black . && isort . # Format code
flake8 . # Check code quality
jupyter lab --ip=0.0.0.0 --port=8888 --no-browser --allow-root # Start Jupyter
```

### Jupyter Development
```bash
aqjupyter # Start Jupyter Lab on port 8888
ruff check . # Lint
ruff format . # Format (single quotes, 88 cols — see pyproject.toml)
pytest tests/unit -m "not integration" # Run the fast unit tests
jupyter lab --ip=0.0.0.0 --port=8888 --no-browser # Start Jupyter Lab
```

### Testing Your Setup
```bash
conda activate AutoQuake_v0 # Ensure environment is active
python -c "import autoquake; print('AutoQuake loaded successfully')" # Test AutoQuake import
python -c "import autoquake; print('AutoQuake loaded successfully')" # Test import
```

## 📁 Project Structure
Expand Down Expand Up @@ -97,9 +90,8 @@ This environment is prepared for real-time seismic data processing with:
## 🔧 Customization

### Adding Dependencies
1. Update `env.yml` for conda packages
2. Update `requirements.txt` for pip packages
3. Rebuild the container
1. Add the package to `env.yml` (local/CI) **and** `env-codespace.yml` (Codespaces)
2. Rebuild the container ("Dev Containers: Rebuild Container")

### VS Code Settings
Modify `.devcontainer/devcontainer.json` to customize:
Expand All @@ -119,24 +111,24 @@ Add system packages in the Dockerfile under the apt-get install section.

### Python Environment Issues
```bash
conda activate AutoQuake_v0 # Ensure environment is active
python dev-utils.py # Check environment status
conda activate AutoQuake_v0 # Ensure environment is active
conda env list # Confirm AutoQuake_v0 exists
```

### Import Errors
```bash
pip install -e . # Reinstall AutoQuake in development mode
```
The project runs from the repository root (pytest adds it to `sys.path` via
`pyproject.toml`). If `import autoquake` fails, make sure your working directory
is the repo root and the conda environment is active.

### Port Conflicts
The container forwards ports 8888, 8080, and 5000. Modify `devcontainer.json` if needed.

## 🤝 Contributing

1. The environment automatically sets up pre-commit hooks
2. Code is automatically formatted on save
3. Run tests before committing: `aqtest`
4. Follow the existing code style (Black formatting)
1. The environment automatically sets up pre-commit hooks (commit + push)
2. Code is automatically formatted on save by Ruff
3. Run tests before committing: `pytest tests/unit -m "not integration"`
4. Follow the existing code style (Ruff: single quotes, 88-column lines)

## 📝 Notes for Real-time Development

Expand All @@ -149,7 +141,7 @@ When implementing real-time features:
## 🆘 Getting Help

- Check the main AutoQuake README for project-specific information
- Run `python dev-utils.py` for environment diagnostics
- Run `conda env list` and `conda list` to inspect the environment
- Use the VS Code integrated terminal with all tools pre-configured

Happy coding! 🎉
62 changes: 20 additions & 42 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,67 +11,45 @@
"customizations": {
"vscode": {
"extensions": [
// Python Development
// Python (ruff is the single linter/formatter — matches pyproject.toml & CI)
"ms-python.python",
"ms-python.flake8",
"ms-python.pylint",
"ms-python.black-formatter",
"ms-python.vscode-pylance",
"ms-python.debugpy",
"charliermarsh.ruff",
"ms-python.isort",
"kevinrose.vsc-python-indent",
"njpwerner.autodocstring",

// Jupyter / scientific computing
"ms-toolsai.jupyter",
"ms-toolsai.vscode-jupyter-cell-tags",
"ms-toolsai.vscode-jupyter-slideshow",

// Scientific Computing & Data Science
"ms-toolsai.jupyter-keymap",
"ms-toolsai.jupyter-renderers",
"ms-python.vscode-pylance",
"njpwerner.autodocstring",
// Git & Version Control
"ms-toolsai.vscode-jupyter-cell-tags",
"ms-toolsai.vscode-jupyter-slideshow",

// Git & GitHub
"eamodio.gitlens",
"github.vscode-pull-request-github",
"github.copilot",
"github.copilot-chat",
// Documentation & Markdown

// Docs & config files
"yzhang.markdown-all-in-one",
"davidanson.vscode-markdownlint",
"ms-vscode.vscode-json",

// Development Tools
"ms-vscode.vscode-yaml",
"redhat.vscode-xml",
"ms-vscode.cmake-tools",
"ms-vscode.cpptools",

// Visualization & Plotting
"ms-python.debugpy",
"kevinrose.vsc-python-indent",
"donjayamanne.python-environment-manager",

// Remote Development
"ms-vscode-remote.remote-containers",
"ms-vscode-remote.remote-ssh",
"ms-vscode-remote.remote-wsl"
"redhat.vscode-yaml"
],
"settings": {
"python.defaultInterpreterPath": "/opt/conda/envs/AutoQuake_v0/bin/python",
"python.terminal.activateEnvironment": true,
"python.terminal.activateEnvInCurrentTerminal": true,
"python.linting.enabled": true,
"python.linting.pylintEnabled": false,
"python.linting.flake8Enabled": true,
"python.formatting.provider": "black",
"python.formatting.blackArgs": ["--line-length=88"],
"python.sortImports.args": ["--profile", "black"],
"ruff.args": ["--config", "pyproject.toml"],
"ruff.enable": true,
"ruff.organizeImports": true,
"editor.formatOnSave": true,
"editor.codeActionsOnSave": {
"source.organizeImports": "explicit",
"source.fixAll.ruff": "explicit"
"[python]": {
"editor.defaultFormatter": "charliermarsh.ruff",
"editor.codeActionsOnSave": {
"source.organizeImports.ruff": "explicit",
"source.fixAll.ruff": "explicit"
}
},
"files.trimTrailingWhitespace": true,
"files.insertFinalNewline": true,
Expand Down
44 changes: 12 additions & 32 deletions .devcontainer/post-create.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#!/bin/bash
set -e

echo "🚀 Setting up AutoQuake development environment..."

Expand All @@ -7,50 +8,29 @@ source /opt/conda/etc/profile.d/conda.sh

# Activate the AutoQuake environment
conda activate AutoQuake_v0

# Verify environment activation
echo "📦 Active conda environment: $CONDA_DEFAULT_ENV"

# Install development dependencies (ipykernel and jupyterlab already in env-codespace.yml)
echo "🔧 Installing development tools..."
pip install --no-cache-dir \
black \
isort \
flake8 \
pre-commit

# Install the AutoQuake package in development mode
echo "📥 Installing AutoQuake in development mode..."
pip install -e .
# Dev-only tooling (kept out of the conda env so it stays lean).
# Ruff replaces black + isort + flake8; pre-commit runs it on every commit.
echo "🔧 Installing development tools (ruff, pre-commit)..."
pip install --no-cache-dir ruff pre-commit

# Initialize git submodules if they exist
# Initialize git submodules (EQNet, GaMMA) so the full pipeline can import them.
if [ -f ".gitmodules" ]; then
echo "🔗 Initializing git submodules..."
git submodule update --init --recursive
fi

# Set up pre-commit hooks for code quality
# Install pre-commit hooks for code quality (commit + push stages).
echo "🎯 Setting up pre-commit hooks..."
pre-commit install
pre-commit install --hook-type pre-push

# Create Jupyter kernel for the environment
# Register a Jupyter kernel for the environment.
echo "📓 Setting up Jupyter kernel..."
python -m ipykernel install --user --name=AutoQuake_v0 --display-name="AutoQuake v0.1"

# Create commonly used directories
mkdir -p data
mkdir -p outputs
mkdir -p logs

# Set up git configuration helper
echo "🔧 Setting up git configuration..."
echo '#!/bin/bash
echo "Quick setup for git configuration:"
echo "git config --global user.name \"Your Name\""
echo "git config --global user.email \"your.email@example.com\""
' > setup-git.sh
chmod +x setup-git.sh

echo "✨ AutoQuake development environment setup completed!"
echo "✨ AutoQuake development environment ready!"
echo ""
echo "🚀 Ready for AutoQuake development!"
echo " Run the test suite with: pytest tests/unit -m \"not integration\""
echo " Run the full pipeline with: python predict.py <config.json>"
83 changes: 83 additions & 0 deletions .github/workflows/submodule-check.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
name: Submodule Compatibility Check

on:
# Manual trigger
workflow_dispatch:

# Weekly check on Sunday at 00:00 UTC
schedule:
- cron: '0 0 * * 0'

env:
PYTHON_VERSION: "3.10"

jobs:
check-submodules:
name: Check Submodule Compatibility
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
submodules: recursive
fetch-depth: 0

- name: Fetch latest submodule commits
run: |
git submodule foreach 'git fetch origin'

- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: ${{ env.PYTHON_VERSION }}

- name: Install dependencies
run: |
pip install pytest pandas pydantic numpy pyproj

- name: Run compatibility check
run: python scripts/check-submodule-compat.py

- name: Run tests with current submodules
run: pytest tests/ -v --tb=short
continue-on-error: true

- name: Create issue if tests fail
if: failure()
uses: actions/github-script@v7
with:
script: |
const title = 'Submodule Compatibility Issue Detected';
const body = `
## Submodule Compatibility Check Failed

The weekly submodule compatibility check has detected potential issues.

**Workflow Run:** [View Details](${process.env.GITHUB_SERVER_URL}/${process.env.GITHUB_REPOSITORY}/actions/runs/${process.env.GITHUB_RUN_ID})

Please review the workflow logs and address any compatibility issues before updating submodules.

### Next Steps
1. Review the compatibility report in the workflow logs
2. Check for API changes in submodules
3. Update code if necessary
4. Run \`python scripts/check-submodule-compat.py\` locally to verify fixes
`;

// Check if issue already exists
const issues = await github.rest.issues.listForRepo({
owner: context.repo.owner,
repo: context.repo.repo,
state: 'open',
labels: 'submodule-compat'
});

if (issues.data.length === 0) {
await github.rest.issues.create({
owner: context.repo.owner,
repo: context.repo.repo,
title: title,
body: body,
labels: ['submodule-compat', 'automated']
});
}
Loading
Loading