PFS spectral simulator web app using PFS Exposure Time Calculator and Spectrum Simulator.
This project supports multiple Python package managers:
- uv (recommended) - Modern, fast package manager
- PDM - Python Development Master
- pip + venv - Traditional Python package management
Choose the one that best fits your workflow.
See requirements.txt for the complete list of dependencies.
First of all, please clone this repository. There are several ways to install the app.
# Install uv if not already installed
curl -LsSf https://astral.sh/uv/install.sh | sh
# Sync dependencies
uv sync
# With documentation dependencies
uv sync --extra mkdocs# Install PDM if not already installed
pip install pdm
# Install dependencies
pdm install
# With documentation dependencies
pdm install -G mkdocs# Create virtual environment
python3 -m venv .venv
source .venv/bin/activate # On Windows: .venv\Scripts\activate
# Install dependencies
pip install -r requirements.txt
pip install -e .
# With documentation dependencies
pip install -e .[mkdocs]# Using helper script (auto-detects package manager)
./scripts/build-doc.sh
# Or manually
cd docs && mkdocs buildThe documentation is built under docs/site.
If you have Docker installed, you can run the Docker image as follows.
docker run -it -p 8080:8080 --rm monodera/pfs_etc_webYou can deploy the app to Google Cloud Run.
gcloud run deploy pfsetcweb --source .The project includes helper scripts in the scripts/ directory that automatically detect your package manager:
# Start the web application
./scripts/serve-app.sh
# Start documentation server
./scripts/serve-doc.sh
# Build documentation
./scripts/build-doc.sh
# Generate requirements.txt
./scripts/gen-requirements.shYou can force a specific package manager:
./scripts/serve-app.sh uv # Force use of uv
./scripts/serve-app.sh pdm # Force use of PDM
./scripts/serve-app.sh venv # Force use of venvAccess the app at: http://localhost:5007/etc
Note: The project provides a run_pfs_etc_web CLI command, but using the shell scripts or direct panel serve commands is recommended as they provide more complete configuration (static directories, URL prefix, WebSocket settings, etc.).
With uv:
# Run the web app
uv run panel serve ./app.py --static-dirs doc=docs/site --prefix=etc --port=5007
# Build documentation
cd docs && uv run mkdocs buildWith PDM:
# Use PDM scripts (existing functionality)
pdm run serve-app
pdm run build-doc
pdm run serve-doc
pdm run gen-requirements
# Or run directly
pdm run panel serve ./app.py --static-dirs doc=docs/site --prefix=etc --port=5007With venv:
source .venv/bin/activate
# Run the web app
panel serve ./app.py --static-dirs doc=docs/site --prefix=etc --port=5007
# Build documentation
cd docs && mkdocs buildYou can specify the number of threads used by the ETC using OMP_NUM_THREADS environment variable. A larger number of threads will enable to achieve faster running time, but reduce the per-thread efficiency of the computation. My experiment with AMD EPYC 7542 is summarized as follows.
| OMP_NUM_THREADS | time (s) |
|---|---|
| 1 | 274.09 |
| 2 | 158.04 |
| 4 | 82.05 |
| 8 | 45.94 |
| 16 | 23.91 |
| 32 | 13.17 |
| 64 | 7.99 |
| 128 | 4.83 |
Open http://localhost:8080/app in a web browser.
Open your app URL in a web browser.