Atmosphere¶
The Atmosphere class represents a multi-layer atmosphere with Von Kármán statistics.
Each layer is defined with altitude, wind speed/direction, and Cn2 contribution. Layers can be updated, saved to disk, and used to compute the OPD (Optical Path Difference) for various line-of-sight sources.
Attributes: r0 (float): Fried parameter at 500 nm. L0 (float): Outer scale of turbulence. windSpeed (List[float]): Wind speeds per layer. windDirection (List[float]): Wind directions per layer. altitude (List[float]): Altitudes of each layer. fractionalR0 (List[float]): Relative contribution of each layer to turbulence.
__init__ ¶
__init__(
r0: float,
L0: float,
windSpeed: list,
fractionalR0: list,
windDirection: list,
altitude: list,
telescope,
zenith: float = 0.0,
logger=None,
)
Initialize an Atmosphere object representing layered atmospheric turbulence.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
r0
|
float
|
Fried parameter at 500 nm [m] and pointing to zenith. |
required |
L0
|
float
|
Outer scale of turbulence [m]. |
required |
windSpeed
|
list of float
|
Wind speed for each layer [m/s]. |
required |
fractionalR0
|
list of float
|
Cn2 profile; fractional contribution to turbulence per layer. |
required |
windDirection
|
list of float
|
Wind direction for each layer [degrees]. |
required |
altitude
|
list of float
|
Altitude of each layer [m]. |
required |
telescope
|
Telescope object
|
Telescope class instantiation to take certain parameters required for the atmosphere. |
required |
zenith
|
float, optional, by default 0.0
|
Zenith angle [degrees] of the telescope during the simulation, to automatically convert the r0 given to the specific conditions. |
0.0
|
logger
|
Logger
|
Logger instance for this object, by default None. |
None
|
initializeAtmosphere ¶
Initialize the atmosphere layers using the telescope linked at construction time.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
randomState
|
int or None
|
Seed for reproducible random number generation, by default None. |
None
|
Returns:
| Type | Description |
|---|---|
bool
|
True if initialization succeeded, False otherwise. |
buildLayer ¶
Build and initialize a single atmospheric layer.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
i_layer
|
int
|
Index of the layer to build. |
required |
seed
|
int
|
Seed for the random number generator. |
None
|
Returns:
| Type | Description |
|---|---|
LayerClass
|
The initialized atmospheric layer. |
save ¶
Save the state of the atmosphere to a H5 file.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
filename
|
str
|
Path and base filename (with extension) to save the H5. |
required |
Returns:
| Type | Description |
|---|---|
bool
|
True if saved successfully, False otherwise. |
load ¶
Load an atmosphere configuration from a H5 file.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
filename
|
str
|
Path and base filename (with extension) of the H5 file to load. |
required |
Returns:
| Type | Description |
|---|---|
bool
|
True if loaded successfully, False otherwise. |
update ¶
Update all atmospheric layers based on wind and time step.
Returns:
| Type | Description |
|---|---|
bool
|
True if update was successful. |
updateLayer ¶
Update a single atmospheric layer, shifting the phase screen. ^ +Vy (adds row --> + to the bottom, - to the top) | | |----> +Vx (adds col --> + to the left, - to the right)
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
updatedLayer
|
LayerClass
|
The layer to update. |
required |
Returns:
| Type | Description |
|---|---|
LayerClass
|
The updated layer. |
getOPD ¶
Compute the Optical Path Difference (OPD) for a given source.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
src
|
Source or ExtendedSource
|
The light source for which to compute the OPD. |
required |
Returns:
| Type | Description |
|---|---|
ndarray
|
OPD values in meters (or list of OPDs if multiple sources). |
get_pupil_footprint ¶
Determine the pupil footprint and discretization offset for a source.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
src
|
Source
|
Light source object. |
required |
Returns:
| Type | Description |
|---|---|
Tuple[list, list]
|
A tuple of two lists: pupil footprint per layer and center offset. |
project_phase ¶
Project atmospheric phase through layers for a given source.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
src
|
Source
|
Light source object. |
required |
pupil_footprint
|
list of np.ndarray
|
Pupil masks per layer. |
required |
extra_s
|
list
|
Offset due to discretization for each layer. |
required |
Returns:
| Type | Description |
|---|---|
list
|
List of phase screens per layer. |
get_phase_layered ¶
Compute phase at a given atmospheric layer for a specific source.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
src
|
Source
|
Light source. |
required |
layer
|
LayerClass
|
Atmospheric layer. |
required |
pupil_footprint
|
ndarray
|
Pupil mask for the layer. |
required |
extra_s
|
list
|
Offset due to discretization. |
required |
Returns:
| Type | Description |
|---|---|
ndarray
|
Phase screen for the layer. |
get_opd_per_src ¶
Sum up the phases from all layers to compute the OPD for a source.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
src
|
Source
|
Light source. |
required |
phase
|
list of np.ndarray
|
Phase per layer for the source. |
required |
Returns:
| Type | Description |
|---|---|
ndarray
|
Optical Path Difference (OPD) in meters. |