Telescope Mode
TerraLab includes a precision telescope simulator that overlays a field-of-view indicator on the sky canvas. This mode simulates telescope and camera sensor combinations to help plan observations and framing.Activating Telescope Mode
To enable telescope mode:- Click the telescope mode button in the UI
- The screen will darken with a semi-transparent overlay
- Click on the sky to set the center of your telescope’s view
- Escape: Exit telescope mode and return to normal view
FOV Shapes
TerraLab supports two FOV indicator shapes:Circle Mode
Simulates a circular eyepiece field of view or circular sensor crop:- Diameter calculated from the smaller dimension (min of width/height)
- Smooth boundary using 180+ interpolation points for accurate spherical rendering
- Ideal for visual observers
Rectangle Mode
Simulates a camera sensor or rectangular eyepiece:- Aspect ratio matches sensor dimensions
- Corners use spherical arc interpolation (36 points per edge)
- Supports rotation for framing flexibility
FOV Calculation
The field of view is computed using standard optical formulas:Sensor-Based FOV
telescope_scope_mode.py:27-32):
| Preset | Width (mm) | Height (mm) | Typical Use |
|---|---|---|---|
| tiny | 5.37 | 4.04 | 1/2.8” sensor (smartphone/compact) |
| aps_c | 23.6 | 15.7 | APS-C DSLR/mirrorless |
| full_frame | 36.0 | 24.0 | Full-frame camera |
Manual FOV Override
You can set custom FOV dimensions directly:set_manual_fov(width_deg, height_deg): Specify exact angular dimensionsclear_manual_fov(): Return to sensor-based calculation- Useful for eyepieces with specified AFOV ratings
Aspect Ratio Override
For rectangle mode, you can force a specific aspect ratio:set_aspect_ratio(ratio): Sets width/height ratio (0.2 to 5.0)- Useful for cropped sensors or special formats
Telescope Parameters
Focal Length
- Range: 1mm to infinity
- Default: 250mm
- Controls magnification and field of view
set_focal_mm(focal_mm): Update telescope focal length
Sensor Selection
set_sensor_key(key): Choose from presets (“tiny”, “aps_c”, “full_frame”)- Automatically calculates FOV based on focal length
Navigation and Movement
Movement Modes
Two speed modes are available: Slow Mode (default):- Step size: 0.05 arcminutes (3 arcseconds)
- Hold rate: 0.5 arcminutes per second
- For fine adjustments and high-magnification work
- Step size: 0.05 degrees (3 arcminutes)
- Hold rate: 0.5 degrees per second
- For slewing and coarse positioning
Keyboard Navigation
When telescope mode is active, arrow keys control the view:- Up Arrow: Nudge altitude up
- Down Arrow: Nudge altitude down
- Left Arrow: Nudge azimuth left
- Right Arrow: Nudge azimuth right
- Single tap: Discrete step (based on current speed mode)
- Hold key: Continuous movement at configured hold rate
- Movement rate calculated in
telescope_scope_mode.py:122-126
Mouse Navigation
Click-to-Center:- Click anywhere on the sky to instantly center the FOV indicator
- Uses
screen_to_sky()projection to convert screen coordinates to celestial coordinates
- Click and hold inside the FOV indicator
- Drag to pan the view (camera-like inverse motion)
- Precise for small adjustments
Goto Functionality
Programmatic centering is available via:- Normalizes altitude to [-89.9°, 89.9°] to avoid pole singularities
- Normalizes azimuth to [0°, 360°)
- Cancels “awaiting click” state
Visual Rendering
Dark Overlay
The area outside the FOV indicator is shaded with:- Semi-transparent black overlay (190 alpha)
- Creates “tunnel vision” effect
- Interior remains fully clear for unobstructed view
Boundary Rendering
FOV boundary features:- Subtle white glow (35 alpha, 1.2px width)
- Bright white edge (120 alpha, 0.8px width)
- Anti-aliased for smooth appearance
Crosshair
Center of FOV marked with:- 8-pixel arm length cross
- Dual-layer rendering (glow + bright core)
- White dot at exact center (1.2px radius)
HUD Information
The telescope HUD displays in dual side panels:Left Panel (Core Scope Info)
Circle Mode:Right Panel (Optical Telemetry)
Displays atmospheric and optical metrics:- Exit pupil diameter (mm) - computed from aperture and magnification
- Airmass factor (X) - atmospheric path length multiplier
- Extinction coefficient (k) - magnitude loss per airmass
- Atmospheric transmission (%) - light reaching the telescope
HUD Positioning
- Panels positioned at vertical center of FOV indicator
- Left panel: 12px from left edge
- Right panel: 12px from right edge
- Clamped to viewport bounds to prevent off-screen rendering
- Compact sizing based on actual text width (max 360px)
Atmospheric Calculations
Telescope mode integrates with TerraLab’s atmospheric model:Airmass
Computed from altitude angle using:Extinction Coefficient
When weather mode is enabled:- Fetches real-time AOD (Aerosol Optical Depth) from Copernicus CAMS
- Fetches surface pressure data
- Computes k-extinction:
extinction_k_mag_per_airmass(aod, pressure_hpa) - Falls back to k=0.20 if data unavailable
telescope_runtime.py:258-273
Magnitude Loss
Atmospheric attenuation calculated as:Transmission
Percentage of light transmitted through atmosphere:Exit Pupil Calculation
For visual observing (not camera mode):- Below 0.5mm: Diffraction-limited resolution
- Above 7mm: Wasted light (exceeds dark-adapted pupil)
telescope_runtime.py:332-344
Integration with Star Rendering
Telescope mode modifies the magnitude rendering system:Scope Magnitude Limit
general_mlim: Naked-eye limiting magnitude from Bortle class- Aperture advantage increases magnitude reach
- Computed in
telescope_runtime.py:452-478
Active Scope Rendering
Whenscope_enabled=True:
- Star magnitude limit switches to
scope_mlim - Only stars within FOV boundary rendered at enhanced brightness
- Background stars dimmed by overlay
Implementation Details
Controller State
TheTelescopeScopeController class maintains:
enabled: Boolean flag for active stateawaiting_center_click: True until first click placementshape: “circle” or “rectangle”speed_mode: “slow” or “fast”center: (alt, az) tuple for current pointingdragging: Boolean for mouse drag state
telescope_scope_mode.py:47-59
Projection
FOV boundary points projected using:destination_point(center, bearing, radius): Spherical geometryslerp_arc_points(p0, p1, n): Great circle arc interpolation- Stereographic projection to screen coordinates
Coordinate Systems
- Sky Coords: (altitude_deg, azimuth_deg) in horizontal coordinate system
- Screen Coords: (x, y) in pixel coordinates
- Conversion via
project_fnandunproject_fncallbacks - Handles pole singularities and azimuth wrapping