Launch TerraLab
There are three ways to launch TerraLab:Initial Configuration
Configure Terrain Data
On first launch, TerraLab will check for terrain configuration. If no DEM data is found, the Terrain Config Dialog will appear automatically.
Without DEM data, TerraLab will use procedurally generated terrain as a fallback.
Download DEM Data
The dialog provides download links for public DEM repositories:- ICGC (Catalonia): High-resolution elevation data for Catalonia
- Copernicus (Europe): 25m resolution DEM covering all of Europe in 5×5 degree tiles
- Other regions: Check your national mapping agency (USGS, IGN, OS, BKG, etc.)
.asc (ESRI ASCII Grid), .tif (GeoTIFF)Select DEM Folder
Click “Seleccionar Carpeta DEM…” to choose the folder containing your elevation files. The system will validate that the folder contains supported formats.Configuration is stored in
~/.terralab/config.jsonChoose Horizon Quality
Select your preferred horizon rendering quality preset:
The change applies on the next horizon regeneration (see
| Preset | Bands | Use Case |
|---|---|---|
| Low | 10 | Fast preview, low-end hardware |
| Normal | 20 | Default balanced quality |
| High | 40 | Detailed horizon profiles |
| Ultra | 60 | Professional accuracy |
| Extreme | 80 | Maximum detail (slow initial generation) |
Quality affects the number of depth layers used for horizon calculation. Higher quality requires longer initial computation but provides better visual gradients.
terrain_config_dialog.py:16-23).Configure Light Pollution (Optional)
TerraLab supports DVNL (Defense & Veterans Night Light) GeoTIFF data for realistic light pollution modeling.
- Click the ”…” button next to the DVNL field
- Select your
.tiflight pollution raster file - If not configured, TerraLab uses an internal fallback model
terrain_config_dialog.py:122-136).Navigation Controls
Mouse Controls
Camera Rotation
Left-click + Drag: Rotate azimuth and elevation
- Horizontal drag: Change azimuth (view direction)
- Vertical drag: Change elevation (look up/down)
- Sensitivity: 0.5 degrees per pixel (see
sky_widget.py:5009)
Zoom
Mouse Wheel: Adjust field of view
- Scroll up: Zoom in (narrow FOV)
- Scroll down: Zoom out (wide FOV)
- Zoom range: 0.1× to 5.0×
- FOV calculation:
100° / zoom_level(seesky_widget.py:2441)
Telescope Mode Drag
Click + Drag (in Telescope Mode): Pan the target reticle
- Movement inverts naturally (camera-like behavior)
- Hold Ctrl + Drag to move global camera instead
- See
sky_widget.py:4943-4958
Measurement Tools
Click + Drag (in Measurement Mode): Create shapes
- Click twice for ruler tool (distance measurement)
- Click-drag for circle, square, or rectangle
- Ctrl + Drag: Override to pan camera
- Delete/Backspace: Remove selected measurement
Keyboard Controls
| Key | Action |
|---|---|
| F11 | Toggle fullscreen |
| Esc | Exit telescope/measurement mode |
| Arrow Keys | Nudge telescope reticle (fine control) |
| M | Toggle telescope movement speed (slow/fast) |
| Ctrl+L | Log astronomical positions (debug) |
Arrow keys in telescope mode use discrete steps: 0.05 arcmin (slow) or 0.05° (fast). See
telescope_scope_mode.py:42-45.Location and Time Configuration
TerraLab uses your system location and time by default, but you can override these settings in the main interface:- Latitude/Longitude: Set observer position (affects horizon calculation and celestial positions)
- Date/Time: Adjust simulation time for planning observations
- Time Speed: Control real-time simulation speed
Real Horizon Generation
Once DEM data is configured, TerraLab generates horizon profiles using raycasting with Earth curvature correction:Trigger Generation
The horizon is computed automatically when:
- DEM path is set for the first time
- Observer location changes significantly
- You manually click “Regenerar” (Regenerate)
Computation Process
TerraLab performs multi-band raycasting:
- Loads DEM tiles from cache (
.npyformat for speed) - Computes 360° azimuth sweep at 0.5° intervals
- Calculates horizon angles for each quality band
- Applies Earth curvature correction using 6,371 km radius
- Maximum raycast distance: 150 km
- 2/3 of bands cover 0-5 km (near detail)
- 1/3 of bands cover 5-150 km (atmospheric haze)
engine.py:23-118 for band generation logic.Light Pollution Understanding
TerraLab models light pollution impact on sky visibility:Bortle Scale Integration
The visual magnitude engine adjusts limiting magnitude based on the Bortle Dark Sky Scale (1-9):- Class 1: Pristine dark sky (mag ~7.8)
- Class 5: Suburban sky (mag ~5.5)
- Class 9: Inner city (mag ~4.0)
Horizon Extinction
When DVNL data is configured, TerraLab calculates local horizon extinction from light domes:- Intensity factor:
(bortle - 1) / 8scales dome contribution - Dynamic radius varies with distance to light source (up to 35 km influence)
- Extinction penalty: up to 0.15 magnitude reduction per azimuth
- See
sky_widget.py:1004-1022for the algorithm
Measurement Tools
Access measurement tools from the toolbar or keyboard shortcuts:Ruler Tool
Measures angular distance along a great circle arc:- Click two points to measure separation
- Display: Distance in degrees (
angular_distanceformula) - Use case: Separation between stars, constellation size
Shape Tools
Circle
Measure circular field of view:
- Drag from center to edge
- Shows: Diameter (deg), Area (deg²)
- Perfect for telescope eyepiece FOV
Square
Constrained rectangular FOV:
- Automatically maintains aspect ratio 1:1
- Shows: Width, Height, Area
- Useful for square sensor frames
Rectangle
Free-form rectangular FOV:
- Independent width/height control
- Rotation handle for orientation
- Shows: Width, Height, Area
- Matches most camera sensors
measurement_tools.py for implementation details.
Telescope Mode Basics
Telescope mode simulates a reticle view for framing and planning observations:Activate Telescope Mode
Click the telescope icon in the toolbar or use the menu. The screen will darken outside the simulated FOV.
Set Target Center
Click anywhere on the sky to position the reticle center. The HUD will show:
- Current FOV (degrees and arcminutes)
- Movement speed mode (SLOW/FAST)
- Optional: RA/Dec coordinates if configured
Adjust FOV
Configure your optical setup:Sensor presets (
SENSOR_PRESETS in telescope_scope_mode.py:27-32):- Tiny: 5.37×4.04 mm (~1/2.8” sensor)
- APS-C: 23.6×15.7 mm
- Full Frame: 36.0×24.0 mm
2 × arctan(sensor_size / (2 × focal_length))You can also set manual FOV override in degrees if you know your exact field width/height.
Frame Your Target
Use these controls for precise positioning:
- Arrow keys: Tap for discrete steps
- Slow mode: 0.05 arcmin steps
- Fast mode: 0.05° steps
- Click + Drag: Pan the reticle smoothly
- Ctrl + Wheel: Adjust scope FOV (change focal length)
- Wheel: Zoom global view without changing scope FOV
- M key: Toggle slow/fast movement speed
Troubleshooting
Horizon not appearing
DEM files not detected
DEM files not detected
Symptoms: Procedural terrain only, no real horizonSolutions:
- Verify DEM files are in supported format (
.asc,.tif) - Check file extensions match exactly (case-sensitive on Linux)
- Ensure folder contains files directly (not in nested subdirectories)
- Reopen terrain config dialog and reselect folder
Location outside DEM coverage
Location outside DEM coverage
Symptoms: Flat horizon or gaps in profileSolutions:
- Verify your latitude/longitude is within downloaded tile coverage
- Download additional tiles for your observation area (±150 km)
- Check console for “No valid tiles found” warnings
Computation stuck or slow
Computation stuck or slow
Symptoms: Initial generation takes >5 minutesSolutions:
- First-time generation builds
.npycache files (one-time cost) - Reduce horizon quality preset temporarily (use Normal or Low)
- Check disk I/O if files are on network storage
- Monitor console for progress messages
Performance issues
Low framerate or stuttering
Low framerate or stuttering
Solutions:
- Reduce horizon quality preset (Low = 10 bands)
- Disable light pollution DVNL if not needed
- Close other GPU-intensive applications
- Check that PyQt5 is using hardware acceleration
High memory usage
High memory usage
Solutions:
- DEM tiles are cached in RAM for speed
- Limit coverage area to necessary radius only
- Restart TerraLab to clear cache
- Consider using lower-resolution source DEMs (25m vs 5m)
Light pollution not visible
DVNL not loading
DVNL not loading
Symptoms: Light domes not appearing on horizonSolutions:
- Verify DVNL file is valid GeoTIFF (
.tif) - Check file projection matches WGS84 if possible
- Ensure file covers your observation location
- Review console for DVNL loading errors
Effect too subtle
Effect too subtle
Symptoms: Light pollution seems to have no impactSolutions:
- Increase Bortle class in settings (effect scales with Bortle)
- Point view toward known light pollution source (city direction)
- Effect is strongest at low altitudes (0-15°)
- Verify DVNL path is set in terrain config dialog
Telescope mode issues
Reticle not visible or offset
Reticle not visible or offset
Solutions:
- Click on sky to reposition reticle center
- Ensure FOV is reasonable (0.1° - 90°)
- Check that sensor + focal length combination is valid
- Press Esc and re-enter telescope mode to reset
Movement too fast or too slow
Movement too fast or too slow
Solutions:
- Press M to toggle speed mode (SLOW/FAST)
- Slow: 0.5 arcmin/s hold, 0.05 arcmin tap
- Fast: 0.5 deg/s hold, 0.05 deg tap
- Use Ctrl+Drag for camera pan if reticle movement feels wrong
Application crashes or freezes
Segmentation fault on startup
Segmentation fault on startup
Solutions:
- Check
terralab_crash.login working directory for fault handler output - Verify all dependencies installed:
pip install PyQt5 numpy skyfield - Update graphics drivers (OpenGL issues common on Linux)
- Try running with
python -m TerraLabfor detailed traceback
Skyfield import error
Skyfield import error
Symptoms:
WARNING: Skyfield not availableSolutions:- Install missing dependency:
pip install skyfield - Verify numpy is also installed (Skyfield dependency)
- Use virtual environment to avoid version conflicts
Next Steps
Core Concepts
Learn how the multi-band horizon raycasting engine works
Light Pollution Model
Deep dive into DVNL integration and Bortle scaling
API Reference
Programmatic access to ConfigManager and horizon profiles
CLI Tools
Batch processing and calibration utilities