COMPASS  5.4.4
End-to-end AO simulation tool using GPU acceleration
shesha.util.utilities Namespace Reference

Basic utilities function. More...

Functions

def rebin (a, shape)
 TODO docstring. More...
 
def fft_goodsize (s)
 find best size for a fft from size s More...
 
def bin2d (data_in, binfact)
 Returns the input 2D array "array", binned with the binning factor "binfact". More...
 
def pad_array (A, N)
 TODO docstring. More...
 
def dist (dim, xc=-1, yc=-1)
 TODO docstring. More...
 
def makegaussian (size, fwhm, xc=-1, yc=-1, norm=0)
 Returns a centered gaussian of specified size and fwhm. More...
 
def generate_square (float radius, float density=1.)
 Generate modulation points positions following a square pattern. More...
 
def generate_circle (float radius, float density=1.)
 Generate modulation points positions following a circular pattern s. More...
 
def generate_pseudo_source (float radius, additional_psf=0, density=1.)
 Used to generate a pseudo source for PYRWFS. More...
 
np.ndarray first_non_zero (np.ndarray array, int axis, int invalid_val=-1)
 Find the first non zero element of an array. More...
 

Detailed Description

Basic utilities function.

Author
COMPASS Team https://github.com/ANR-COMPASS
Version
5.4.4
Date
2022/01/24

This file is part of COMPASS https://anr-compass.github.io/compass/

Copyright (C) 2011-2023 COMPASS Team https://github.com/ANR-COMPASS All rights reserved. Distributed under GNU - LGPL

COMPASS is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 3 of the License, or any later version.

COMPASS: End-to-end AO simulation tool using GPU acceleration The COMPASS platform was designed to meet the need of high-performance for the simulation of AO systems.

The final product includes a software package for simulating all the critical subcomponents of AO, particularly in the context of the ELT and a real-time core based on several control approaches, with performances consistent with its integration into an instrument. Taking advantage of the specific hardware architecture of the GPU, the COMPASS tool allows to achieve adequate execution speeds to conduct large simulation campaigns called to the ELT.

The COMPASS platform can be used to carry a wide variety of simulations to both testspecific components of AO of the E-ELT (such as wavefront analysis device with a pyramid or elongated Laser star), and various systems configurations such as multi-conjugate AO.

COMPASS is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.

You should have received a copy of the GNU Lesser General Public License along with COMPASS. If not, see https://www.gnu.org/licenses/lgpl-3.0.txt.

Function Documentation

◆ bin2d()

def shesha.util.utilities.bin2d (   data_in,
  binfact 
)

Returns the input 2D array "array", binned with the binning factor "binfact".

The input array X and/or Y dimensions needs not to be a multiple of "binfact"; The final/edge pixels are in effect replicated if needed. This routine prepares the parameters and calls the C routine _bin2d. The input array can be of type int, float or double. Last Dec 15, 2003.

Author
: F.Rigaut SEE _bin2d

:parmeters:

data_in (np.ndarray) : data to binned

binfact (int) : binning factor

Definition at line 82 of file utilities.py.

◆ dist()

def shesha.util.utilities.dist (   dim,
  xc = -1,
  yc = -1 
)

TODO docstring.

Definition at line 126 of file utilities.py.

Here is the caller graph for this function:

◆ fft_goodsize()

def shesha.util.utilities.fft_goodsize (   s)

find best size for a fft from size s

Parameters
s(int) size

Definition at line 61 of file utilities.py.

◆ first_non_zero()

np.ndarray shesha.util.utilities.first_non_zero ( np.ndarray  array,
int  axis,
int   invalid_val = -1 
)

Find the first non zero element of an array.

Parameters
array(np.ndarray) : input array
axis(int) : axis index
invalid_val(int, optional) : Default is -1
Returns
non_zeros_pos (np.ndarray) : Index of the first non-zero element for each line or column following the axis

Definition at line 286 of file utilities.py.

◆ generate_circle()

def shesha.util.utilities.generate_circle ( float  radius,
float   density = 1. 
)

Generate modulation points positions following a circular pattern s.

Parameters
radius(float) : half the length of a side in lambda/D
density(float), optional) : number of psf per lambda/D. Default is 1
Returns
cx (np.ndarray) : X-positions of the modulation points
cy (np.ndarray) : Y-positions of the modulation points

Definition at line 193 of file utilities.py.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ generate_pseudo_source()

def shesha.util.utilities.generate_pseudo_source ( float  radius,
  additional_psf = 0,
  density = 1. 
)

Used to generate a pseudo source for PYRWFS.

Parameters
radius(float) : TODO description
additional_psf(int) :TODO description
density(float, optional) :TODO description
Returns
ox TODO description & explicit naming
oy TODO description & explicit naming
w TODO description & explicit naming
xc TODO description & explicit naming
yc TODO description & explicit naming

Definition at line 218 of file utilities.py.

Here is the call graph for this function:

◆ generate_square()

def shesha.util.utilities.generate_square ( float  radius,
float   density = 1. 
)

Generate modulation points positions following a square pattern.

Parameters
radius(float) : half the length of a side in lambda/D
density(float), optional) : number of psf per lambda/D. Default is 1
Returns
cx (np.ndarray) : X-positions of the modulation points
cy (np.ndarray) : Y-positions of the modulation points

Definition at line 173 of file utilities.py.

Here is the caller graph for this function:

◆ makegaussian()

def shesha.util.utilities.makegaussian (   size,
  fwhm,
  xc = -1,
  yc = -1,
  norm = 0 
)

Returns a centered gaussian of specified size and fwhm.

norm returns normalized 2d gaussian

Parameters
size(int) :
fwhm(float) :
xc(float) : (optional) center position on x axis
yc(float) : (optional) center position on y axis
norm(int) : (optional) normalization

Definition at line 154 of file utilities.py.

Here is the call graph for this function:

◆ pad_array()

def shesha.util.utilities.pad_array (   A,
  N 
)

TODO docstring.

Definition at line 112 of file utilities.py.

◆ rebin()

def shesha.util.utilities.rebin (   a,
  shape 
)

TODO docstring.

Definition at line 49 of file utilities.py.