Line Of Sight

soapy.lineofsight module

A generalised module to provide phase or the EField through a “Line Of Sight”

Line of Sight Object

The module contains a ‘lineOfSight’ object, which calculates the resulting phase or complex amplitude from propogating through the atmosphere in a given direction. This can be done using either geometric propagation, where phase is simply summed for each layer, or physical propagation, where the phase is propagated between layers using an angular spectrum propagation method. Light can propogate either up or down.

The Object takes a ‘config’ as an argument, which is likely to be the same config object as the module using it (WFSs, ScienceCams, or LGSs). It should contain paramters required, such as the observation direction and light wavelength. The config also determines whether to use physical or geometric propagation through the ‘propagationMode’ parameter.

Examples:

from soapy import confParse, lineofsight

# Initialise a soapy conifuration file
config = confParse.loadSoapyConfig('conf/sh_8x8.py')

# Can make a 'LineOfSight' for WFSs
los = lineofsight.LineOfSight(config.wfss[0], config)

# Get resulting complex amplitude through line of sight
EField = los.frame(some_phase_screens)
class soapy.lineofsight.LineOfSight(config, soapyConfig, propagation_direction='down', out_pixel_scale=None, nx_out_pixels=None, mask=None, metaPupilPos=None)[source]

Bases: object

A “Line of sight” through a number of turbulence layers in the atmosphere, observing ing a given direction.

Parameters:
  • config – The soapy config for the line of sight
  • simConfig – The soapy simulation config object
  • propagationDirection (str, optional) – Direction of light propagation, either “up” or “down”
  • outPxlScale (float, optional) – The EField pixel scale required at the output (m/pxl)
  • nOutPxls (int, optional) – Number of pixels to return in EFIeld
  • mask (ndarray, optional) – Mask to apply at the beginning of propagation
  • metaPupilPos (list, dict, optional) – A list or dictionary of the meta pupil position at each turbulence layer height ub metres. If None, works it out from GS position.
allocDataArrays()[source]

Allocate the data arrays the LOS will require

Determines and allocates the various arrays the LOS will require to avoid having to re-alloc memory during the running of the LOS and keep it fast. This includes arrays for phase and the E-Field across the LOS

calcInitParams(out_pixel_scale=None, nx_out_pixels=None)[source]

Calculates some parameters required later

Parameters:
  • outPxlScale (float) – Pixel scale of required phase/EField (metres/pxl)
  • nOutPxls (int) – Size of output array in pixels
calculate_altitude_coords(layer_altitude)[source]

Calculate the co-ordinates of vertices of fo the meta-pupil at altitude given a guide star direction and source altitude

Paramters:
layer_altitude (float): Altitude of phase layer
frame(scrns=None, correction=None)[source]

Runs one frame through a line of sight

Finds the phase or complex amplitude through line of sight for a single simulation frame, with a given set of phase screens and some optional correction.

Parameters:
  • scrns (list) – A list or dict containing the phase screens
  • correction (ndarray, optional) – The correction term to take from the phase screens before the WFS is run.
  • read (bool, optional) – Should the WFS be read out? if False, then WFS image is calculated but slopes not calculated. defaults to True.
Returns:

WFS Measurements

Return type:

ndarray

height
makePhase(radii=None, apos=None)[source]

Generates the required phase or EField. Uses difference approach depending on whether propagation is geometric or physical (makePhaseGeometric or makePhasePhys respectively)

Parameters:
  • radii (dict, optional) – Radii of each meta pupil of each screen height in pixels. If not given uses pupil radius.
  • apos (ndarray, optional) – The angular position of the GS in radians. If not set, will use the config position
makePhaseGeometric(radii=None, apos=None)[source]

Creates the total phase along line of sight offset by a given angle using a geometric ray tracing approach

Parameters:
  • radii (dict, optional) – Radii of each meta pupil of each screen height in pixels. If not given uses pupil radius.
  • apos (ndarray, optional) – The angular position of the GS in radians. If not set, will use the config position
makePhasePhys(radii=None, apos=None)[source]

Finds total line of sight complex amplitude by propagating light through phase screens

Parameters:
  • radii (dict, optional) – Radii of each meta pupil of each screen height in pixels. If not given uses pupil radius.
  • apos (ndarray, optional) – The angular position of the GS in radians. If not set, will use the config position
performCorrection(correction)[source]

Corrects the aberrated line of sight with some given correction phase

Parameters:correction (list or ndarray) – either 2-d array describing correction, or list of correction arrays
position
zeroData(**kwargs)[source]

Sets the phase and complex amp data to zero

soapy.lineofsight.physical_atmosphere_propagation(phase_screens, output_mask, layer_altitudes, source_altitude, wavelength, output_pixel_scale, propagation_direction='up')[source]

Finds total line of sight complex amplitude by propagating light through phase screens

Parameters:
  • radii (dict, optional) – Radii of each meta pupil of each screen height in pixels. If not given uses pupil radius.
  • apos (ndarray, optional) – The angular position of the GS in radians. If not set, will use the config position