Repository Structure
This page gives a high-level overview of how the METIS Simulations repository is organised, what each module does, and how data flows through the system.
Directory Layout
METIS_Simulations/
├── .github/workflows/ CI pipelines (daily build + PR checks)
├── docs/ This documentation (Sphinx / ReadTheDocs)
├── fitsWrangler/ Legacy FITS manipulation utilities (kept for reference)
├── ScienceCases/ Notebooks for science-case prototyping
├── Simulations/ Main simulation framework
│ ├── python/ All Python source code
│ ├── YAML/ Observation template definitions (~40 files)
│ ├── sofFiles/ Set-of-frames files for pipeline recipes
│ ├── sofTemplates/ SOF file templates
│ ├── runESO.sh Full ESO production run (all modes)
│ └── runESOsmall.sh Small/CI run (32x32 px images)
├── pyproject.toml Poetry project & dependency definition
└── README.md
The Simulations/ Directory
Almost all relevant code lives under Simulations/.
Simulations/python/ – Python Modules
Core framework
Module |
Purpose |
|---|---|
|
Central orchestrator. Loads YAML templates, runs ScopeSim for each template, generates calibrations, and post-processes FITS headers. |
|
Thin wrapper around ScopeSim. Configures |
|
Defines valid parameter values (categories, technologies, types, modes, filters, ND filters) and calibration frame templates. |
|
Catalogue of astronomical and calibration sources (star fields, galaxies, flat fields, pinhole mask, laser spectra, etc.). |
|
High-level function that runs a list of YAML files in sequence with shared parameters and sequential timestamps. |
|
Generates prototype FITS files for static/external calibrations (pinhole table, laser table, distortion solution, etc.). |
Simulation block scripts
Each script defines a complete simulation block – the set of YAML files and parameters needed to produce all raw + calibration files for a given instrument mode. See Workflow Summary for details.
Script |
Small variant |
Mode |
|---|---|---|
|
|
LM-band imaging |
|
|
N-band imaging |
|
|
LM-band long-slit spectroscopy |
|
|
N-band long-slit spectroscopy |
|
|
IFU (LMS) spectroscopy |
|
|
Standalone calibrations (chopper home, pupil, slit loss) |
|
|
High-contrast imaging – RAVC coronagraph (LM) |
|
|
High-contrast imaging – APP coronagraph (LM) |
|
|
High-contrast imaging – RAVC coronagraph (IFU) |
Utilities
Module |
Purpose |
|---|---|
|
CI entry-point: runs every |
|
Extracts a CSV summary from generated FITS files. |
|
Validates FITS header keywords. |
|
Validates SOF file contents. |
|
Downloads IRDB instrument data packages. |
|
Generates SOF files from simulation output. |
|
Extracts headers from existing FITS files. |
Simulations/YAML/ – Observation Templates
Each YAML file defines one or more observation templates. Templates are grouped by purpose:
Science observations – scienceLM.yaml, scienceN.yaml,
scienceLSSLM.yaml, scienceLSSN.yaml, scienceIFU.yaml
Standard stars – stdLM.yaml, stdN.yaml, stdLSSLM.yaml,
stdLSSN.yaml, stdIFU.yaml
Detector calibrations – detlinLM.yaml, detlinN.yaml,
detlinIFU.yaml (linearity); darkLM.yaml, darkN.yaml,
darkIFU.yaml (darks)
Flat fields – flatLampLM.yaml, flatLampN.yaml,
flatTwilightLM.yaml, flatTwilightN.yaml
Spectral response – rsrfLSSLM.yaml, rsrfLSSN.yaml,
rsrfIFU.yaml, rsrfPinhLSSLM.yaml, rsrfPinhLSSN.yaml,
rsrfPinhIFU.yaml
Wavelength calibration – wavecalLSSLM.yaml, wavecalLSSN.yaml,
wavecalIFU.yaml
Distortion – distortionLM.yaml, distortionN.yaml,
distortionIFU.yaml
High-contrast imaging – hciRavcLM.yaml, hciAppLM.yaml,
hciRavcIfu.yaml, offAxisLM.yaml
Technical – chophomeLM.yaml, pupilLM.yaml, pupilN.yaml,
slitlossLSSLM.yaml, slitlossLSSN.yaml, persistLM.yaml, etc.
Data Flow
The following diagram shows how data moves through the framework, from YAML templates to final FITS output:
YAML template files
│
▼
setupSimulations.loadYAML() parse & validate templates
│
▼
simulationDefinitions check valid parameter values
│
▼
scopesimWrapper.simulate() configure & run ScopeSim
│
├──▶ sources.py look up source definition
├──▶ ScopeSim OpticalTrain
└──▶ METIS IRDB instrument reference data
│
▼
Raw FITS files direct ScopeSim output
│
▼
setupSimulations.updateHeaders() add/fix ESO-compliant keywords
│
▼
makeCalibPrototypes generate static calibration files
│
▼
Final FITS output ready for pipeline recipes
Key concepts:
Observation template – a single YAML block describing one type of observation (e.g. a science exposure, a dark frame, a flat field).
Simulation block – a Python script that bundles several YAML files and a parameter dict into a self-contained dataset for one instrument mode.
Static calibrations – external calibration FITS files (pinhole table, laser table, distortion solution, etc.) generated by
makeCalibPrototypes.py.Sequential timestamps – when
sequence=True, each exposure in a block gets a unique, incrementingMJD-OBSto mimic a real observing night.
Dependencies
The framework depends on the ScopeSim simulation stack:
ScopeSim – core optical simulation engine.
ScopeSim_Templates – pre-built source templates.
IRDB – Instrument Reference Database containing the METIS instrument model.
Plus standard astronomy Python packages: numpy, astropy,
matplotlib, astar-utils.
CI / Automation
Two GitHub Actions workflows exist:
run_recipes.ymlTriggered on PRs and pushes to
main. RunstestAll.pywhich executes every simulation block in small mode (32x32 px images) to verify ScopeSim integration.daily_build.yamlNightly build on a self-hosted runner. Runs the full
runESO.shproduction script and archives output to/data/<date>/.