Parametric Cn² profiles
Since TipTop v1.6.0, the module tiptop.atmoProfile generates realistic, normalised Cn² profiles from one or two integrated parameters: the isoplanatic angle θ₀ and/or the ground-layer (GL) fraction, i.e. the fraction of Cn² below 1 km. The profiles are consistent with the statistics of the Stereo-SCIDAR Paranal database (2016–2021).
This is useful whenever you know the integrated turbulence parameters of a site or of an observing condition, but not the full profile: performance studies versus θ₀, sky-coverage or ETC grids, or random draws of plausible profiles.
All quantities are given at zenith and at 500 nm.
The model
A normalised profile (sum of the weights = 1) is built from three components:
| Component | Altitude range | Role |
|---|---|---|
| Ground-layer bump | ground bin + a fixed tail up to 1 km | carries the GL fraction f |
| Background | full altitude range, fixed shape | smooth contribution at all altitudes |
| 5 Gaussian bumps | low (1–4 km), low-mid (3–7 km), mid (5–10 km), jet (10–17 km), high (17–25 km) | free-atmosphere layers, with a fixed FWHM per window |
The share of the ground bin, the bump altitudes and the bump powers are either set to their median values or drawn at random from the Stereo-SCIDAR statistics. Since θ₀ depends only on the moment Σ w h5/3, the constraints are solved in closed form:
| You give | What the model does |
|---|---|
theta0 only | the GL fraction f is solved to reach θ₀ |
theta0 and glFraction | the power of the jet bump is solved (if it reaches a limit, the next bump from the ground up takes over) |
glFraction only, or nothing | θ₀ is an output; f defaults to the Paranal median (≈ 0.63) |
Quick example
from tiptop.atmoProfile import generateProfile, seeingToR0, theta0FromProfile
r0 = seeingToR0(0.8) # 0.8" seeing at 500 nm -> r0 = 0.126 m
# Median profile with theta0 = 2.0" and 60 % of the turbulence below 1 km
heights, weights, info = generateProfile(r0, theta0=2.0, glFraction=0.6)
print(len(heights)) # 20 layers (default grid)
print(theta0FromProfile(heights, weights, r0)) # 2.0
print(info['glFraction']) # 0.6
By default the profile is returned on 20 layers from 0 to 20 km, spaced linearly near the ground and logarithmically above (see logGrid). Pass your own altitudes with layerHeights, or layerHeights=None to get the native 250 m grid of the model.
info also contains the ground-bin share ('g0'), the bump altitudes ('bumpHeights', in m) and powers ('bumpPowers').
Use the profile in a TipTop simulation
The profile goes into the Cn2Heights and Cn2Weights keys of the [atmosphere] section. You can write it in the .ini file, or set it in memory with baseSimulation (see Parameter sweep).
atmoProfile generates the Cn² profile only: the model is built on Stereo-SCIDAR Cn² statistics, which contain no wind information. WindSpeed and WindDirection must have one value per layer, and you must provide them, for example from site measurements or from the profile of an official instrument configuration. The wind sets τ₀, hence the temporal error: a constant value is rarely realistic.
The helper layerWind takes a wind profile defined on the 250 m grid of the model (GRID, 0 to 24.75 km) and averages it onto your layers with the Cn² weights, so that τ₀ is preserved. The example below uses the Bufton wind model, a generic analytical profile widely used in AO (ground wind + a jet-stream peak): it is given as an illustration, not as a calibration of a specific site.
import numpy as np
from tiptop.tiptop import baseSimulation
from tiptop.atmoProfile import GRID, generateProfile, layerWind, seeingToR0
sim = baseSimulation(path_in, file_in, path_out, file_in)
atm = sim.my_data_map['atmosphere']
r0 = seeingToR0(atm['Seeing'])
heights, weights, _ = generateProfile(r0, theta0=2.0) # 20 layers
_, weightsFine, _ = generateProfile(r0, theta0=2.0, layerHeights=None) # 250 m grid
# Bufton wind model on the 250 m grid: 5 m/s at the ground + a jet stream at 9.4 km
windFine = 5 + 30 * np.exp(-((GRID - 9400) / 4800) ** 2)
dirFine = np.zeros_like(GRID) # wind direction [deg], here the same for all altitudes
speed, direction = layerWind(windFine, dirFine, heights, weightsFine)
atm['Cn2Heights'] = heights.tolist()
atm['Cn2Weights'] = weights.tolist()
atm['WindSpeed'] = speed.tolist() # from ~5.6 m/s at the ground to ~35 m/s near 9 km
atm['WindDirection'] = direction.tolist()
sim.doOverallSimulation()
sim.computeMetrics()
print(sim.sr, sim.fwhm)
Replace windFine and dirFine with your own wind profile on GRID (interpolate it with np.interp if it is given at other altitudes).
Random profiles
Pass a NumPy random generator to draw a plausible profile instead of the median one. The constraints (θ₀ and/or f) are still met exactly:
import numpy as np
rng = np.random.default_rng(1)
profiles = [generateProfile(r0, theta0=2.0, rng=rng) for _ in range(100)]
Draws that cannot meet the constraints are redrawn, up to maxTries times (default 100).
Limits
- A
ValueErroris raised if the requested (θ₀, f) pair cannot be reached by the model, for example a very large θ₀ together with a low GL fraction. - A
UserWarningis issued if the GL fraction is outside the range observed at Paranal (1st–99th percentile, about 0.13 to 0.94).
Function reference
| Function | Description |
|---|---|
generateProfile(r0, theta0=None, glFraction=None, layerHeights=<20 layers>, rng=None, maxTries=100) | Normalised Cn² profile with the given θ₀ [arcsec] and/or GL fraction. Returns (heights, weights, info). |
logGrid(n=20, h0=1500., hTop=20000.) | Layer altitudes [m] uniform in log(1 + h/h0) from 0 to hTop: ~linear below h0, logarithmic above. |
layerWind(windSpeed, windDirection, layerHeights, weights) | Cn²-weighted wind speed (preserving τ₀) and direction on the layers, from a profile on the 250 m grid. |
theta0FromProfile(heights, weights, r0) | Isoplanatic angle [arcsec]: θ₀ = 0.314 r0 / (Σ w h5/3)3/5. |
seeingToR0(seeing, wvl=500e-9) | Fried parameter [m] from the seeing FWHM [arcsec], with seeing = 0.98 λ / r0. |
r0ToSeeing(r0, wvl=500e-9) | Seeing FWHM [arcsec] from the Fried parameter [m]. |