src.Libs.Simulation.UFO package

Submodules

src.Libs.Simulation.UFO.OpticsDataClass module

This file is part of the PAFFrontendSim.

The PAFFrontendSim is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License v3 as published by the Free Software Foundation.

The PAFFrontendSim 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 General Public License for more details.

You should have received a copy of the GNU General Public License along with the PAFFrontendSim. If not, see https://www.gnu.org/licenses/.

class src.Libs.Simulation.UFO.OpticsDataClass.OpticsData(inputPosition=[0.0, 0.0, 0.0], inputZ=[0.0, 0.0, 1.0], inputX=[1.0, 0.0, 0.0], log=None)[source]

Bases: object

Class to handle an optical system composed of UFODataClass objects. This system is an optional component placed between the telscopes focal point and the PAF. The development and implementation of this module is still WiP.

Initialize class.

Parameters:
  • inputPosition (array of float) – position of the nominal optics input phase center

  • inputZ (array of float) – normal vector of the input field propagation direction

  • inputX (array of float) – orientation of the x-axis (polarization for pol-angle = 0 deg)

  • log (LogClass) – Logging Class used by the calling application

addElement(ufo, distance, rotation=0.0, rotZ=False, trans=False)[source]

Add an optical element to the optics.

Parameters:
  • ufo (UFODataClass) – UFODataClass object of the element to add

  • distance (float) – distance [mm] to last element or to starting point

  • rotation (float) – rotation angle (deg) of the element around the input axis (to change optical plane)

  • rotZ (boolean) – True: rotate object around z-axis without changing in- and output (correct errorsome conic section creation if required)

  • trans (boolean) – True: use transmitted field direction

deleteLastElement()[source]

delete last optical element

getTraceList()[source]

get the list of UFO objects for tracing

modifyElement(ufo=None, index=0)[source]
move(vector)[source]

move the optics :param vector: moving vector :type vector: array of float

printOut(line, message_type, prefix=True, lineFeed=True)[source]

Wrapper for the printOut method of the actual log class

rotate(rotMatrix, center=[0.0, 0.0, 0.0])[source]

rotate optics by around the point defined by center

setInputPort(inputZ, inputX, inputPos)[source]

set input position and direction

setOutputDistance(distance)[source]
setOutputPort(outputZ, outputX, outputPos)[source]

set output position and direction

simulateOptics(Source=None, opticsLoss=0.0, opticsTemp=290.0)[source]

physical optics simulation

class src.Libs.Simulation.UFO.OpticsDataClass.OpticsElementData(ufo, inputZ=[0.0, 0.0, 1.0], inputX=[1.0, 0.0, 0.0], position=[0.0, 0.0, 0.0], rotZ=False, trans=False, erIn=1.0, log=None)[source]

Bases: object

Individual optics element parameters

printOut(line, message_type, prefix=True, lineFeed=True)[source]

Wrapper for the printOut method of the actual log class

src.Libs.Simulation.UFO.UFODataClass module

This file is part of the PAFFrontendSim.

The PAFFrontendSim is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License v3 as published by the Free Software Foundation.

The PAFFrontendSim 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 General Public License for more details.

You should have received a copy of the GNU General Public License along with the PAFFrontendSim. If not, see https://www.gnu.org/licenses/.

class src.Libs.Simulation.UFO.UFODataClass.UFOData(log=None)[source]

Bases: object

View the UFO documentation page for an overview of the UFO modules. The name UFO is unimportant. It precedes the PAF Frontend simulator by many years and was initially a standalone project. The PAF Frontend simulator uses it for its physical optics simulation features. This class handles UFO data (current and structure). The data represents all the surfaces within the simulated environment of the PAF and stores their optical and electrical properties The environment includes the reflective dishes of the telescope, the sky, spill-over regions and more.

Initialize class.

Parameters:

log (LogClass) – Logging Class used by the calling application

applyLosses(lossFactor, lossTemperature, phCenter=[], verbose=True)[source]

Applies losses to the existing fields. It calculates the loss in respect to the loss-temperature and the isometric temperature from constants.

Parameters:
  • lossFactor (float) – 0 to 1., denoting the losses in the field during the trace.

  • lossTemperature (float) – temperature [K] at which losses are dumped

  • phaseCenter (list) – vector denoting the face center of the reflected signal. must be in reflection direction, should be in distance of the waist and at least 100 times the wavelength away.

  • verbose (boolean) – quiet opertion if True

Returns:

tuple (tuple) – ufo (UFODataClass with loss-power), ufoT (UFODataClass with temperature-normalized loss-power)

correlate(ufo2)[source]

Calculates overlap integral between this ufo-class and class given in ufo2.

Parameters:

ufo2 (UFODataClass) – UFODataClass with calculated fields. The function will calculate the overlap integral. The both classes (self and this) must share a common point cloud.

Returns:

tuple (tuple) – two floats, overlap integral between e-fields and normalization factor

fitBeam(width=100.0)[source]

Fit a 2D Gaussian to the intensity distribution. A simple round gaussian with 1/e width ‘width’ is used. :param width: starting value (expectation value) of the 1/e width of the intensity distribution :type width: float

Returns:
  • amplitude (float)

  • 1/e-width (float)

  • x-postion (float)

  • y-postion (float)

fromPoints(fileName, inner=True, unit=1, center=[], refAngle=0.0, Name='', Raster=1)[source]

Loads a point cloud and calculates the normal vectors and area sizes.

Parameters:
  • fileName (string) – Filename of the point cloud data file

  • inner (boolean) – flag for the direction (inner part of the convex hull or outer)

  • unit (int) – multiplication factor to get from file units to mm (default mm, 1000 for meter to mm, …)

  • center (list) – center point at which the regridding is centered to (optional). One of the grid-points is exactely at the given center

  • refAngle (float) – nominal reflection angle of the mirror (float, optional)

  • Name (string) – identifier string of the object (optional)

  • Raster (float) – accuracy of the rastering (step size between points) – 1 gives four times the points of the input point cloud ==> half spacing

getAeff(d=[0.0, 0.0, 1.0])[source]

Calculates the effective area of the ufo surface along the projection of d (not for intensity files).

Parameters:

d (list) –

???

Returns:

Aeff (float) – effective area

getCenter()[source]

Get the nominal center of the part according to its heder information.

getCutData(pol=[1.0, 1.0, 1.0], direction=[0.0, 90.0], axScale=1.0, maxDiff=0.1, useMax=False)[source]

Extracts the far-field intensity response of the actual data set along phi direction ‘direction’.

Parameters:
  • pol (list) – np.array of floats denoting the polarization vector (will be normalized) used to calculate the intensity

  • direction (list) – of phi-angles with cut-directions or float for a single direction

  • axScale (float) – scaling factor for the x- and y- coordinates (e.g. to have it in opening angles)

  • maxDiff (float) – difference in point distance for using point in cut. (in units of the step-size)

  • useMax (boolean) – indicating if cut passes header coordinates (False) or the field-maximum point (True)

Returns:

tuple (tuple) – position (list of np.arrays with the positions), values (list of np.arrays with the cut-data in linear intensity scale)

getCutDataInter(pol=[1.0, 1.0, 1.0], direction=[0.0, 90.0], axScale=1.0, useMax=False)[source]

Extracts the far-field intensity response of the actual data set along phi direction ‘direction’.

Parameters :

pol (list): np.array of floats denoting the polarization vector (will be normalized) used to calculate the intensity direction (list): of phi-angles with cut-directions or float for a single direction axScale (float): scaling factor for the x- and y- coordinates (e.g. to have it in opening angles) useMax (boolean): indicating if cut passes header coordinates (False) or the field-maximum point (True)

Returns:

tuple (tuple) – position (list of np.arrays with the positions), values (list of np.arrays with the cut-data in linear intensity scale)

getData(onlyPos=False)[source]

Returns the internal data as numpy arrays.

Parameters:

onlyPos (boolean) – if True, only the position array is returned

Returns:

tuple (tuple) – of Numpy array(s)

Numpy array(s):
  1. position data of all mirror points

  2. area element sizes (only if onlyPos == False)

  3. complex E-field (only if onlyPos == False)

  4. complex current distribution (only if onlyPos == False)

getPolarization()[source]
getPower(radius=-1, polVector=[1.0, 1.0, 1.0], phCenter=[])[source]

Calculates the power in the field at the surface. Attention, this only works if the surface is a sphere!! A flat surface at waist position is also fine (spherical radius of infinity, flat phase distribution). Giving the phase center, and therewith a direction of propagation and a distance for calculation, power is calculated correctly also on curved surfaces (timeconsuming).

Parameters:
  • radius (float) – if > 0, use only points within the circle given by radius

  • polVector (list) – list or array with the components of a polarization vector (will be normalized) on which the fields are projected.

  • phaseCenter (list) – vector denoting the phase center of the reflected signal. Must be in reflection direction, should be in distance of the waist and at least 100 times the wavelength away.

getRot()[source]

Calculates the rotation-angles to get the header normal vector along the positive z-axis.

makeAperture(diam, polAngle=0.0, stepPerDiam=100, tiltAngle=0.0, Name='')[source]

Creates an apperture by using a flat surface which, afer calculating surface currents, is turned by 180 degree. Hence the apperture is a mirror which will be turned to radiate into the original light direction.

makeAsphLens(f, radius=10, step=1.0, er=2.25, tanD=0.0, EdgeThickness=2.0, Fresnel=None, minThick=2.0, Name='')[source]

Experimental calculation of an aspherical lens.

Parameters:
  • f (float) – focal length [mm]

  • radius (float) – size (radius) of the lens [mm]

  • step (float) – step-size for the discretization [mm]

  • er (float) – permittivity of the lens material

  • tanD (float) – Loss-factor (or tangens delta)

  • EdgeThickness (float) – Thickness at the lens edge [mm]

  • Fresnel (float or None) – Frequency [GHz] at which Fresnel lens steps should be implemented (None == no steps)

  • Name (string) – identifier string of the object (optional)

Returns:

rb_ufo (UFOData) – element with the second lens surface. Simulate first towards the main element and then using the permittivity of the lens towards this second element

makeConicSection(d1, d2, w1, w2, fLength, wavelength, refAngle=0, diameter=-1.0, step=-1.0, Name='')[source]

Creates a mirror from rotated conic sections (hyperbola, parabola or ellipsoidal) from parameters according Gaussian optics.

Parameters:
  • d1 (float) – distance to Waist 1

  • d2 (float) – distance to Waist 2

  • w1 (float) – waist-size of waist 1

  • w2 (float) – waist-size of waist 2

  • fLength (float) – focal-length of the mirror

  • wavelength (float) – wavelength being used for the calculations

  • refAngle (float) – reflection angle of the mirror

  • diameter (float) – diameter of the projected mirror (is automatically calculated to beam-diameter size from constants if not given)[mm]

  • step (float) – stepping of the mirror (is automatically calculated to 0.5 lambda if not given)

  • Name (string) – identifier string of the object (optional)

makeFarField(wavelength=100.0, cx=0.0, cy=0.0, cz=0.0)[source]

Does not work properly!!!

Tries to create a far-field data class file out of the UFO data present.

(cx, cy, cz: best center of a sphere, but all other points work as well. Wrong data can be corrected with FarFieldDataClass in post processing.)

Parameters:
  • wavelength (float) – required if phase should be retrieved in an absolute manner

  • cx (float) – Coordinate of phase center of the farfield data.

  • cy (float) – Coordinate of phase center of the farfield data.

  • cz (float) – Coordinate of phase center of the farfield data.

makeFlat(dim=[10.0, 10.0], step=[1.0, 1.0], refAngle=0.0, radius=None, Name='')[source]

Creates a flat mirror in x-y plane with normal vectors towards positive z.

Parameters:
  • dim (list) – dimensions in x-y plane (list with two entries)

  • step (list) – stepping of the mirror

  • refAngle (float) – intended reflection angle at which the mirror is used (float, optional)

  • radius (boolean) – if given, the flat mirror will have a round shape with this radius

  • Name (string) – identifier string of the object (optional)

makeLens(f, radius=10, step=1.0, er=2.25, tanD=0.0, Name='')[source]

Experimental calculation of a thick lens according to Lensmaker’s equation.

Parameters:
  • f (float) – focal length [mm]

  • radius (float) – size (radius) of the lens [mm]

  • step (float) – step-size for the discretization [mm]

  • er (float) – permittivity of the lens material

  • tanD (float) – Loss-factor (or tangens delta)

  • Name (string) – identifier string of the object (optional)

Returns:

r2_ufo (UFOData) – element with the second lens surface. Simulate first towards the main element and then using the permittivity of the lens towards this second element

makeParabola(f, dim=[10.0, 10.0], step=[1.0, 1.0], height=-1, Name='')[source]

Creates a parabolic mirror (roration symmetric) with opening in positive z-direction).

Parameters:
  • f (float) – optical focal-length (f=1/p = 1/(4*a) )

  • dim (list) – dimensions in x-y plane (list with two entries)

  • step (list) – stepping of the mirror

  • height (float) – maximum hight (< 0: no limit)

  • Name (string) – identifier string of the object (optional)

makeSphere(radius=1000.0, thetaMax=90.0, stepFunction=<function UFOData.<lambda>>, Name='')[source]

Creates a sphere with possible variable theta spacing.

Parameters:
  • radius (float) – radius of the sphere

  • thetaMax (float) – size of the sphere forward angle (0: only positive z, 90: full forward hemispher, 180: 4PI)

  • stepFunction (function) – function to go from actual theta to next theta value default, step size increasing with theta by 1 arcmin per degree

  • Name (string) – identifier string of the object (optional)

makeWaist(waist, polAngle=0.0, stepPerWaist=25, size=[], wavelength=None, new=False)[source]
move(x=0.0, y=0.0, z=0.0, absolute=False)[source]

Move the data by the vextor (x,y,z) (all in mm).

moveZero()[source]
plotCut(figname='', show=False, pol=[1.0, 1.0, 1.0], direction=[0.0, 90.0], dB=False, Field=False, axScale=1.0, axUnit='mm')[source]

Plot the far-field intensity response of the actual data set along phi direction direction.

Parameters:
  • figname (string) – Filename of the figure (if given figure is only shown on screen if show == True

  • show (boolean) – flag to show plot on screen even when being written to disk (True)

  • pol (list) – polarization vector (will be normalized) used to calculate the intensity

  • direction (list) – of phi-angles with cut-directions or float for a single direction

  • dB (boolean) – indicating if scale is in dB pr linear

  • Field (boolean) – indicating if the intensity or the field-amplitude is plotted

  • axScalet (float) – scaling factor for the x- and y- coordinates (e.g. to have it in opening angles)

  • axUnit (string) – unit string for the x- and y- axis

Returns:

tuple (tuple) – (fig, ax) figure description and axis (if returnFIG is set) or None, None

plotIntensity(figname='', show=False, pol=[1.0, 1.0, 1.0], dB=False, Field=False, returnFIG=False, axScale=1.0, axUnit='mm')[source]

Plot the far-field intensity response of the actual data set.

Parameters:
  • figname (string) – Filename of the figure (if given figure is only shown on screen if show == True

  • show (boolean) – flag to show plot on screen even when being written to disk (True)

  • pol (list) – polarization vector (will be normalized) used to calculate the intensity

  • dB (boolean) – indicating if scale is in dB pr linear

  • Field (boolean) – indicating if the intensity or the field-amplitude is plotted

  • returnFIGt (boolean) – indicating if figure handle will be returned after plotting (figname and show have no effect) or not

  • axScalet (float) – scaling factor for the x- and y- coordinates (e.g. to have it in opening angles)

  • axInit (string) – unit string for the x- and y- axis

Returns:

tuple (tuple) – (fig, ax) figure description and axis (if returnFIG is set) or None, None

plotMirror(figname='', show=False)[source]

Plot the three 2d projections of the actual mirror data.

Parameters:
  • figname (string) – Filename of the figure (if given figure is only shown on screen if show == True

  • show (boolean) – flag to show plot on screen even when being written to disk (True)

plotPhase(figname='', show=False, pol=[1.0, 1.0, 1.0], returnFIG=False)[source]

Plot the far-field phase response of the actual data set.

Parameters:
  • figname (string) – Filename of the figure (if given figure is only shown on screen if show == True

  • show (boolean) – flag to show plot on screen even when being written to disk (True)

  • pol (list) – polarization vector (will be normalized) used to calculate the intensity

  • returnFIGt (boolean) – indicating if figure handle will be returned after plotting (figname and show have no effect) or not

Returns:

tuple (tuple) – (fig, ax) figure description and axis (if returnFIG is set) or None, None

printOut(line, message_type, prefix=True, lineFeed=True)[source]

Wrapper for the printOut method of the actual log class.

readFile(filename)[source]

Read UFO file.

Parameters:

filename (string) – filename of the UFO file (structure or current)

resetPosition()[source]

Removes offset and all rotations (makes sure normal vector of the header point is pointing to (0,0,1)).

rotX(angle=0.0)[source]

Rotate UFO data around the x-axis.

Parameters:

angle (float) – rotation angle in degree

rotY(angle=0.0)[source]

Rotate UFO data around the y-axis.

Parameters:

angle (float) – rotation angle in degree

rotZ(angle=0.0)[source]

Rotate UFO data around the y-axis.

Parameters:

angle (float) – rotation angle in degree

setI0(I0=-1, setOnly=True)[source]

Sets the internal excitation current to either the given value (if > 0) or calculates it from the overall power. :param I0: new exitation current [A]; if negative curent is calculated from actual available power in the field :type I0: float :param setOnly: if True, only current will be set, if False, field strength is adapted to new current :type setOnly: bool

setLog(newlog=None)[source]

Set new log class

simulate(target, wavelength, er=1.0, tanD=0.0, erOut=-1.0, trans=False)[source]

EM-simulation from the UFO data class (must be _CURRENT) to the target object (must be type _SURFACE). The code will call the c-library with the code of the calculation to calculate the surface currents on the target object, resulting from the surface current induced E-Field at the location of the target.

Parameters:
  • target (UFODataClass) – of type _SURFACE on which the current is calculated

  • wavelength (float) – wavelength used for the simulation

  • er (float) – permitivity of the medium in between the surfaces (is set automatically if data are available) – no override

  • tanD (float) – tangens delta (loss-factor) of the material in between surfaces (is set automatically if data are available) – no override

  • erOut (float) – permitivity of the medium after the target object; if negative, object is taken as a metal object (is set automatically if data are available) – no override

Returns:

new (UFODataClass) – with the simulation results

surfaceError(rms=1.0)[source]

Implements a surface error with the rms given to the actual ufo surface. Assumes a undisturbed perfectsurface data set (running the procedure twice results in sqrt(2) times rms.

Parameters:

rms (float) – rms-value [mm] of the surface after the procedure

transform(Matrix)[source]

Transform coordinates and fields with the Matrix given.

Parameters:

Matrix (numpy.array) – 3x3 transformation matrix. new vectors are determined by vector multiplication

writeFile(filename)[source]

Write UFO file.

Parameters:

filename (string) – filename of the UFO file (structure or current, depending on the internal Type)

src.Libs.Simulation.UFO.UFOGaussCalc module

This file is part of the PAFFrontendSim.

The PAFFrontendSim is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License v3 as published by the Free Software Foundation.

The PAFFrontendSim 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 General Public License for more details.

You should have received a copy of the GNU General Public License along with the PAFFrontendSim. If not, see https://www.gnu.org/licenses/.

src.Libs.Simulation.UFO.UFOGaussCalc.calcConicData(w1, w2, d1, d2, wavelength, reflectionAngle, verbose=True, log=<LogClass.LogClass object>)[source]

Calculate data of a ellipsoide or hyperbola for the Gaussian beam parameters given. A distance d1 or d2 of zero is interpreted as 10^-6 mm distance to avoid numerical problems ==> Parabolas get very large ellipses.

Parameters:
  • w1 (float) – waist-size 1 [mm]

  • w2 (float) – waist-size 2 [mm]

  • d1 (float) – distance of waist w1 from the conical surface [mm]

  • d2 (float) – distance of waist w2 from the conical surface [mm]

  • wavelength (float) – wavelength used for the calculation [mm]

  • reflectionAngle (float) – reflection angle in degree

  • verbose (bool) – does nothing

Returns:
  • 2d conic section data in x-y plane. Origin of the coordinate system is the center of the conical form. The function returns all data including redundent information

  • a (float) – semi-major axis [mm]

  • b (float) – semi-minor axis (negative for hyperbola) [mm]

  • e (float) – excentricity

  • c (float) – linear eccentrisity [mm]

  • p (float) – size factor [mm]

  • ref.point-x (float) – reflection point x-coordinate at the conical section

  • ref.point-y (float) – reflection point y-coordinate at the conical section

  • tangentangle (float) – tangent angle at the reflection point (angle between major axis and tangent [degree]

  • focal-length (float) – focal length of the conic section at the reflection point [mm]

  • ref.angle (float) – reflection angle [degree]

  • r1 (float) – distance of waitst w1 to its phase center [mm]

  • r2 (float) – distance of waitst w2 to its phase center [mm]

src.Libs.Simulation.UFO.UFOGaussCalc.calcDist2PhaseCenter(w, d, wavelength)[source]

calculates the distance to the phase-center from a given waist w and an distance d from the waist. :param w: waist [mm] :type w: float :param d: distance from the waist w [mm] :type d: float :param wavelength: wavelength for the calculation [mm] :type wavelength: float

Returns:
  • float, distance r to the nominal phase-center [mm]. The interpretation is as follows – r denotes the radius of the phase-front in a distance d from the waist w.

  • or None for an input distance d == 0

src.Libs.Simulation.UFO.UFOGaussCalc.complete(wavelength, w1=None, w2=None, d1=None, d2=None, f=None, getBigW=False)[source]

src.Libs.Simulation.UFO.UFOTrace module

This file is part of the PAFFrontendSim.

The PAFFrontendSim is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License v3 as published by the Free Software Foundation.

The PAFFrontendSim 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 General Public License for more details.

You should have received a copy of the GNU General Public License along with the PAFFrontendSim. If not, see https://www.gnu.org/licenses/.

class src.Libs.Simulation.UFO.UFOTrace.GeometricTraceData(objects, log=None)[source]

Bases: object

Class for geometric raytracing

Initialize class.

Parameters:
  • objects (list) – of UFODataClasses describing the optical elements in the order as they shall be traced. The first element is taken as transmitting surface

  • log (LogClass) – Logging Class used by the calling application

Trace(startWaist, wavelength, rings=30.0, rays=70)[source]

Trace a sequence of mirrors (UFODataClasses) with the UFO trace program - geometric ray-tracer - and return the ray-paths as np.array.

Parameters:
  • startWaist (float) – waist size of the starting waist

  • wavelength (float) – wavelength of the optics setup (used to determine the opening angle of the initial beam)

Returns:

list (list) – TODO something is wrong here

getPattern(zero=False)[source]

Returns pattern of the ray-end points at the last surface.

Parameters:

zero (boolean) – True = zero intensizy rays are included, False = they are excluded (except center ray as first element).

getPower()[source]

Returns the fraction of the starting-power in the final trace pattern.

getTraceLine(cut=None)[source]

Extract one continuose line which shows all rays traced.

Parameters:

cut (list) – of 3-element lists. The first element in the sub-list denotes the axis (0 to 2) and the second element the boundary data, and the third the limit type (> 0 upper, < 0 lower, and == 0 no limit)

Returns:

numpy.array (numpy.array) – of points which can be plotted as one line, showing all rays traced.

plotGeometricTrace(figname='', show=False, cut=None)[source]

Plot the geometrical layout including the mirror surfaces as three 2D projections.

Parameters:
  • figname (string) – Filename of the figure (if given figure is only shown on screen if show == True

  • show (boolean) – flag to show plot on screen even when being written to disk (True)

  • cut (list) – of 3-element lists. The first element in the sub-list denotes the axis (0 to 2) and the second element the boundary data, and the third the limit type (> 0 upper, < 0 lower, and == 0 no limit)

plotGeometricTrace3D(figname='', show=False, cut=None)[source]

Plot the geometrical layout including the mirror surfaces as three 2D projections.

Parameters:
  • figname (string) – Filename of the figure (if given figure is only shown on screen if show == True

  • show (boolean) – flag to show plot on screen even when being written to disk (True)

  • cut (list) – of 3-element lists. The first element in the sub-list denotes the axis (0 to 2) and the second element the boundary data, and the third the limit type (> 0 upper, < 0 lower, and == 0 no limit)

plotIntensity(figname='', show=False)[source]

Plot the intensity-pattern of the rays on the end-surface.

Parameters:
  • figname (string) – Filename of the figure (if given figure is only shown on screen if show == True

  • show (boolean) – boolean flag to show plot on screen even when being written to disk (True)

plotPattern(figname='', show=False)[source]

Plot the pattern of the rays on the end-surface.

Parameters:
  • figname (string) – Filename of the figure (if given figure is only shown on screen if show == True

  • show (boolean) – boolean flag to show plot on screen even when being written to disk (True)

printOut(line, message_type, prefix=True, lineFeed=True)[source]

Wrapper for the printOut method of the actual log class.

class src.Libs.Simulation.UFO.UFOTrace.UFORay(position=array([0., 0., 0.]), direction=array([0., 0., 1.]), power=0.0, log=None)[source]

Bases: object

Class describing one geometric beam-ray and offer a method to trace it through an optics

Initialize class.

Parameters:
  • position (numpy.array) – 1d-array of len 3, indicating the coordinates of the ray starting point

  • direction (numpy.array) – 1d-array of len 3, indicating the normal vector of beam propagation at starting point

  • power (float) – power of the ray at point of emmission

  • log (LogClass) – Logging Class used by the calling application

getEndpoint(zero=True)[source]

Returns a list with the ray endpoint as numpy array. The list is empty if the ray ended during tracing.

Parameters:

zero (boolean) – True = zero intensity rays are included, False = they are excluded.

getRay(cut=None)[source]

Extracts an array of the ray reflection points, which connected by lines give the ray-beam-path. Limits can be applied.

Parameters:

cut (list) – of 3-element lists. The first element in the sub-list denotes the axis (0 to 2) and the second element the boundary data, and the third the limit type (> 0 upper, < 0 lower, and == 0 no limit)

Returns:

tuple (tuple) – trace, self.endSurface (numpy array of all 3d ray-reflection points on the track)

printOut(line, message_type, prefix=True, lineFeed=True)[source]

Wrapper for the printOut method of the actual log class

traceRay(ufoList, posList=None)[source]

Traces the ray to the surface given by ufo.

Parameters:
  • ufoList (list) – of UFODataClasses with the surface of the element to approach

  • posList (list) – of numpy-arrays with all positions of the point cloude of ufo (to speed up tracing, if None, data will be extracted from ufo – slow)

src.Libs.Simulation.UFO.UFO_CCode module

This file is part of the PAFFrontendSim.

The PAFFrontendSim is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License v3 as published by the Free Software Foundation.

The PAFFrontendSim 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 General Public License for more details.

You should have received a copy of the GNU General Public License along with the PAFFrontendSim. If not, see https://www.gnu.org/licenses/.

class src.Libs.Simulation.UFO.UFO_CCode.UFODataPoint[source]

Bases: Structure

Ei

Structure/Union member

Er

Structure/Union member

I

Structure/Union member

Ji

Structure/Union member

Jr

Structure/Union member

Jti

Structure/Union member

Jtr

Structure/Union member

df

Structure/Union member

n

Structure/Union member

v

Structure/Union member

class src.Libs.Simulation.UFO.UFO_CCode.UFOHeaderPoint[source]

Bases: Structure

n

Structure/Union member

o

Structure/Union member

v

Structure/Union member

src.Libs.Simulation.UFO.constants module

This file is part of the PAFFrontendSim.

The PAFFrontendSim is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License v3 as published by the Free Software Foundation.

The PAFFrontendSim 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 General Public License for more details.

You should have received a copy of the GNU General Public License along with the PAFFrontendSim. If not, see https://www.gnu.org/licenses/.

Module contents

This file is part of the PAFFrontendSim.

The PAFFrontendSim is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License v3 as published by the Free Software Foundation.

The PAFFrontendSim 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 General Public License for more details.

You should have received a copy of the GNU General Public License along with the PAFFrontendSim. If not, see https://www.gnu.org/licenses/.

src.Libs.Simulation.UFO.PhysicalTrace(objects, wavelength, lossFactor=0.0, lossTemperature=290.0, waist=None, phCenter=[])[source]

Physical simulation of a sequence of mirrors and return the last object with the current distribution and e-field.

Parameters:
  • objects (list) – of UFOData-class instances in the order as they shall be traced. The first element must have a pre-defined current distribution

  • wavelength (float) – wavelength of the optics setup (used to determine the opening angle of the initial beam)

  • lossFactor (float) – 0 to 1., denoting the losses in the field during the trace.

  • lossTemperature (float) – temperature [K] at which losses are dumped

  • waist (float or None) – If given, a waist of this size is calculated on the first object of the objects-list

Returns:

tuple (tuple) – curr, loss, lossT (UFO-Object with the result data (current type))

src.Libs.Simulation.UFO.getAngles(zOrientation=[0.0, 0.0, 1.0], xOrientation=[1.0, 0.0, 0.0])[source]

Calculate rotation angles to get from a coordinate system with zAxis and xAxis given to the underlying coordinate system with xAxis = [0, 0, 1], yAis = [0, 1, 0], and zAxis = [0, 0, 1]

Parameters:
  • zOrientation (array of float) – z-Axis directional vector

  • xOrientation (array of float) – x-Axis directional vector

Returns :

tuple (3 x 3 array of float) : rotation matrix into standart coordinate system tuple (3 x 3 array of float) : rotation matrix from standart coordinate system to given coordinate system (inverse of the first return array) tuple (3 element array of float) : rotation angles into standart coordinate system in degree [ rotation around x-axis, around y-axis, around z-axis ];

first rotating around x-, than around y- and last around z-axis corresponds to the first returned rotation matrix

src.Libs.Simulation.UFO.getRotMatrixForAxis(axis=[1.0, 0.0, 0.0], angle=0.0)[source]

Calculate rotation matrix for a rotation around an axis given by its directional vector and the rotation angle.

Parameters:
  • axis (array of float) – rotation-axis directional vector

  • angle (float) – rotation angle [deg]

Returns:

tuple (3 x 3 array of float) – rotation matrix

src.Libs.Simulation.UFO.plotOpticalCircuit(objects, startWaist, wavelength, startDistance=[], size=4.0, figname='', show=False, maxX=None)[source]

Plot of the optical circuit of the objects in line.

Parameters:
  • objects (list) – of UFOData-class instances in the order as they shall be traced. the first element is the transmitting surface

  • startWaist (float) – or list of floats, waist size(s) of the starting waist(s)

  • wavelength (float) – or list of floats, wavelength of the optics setup tracing

  • startDistance (float) – or list of floats giving the difference of the start-waist distance from object[0] (optional)

  • size (float) – denoting the multiplicator of the contour. e.g. a size of 5 results in the 5 x wz contour in diameter!

  • figname (string) – Filename of the figure (if given figure is only shown on screen if show == True

  • show (boolean) – flag to show plot on screen even when being written to disk (True)

  • maxX (boolean) – maximum limit in x-direction (to cut of a plot)

src.Libs.Simulation.UFO.setLog(newLog)[source]