Simulating Light Propagation in the Turbulent Atmosphere with pyAtmosphere

Blake Bradford Avatar

·

Simulating Light Propagation in the Turbulent Atmosphere with pyAtmosphere

Do you need to model the behavior of light in a turbulent atmosphere? Look no further than pyAtmosphere, a powerful physics-based simulation tool that accurately simulates light propagation under various atmospheric conditions. Whether you’re researching astronomical phenomena, developing remote sensing techniques, or designing laser communication systems, pyAtmosphere can help you gain valuable insights into the complex interactions of light with the turbulent atmosphere.

Installation and GPU Usage

To get started with pyAtmosphere, it is highly recommended to set up a virtual environment for your project. This ensures a clean and isolated environment for installing the required packages. Once your virtual environment is set up, you can easily install the necessary packages using pip:

bash
pip install -r requirements.txt

If you want to take advantage of GPU acceleration for faster simulations, pyAtmosphere supports GPU usage. To enable GPU simulation, simply add the following code at the beginning of your script:

python
from pyatmosphere import gpu
gpu.config['use_gpu'] = True

Make sure you have CUDA installed on your machine and the cupy Python package installed. Refer to the provided installation links in the README for detailed instructions on setting up CUDA and installing the required packages.

QuickChannel Example

To quickly simulate light propagation in a turbulent atmosphere, you can use the QuickChannel class from pyAtmosphere. Here’s an example code snippet:

from pyatmosphere import QuickChannel

quick_channel = QuickChannel(
Cn2=1e-15,
length=10000,
count_ps=5,
beam_w0=0.09,
beam_wvl=8.08e-07,
aperture_radius=0.12
)

quick_channel.plot()

This code creates a QuickChannel object with specific parameters for the turbulence strength, channel length, number of phase screens, beam properties, and aperture size. You can then visualize the resulting light intensity distribution using the plot() method.

Advanced Channel Configuration

For more advanced simulations, pyAtmosphere provides a comprehensive set of classes to configure various aspects of the simulation. In the following example, we create a Channel object with a custom configuration:

import numpy as np
from pyatmosphere import (
Channel,
RectGrid,
RandLogPolarGrid,
GaussianSource,
IdenticalPhaseScreensPath,
SSPhaseScreen,
CirclePupil,
MVKModel,
measures
)

channel = Channel(
grid=RectGrid(
resolution=2048,
delta=0.0015
),
source=GaussianSource(
wvl=808e-9,
w0=0.12,
F0=np.inf
),
path=IdenticalPhaseScreensPath(
phase_screen=SSPhaseScreen(
model=MVKModel(
Cn2=5e-16,
l0=6e-3,
L0=1e3,
),
f_grid=RandLogPolarGrid(
points=2**10,
f_min=1 / 1e3 / 15,
f_max=1 / 6e-3 * 2
)
),
length=50e3,
count=5
),
pupil=CirclePupil(
radius=0.2
),
)

channel_output = channel.run(pupil=False)
intensity = measures.I(channel, output=channel_output)
mean_x = measures.mean_x(channel, output=channel_output)

In this example, we create a Channel object with a customized configuration. We specify the grid resolution, source properties, phase screen model, path length, and pupil characteristics. We then run the simulation and calculate measures such as light intensity and mean x-coordinate based on the simulation output.

Simulations and Results

pyAtmosphere offers several simulation classes to analyze and visualize the simulated light propagation. Here’s an example of running simulations and obtaining results:

from pyatmosphere import simulations

beam_result = simulations.BeamResult(quick_channel, max_size=2000)
pdt_result = simulations.PDTResult(quick_channel, max_size=6000)
sim = simulations.Simulation([beam_result, pdt_result])
sim.run(plot_step=1000)

In this example, we create simulation result objects for beam intensity and polarization degree of transmission (PDT). We then create a Simulation object with these result objects and run the simulation, specifying the desired plot step.

Contributing and License

pyAtmosphere is an open-source project, and contributions are welcome. If you encounter any issues or have suggestions for improvements, feel free to open an issue or submit a pull request on the GitHub repository.

The project is licensed under the GNU GPLv3 license, ensuring the freedom to use, modify, and distribute the software. Refer to the provided licensing link in the README for more details.

Conclusion

In conclusion, pyAtmosphere is a valuable tool for simulating light propagation in turbulent atmospheres. Whether you’re studying the effects of atmospheric turbulence or designing optical systems, pyAtmosphere provides an intuitive and powerful framework for accurate simulations. By incorporating GPU computation, it can greatly accelerate simulation times, making it even more versatile for large-scale simulations. Explore the possibilities with pyAtmosphere and unlock new insights into the behavior of light in the turbulent atmosphere.

Image source

References:
– pyAtmosphere GitHub repository: https://github.com/NYurin/pyAtmosphere
– pyAtmosphere License: GNU GPLv3

Leave a Reply

Your email address will not be published. Required fields are marked *