Documentation¶
- class pySCATMECH.mueller.CharacterizedMueller(M)¶
Characterize the Mueller matrix according to
N. Ghosh, M.F.G. Wood, and I.A. Vitkin, ‘Mueller matrix decomposition for extraction of individual polarization parameters from complex turbid media exhibiting multiple scattering, optical activity, and linear birefringence,’’ J. Biomedical Opt. 13, 044036 (2008).
A few other parameters are also calculated.
- Parameters:
M (MuellerMatrix) – The Mueller matrix to be characterized
- Mdepol¶
Depolarizer in Lu-Chipman decomposition
- Type:
- Mret¶
Retarder in Lu-Chipman decomposition
- Type:
- Mdiatten¶
Diattenuator in Lu-Chipman decomposition
- Type:
- DiattenuationVector¶
The 3-element diattenuation vector
- Type:
numpy.array
- Diattenuation¶
Diattenuation
- Type:
float
- CircularDiattenuation¶
Circular diattenuation
- Type:
float
- LinearDiattenuation¶
Linear diattenuation
- Type:
float
- DiattenuationAngle¶
Angle of diattenuation in radians
- Type:
float
- Polarizance¶
The 3-element polarizance vector
- Type:
numpy.array
- DepolarizationCoefficient¶
Depolarization coefficient (1 = nondepolarizing, 0 = depolarizing)
- Type:
float
- LinearRetardance¶
Linear retardance in radians
- Type:
float
- OpticalRotation¶
Optical rotation in radians
- Type:
float
- Retardance¶
Total retardance in radians
- Type:
float
- RetardanceAngle¶
Angle of retardance in radians
- Type:
float
- pySCATMECH.mueller.Cloude_Decomposition(M)¶
Return a list of four non-depolarizing Mueller matrices that sum to the Mueller matrix.
- Parameters:
M (MuellerMatrix) – Mueller matrix to be decomposed
- Returns:
M1, M2, M3, M4 – The decomposed Jones-Mueller matrices sorted so that M1[0,0] >= M2[0,0] >= M3[0,0] >= M4[0,0]
- Return type:
- pySCATMECH.mueller.HermitianToMueller(h)¶
Convert a Hermitian coherency matrix to its equivalent Mueller matrix.
- Parameters:
h (ndarray((4,4),complex)) – A Hermitian coherency matrix
- Returns:
m – The Mueller matrix form of the coherency matrix.
- Return type:
- pySCATMECH.mueller.JonesBasis(angle=0, DOCP=None, jones=None)¶
Return the basis vectors for a Jones Matrix using a Jones vector or a degree of circular polarization and an angle. The returned vectors are orthogonal to one another and of unit intensity. This function is primarily used by JonesRetarder and JonesDiattenuator
- Parameters:
angle (float) – Angle (in radians) of axis (default is 0)
DOCP (float) – Degree of circular polarization of the axis. Cannot define both DOCP and jones.
jones (2-element list of complex) – Jones vector associated with axis Cannot define both DOCP and jones. (Default is [1,0])
- Returns:
jones1, jones2 – Two Jones vectors that are mutually orthogonal and of unit intensity
- Return type:
2-element lists of complex
- pySCATMECH.mueller.JonesDiattenuator(diatten=None, angle=0, DOCP=None, jones=None)¶
Return the Jones matrix for a homogeneous diattenuator with a given phase and axes.
- Parameters:
angle (float) – Angle (in radians) of axis (default is 0)
DOCP (float) – Degree of circular polarization of the axis. Cannot define both DOCP and jones.
jones (2-element list of complex) – Jones vector associated with axis Cannot define both DOCP and jones. (Default is [1,0])
- Returns:
jones – Jones matrix diattenuator
- Return type:
2x2 numpy array of complex
- pySCATMECH.mueller.JonesMueller(jones)¶
Convert a Jones matrix to a Mueller matrix
- Parameters:
jones (2x2 list or array of int, float, or complex) – A Jones matrix
- Returns:
mueller – The Mueller matrix associated with jones.
- Return type:
- pySCATMECH.mueller.JonesPolarizer(diatten=None, angle=0, DOCP=None, jones=None)¶
Return the Jones matrix for a homogeneous diattenuator with a given phase and axes.
- Parameters:
angle (float) – Angle (in radians) of axis (default is 0)
DOCP (float) – Degree of circular polarization of the axis. Cannot define both DOCP and jones.
jones (2-element list of complex) – Jones vector associated with axis Cannot define both DOCP and jones. (Default is [1,0])
- Returns:
jones – Jones matrix diattenuator
- Return type:
2x2 numpy array of complex
- pySCATMECH.mueller.JonesRetarder(phase=None, angle=0, DOCP=None, jones=None)¶
Return the Jones matrix for a homogeneous retarder with a given phase and axes.
- Parameters:
angle (float) – Angle (in radians) of axis (default is 0)
DOCP (float) – Degree of circular polarization of the axis. Cannot define both DOCP and jones.
jones (2-element list of complex) – Jones vector associated with axis Cannot define both DOCP and jones. (Default is [1,0])
- Returns:
jones – Jones matrix retarder
- Return type:
2x2 numpy array of complex
- pySCATMECH.mueller.JonesRotator(angle)¶
Return a Jones matrix that rotates the polarization by angle”
- Parameters:
angle (float) – Angle that matrix will rotate in radians
- Returns:
R – The rotation matrix
- Return type:
2x2 np.array
- pySCATMECH.mueller.JonesStokes(jones)¶
Convert a Jones vector to a Stokes vector
- Parameters:
jones (2 element list or array of int, float, or complex) –
- pySCATMECH.mueller.JonesUnit()¶
Return a unit Jones matrix
- pySCATMECH.mueller.JonesZero()¶
Return a zero Jones matrix
- pySCATMECH.mueller.MuellerDiagonal(a)¶
Return a diagonal Mueller matrix
- Parameters:
a (4 element list or array of float) –
- pySCATMECH.mueller.MuellerDiattenuator(diatten=0, angle=0, DOCP=None, jones=None)¶
Return the Mueller matrix for a homogeneous diattenuator with a given phase and axis.
- Parameters:
angle (float) – Angle (in radians) of axis (default is 0)
DOCP (float) – Degree of circular polarization of the axis. Cannot define both DOCP and jones.
jones (2-element list of complex) – Jones vector associated with axis Cannot define both DOCP and jones. (Default is [1,0])
- Return type:
MuellerMatrix diattenuator
- pySCATMECH.mueller.MuellerExp(L)¶
Return matrix exponential.
- Returns:
L – The matrix exponent of M
- Return type:
4x4 np.array
- pySCATMECH.mueller.MuellerLog(M)¶
Return matrix logarithm (logarithmic decomposition).
- Returns:
The matrix logarithm of M
- Return type:
4x4 numpy.array
- class pySCATMECH.mueller.MuellerMatrix(*x)¶
A class for handling Mueller matrices
- Parameters:
x (4x4 list or array of float or int, optional) – Default is a zero Mueller matrix
- Closest_NonDepolarizing()¶
Return the largest matrix in the Cloude decomposition, which may be interpreted as the closest non-depolarizing Mueller matrix.
- Returns:
M – The largest matrix in the Cloude decomposition.
- Return type:
- Cloude_Decomposition()¶
Return a list of four non-depolarizing Mueller matrices that sum to the Mueller matrix.
- Parameters:
M (MuellerMatrix) – Mueller matrix to be decomposed
- Returns:
M1, M2, M3, M4 – The decomposed Jones-Mueller matrices sorted so that M1[0,0] >= M2[0,0] >= M3[0,0] >= M4[0,0]
- Return type:
- MuellerExp()¶
Return matrix exponential.
- Returns:
L – The matrix exponent of M
- Return type:
4x4 np.array
- MuellerLog()¶
Return matrix logarithm (logarithmic decomposition).
- Returns:
The matrix logarithm of M
- Return type:
4x4 numpy.array
- Reverse_Lu_Chipman_Decomposition()¶
Return a diattenuator, retarder, and depolarizer whose ordered product is the Mueller matrix.
See: S.-Y. Lu and R.A. Chipman, “Interpretation of Mueller matrices based on polar decomposition,” J. Opt. Soc. Am. A 13, 1106-1113 (1996) and J. Morio and G. Goudail, “Influence of the order of diattenuator, retarder, and polarizer in polar decomposition of Mueller matrices,” Opt. Lett. 29, 2234-2236 (2004).
- Parameters:
M (MuellerMatrix) – The matrix to be decomposed
- Returns:
diattenuator (MuellerMatrix)
retarder (MuellerMatrix)
depolarizer (MuellerMatrix) – M = diattenuator @ retarder @ depolarizer
- Symmetric_Decomposition()¶
Perform the symmetric decomposition described by Ossikovski.
See: R. Ossikovski, J. Opt. Soc. Am. A 26, 1109-1118 (2009).
- Parameters:
M (MuellerMatrix) –
- Returns:
diatten2 (MuellerMatrix)
ret2 (MuellerMatrix)
depol (MuellerMatrix)
ret1 (MuellerMatrix)
diatten1 (MuellerMatrix) – M = diatten2 @ ret2 @ depol @ ret1 @ diatten1
- Tmax()¶
Return the maximum transmittance.
- Returns:
Tmax – The maximum transmittance of the MuellerMatrix
- Return type:
float
- Tmin()¶
Return the minimum transmittance.
- Returns:
Tmax – The minimum transmittance of the MuellerMatrix
- Return type:
float
- depolarization_index()¶
Return the depolarization index.
- Returns:
PI – The depolarization index
- Return type:
float
- diattenuation()¶
Return the diattenuation.
- Returns:
diattenuation – The diattenuation
- Return type:
float
- entropy()¶
The polarization entropy.
- Returns:
entropy – Returns the polarization entropy defined in S.R. Cloude and E. Pottier, “Concept of polarization entropy in optical scattering,” Opt. Eng. 34(6) 1599-1610 (1995).
- Return type:
float
- extinction_ratio()¶
Return the extinction ratio.
- Returns:
ER – The extinction ratio
- Return type:
float
- inverse()¶
Mueller matrix inverse.
- Returns:
M – The inverted Mueller matrix
- Return type:
- linear_diattenuation()¶
Return the linear diattenuation.
- Returns:
diattenuation – The linear diattenuation
- Return type:
float
- normalized()¶
The normalized Mueller matrix.
- Returns:
M – The Mueller matrix normalized so that its [0,0] element is 1.
- Return type:
- parity()¶
Mueller matrix with a parity conversion.
- Returns:
M – Mueller matrix for a parity conversion
- Return type:
- physically_valid()¶
Test if a matrix is physically valid.
The function physically_valid() calculates the Mueller matrix coherency matrix, which is the coherency matrix for the four Jones-Mueller matrices generated by the Pauli matrices. This coherency matrix must be a valid coherency matrix (positive semi-definite) if the matrix is the convex sum of Jones-Mueller matrices. This test is a more stringent test than valid() for the validity of the Mueller matrix.
See B.N. Simon, et al, “A complete characterization of pre-Mueller and Mueller matrices in polarization optics,” J. Opt. Soc. Am. A 27(2), 188-199 (2010).
- Returns:
bool
True if the matrix is physically valid, that is, if it is a convex
sum of Jones-Mueller matrices.
- polarizance()¶
Return the polarizance.
- Returns:
polarizance – The polarizance
- Return type:
float
- polarization_dependent_loss()¶
Return the polarization dependent loss.
- Returns:
pdl – The polarization dependent loss
- Return type:
float
- rotate(angle)¶
Return a Mueller matrix rotated by an angle.
The angle is measured clockwise looking into the beam.
- Parameters:
angle (float) – The angle in radians
- Returns:
M – Mueller matrix rotated by angle
- Return type:
- transpose()¶
Mueller matrix transpose.
- Returns:
M – The transposed Mueller matrix
- Return type:
- valid()¶
Test if a matrix is a Stokes-Stokes mapping matrix.
Uses the condition described in C.R. Givens and A.B. Kostinski, ‘A simple necessary and sufficient condition on physically realizable Mueller matrices,’ Journal of Modern Optics 40, 471-481 (1993).
- Returns:
bool
True if the matrix will always map a valid Stokes vector to a
valid Stokes vector; otherwise, False.
- pySCATMECH.mueller.MuellerPolarizer(diatten=0, angle=0, DOCP=None, jones=None)¶
Return the Mueller matrix for a homogeneous diattenuator with a given phase and axis.
- Parameters:
angle (float) – Angle (in radians) of axis (default is 0)
DOCP (float) – Degree of circular polarization of the axis. Cannot define both DOCP and jones.
jones (2-element list of complex) – Jones vector associated with axis Cannot define both DOCP and jones. (Default is [1,0])
- Return type:
MuellerMatrix diattenuator
- pySCATMECH.mueller.MuellerRetarder(phase=0, angle=0, DOCP=None, jones=None)¶
Return the Mueller matrix for a homogeneous retarder with a given phase and axis.
- Parameters:
angle (float) – Angle (in radians) of axis (default is 0)
DOCP (float) – Degree of circular polarization of the axis. Cannot define both DOCP and jones.
jones (2-element list of complex) – Jones vector associated with axis Cannot define both DOCP and jones. (Default is [1,0])
- Returns:
jones – Jones matrix retarder
- Return type:
2x2 numpy array of complex
- pySCATMECH.mueller.MuellerRotator(angle)¶
Return a Mueller matrix that rotates the polarization by angle”
- Parameters:
angle (float) – Angle that matrix will rotate in radians
- Returns:
R – The rotation matrix
- Return type:
- pySCATMECH.mueller.MuellerToHermitian(m)¶
Convert a Mueller matrix into its equivalent Hermitian coherency matrix.
- Parameters:
m (MuellerMatrix) – The Mueller matrix to be converted.
- Returns:
h – Hermitian coherence matrix
- Return type:
4x4 complext np.array
- pySCATMECH.mueller.MuellerUnit(attenuation=1)¶
Return a unit Mueller matrix
- Parameters:
attenuation (float, optional) – Default is 1
- pySCATMECH.mueller.MuellerZero()¶
Return a zero Mueller matrix
- Returns:
m – Zero matrix
- Return type:
- pySCATMECH.mueller.Polarization(*args, **kwargs)¶
Return a StokesVector with a given name
- Parameters:
args (str or float) –
- Can be any of:
P or p for p-polarization S or s for s-polarization L or l for LCP-polarization R or r for RCP-polarization U or u for unpolarized any float for linear polarization at angle name in radians
state (str) – Any of the aboves strings that can be used in args
I (float, optional) – The intensity. (Default is 1)
DOP (float, optional) – The degree of polarization. (Default is 1)
angle (float, optional) – The principal angle of the polarization. (Default is set by args or state.)
ellipticity (float) – The ellipticity of the polarization
- Returns:
s – The Stokes vector with the given parameters
- Return type:
- pySCATMECH.mueller.Reverse_Lu_Chipman_Decomposition(M)¶
Return a diattenuator, retarder, and depolarizer whose ordered product is the Mueller matrix.
See: S.-Y. Lu and R.A. Chipman, “Interpretation of Mueller matrices based on polar decomposition,” J. Opt. Soc. Am. A 13, 1106-1113 (1996) and J. Morio and G. Goudail, “Influence of the order of diattenuator, retarder, and polarizer in polar decomposition of Mueller matrices,” Opt. Lett. 29, 2234-2236 (2004).
- Parameters:
M (MuellerMatrix) – The matrix to be decomposed
- Returns:
diattenuator (MuellerMatrix)
retarder (MuellerMatrix)
depolarizer (MuellerMatrix) – M = diattenuator @ retarder @ depolarizer
- pySCATMECH.mueller.Sensitivity(*args, **kwargs)¶
Return a StokesVector with a given name that corresponds to a sensitivity.
- Parameters:
name (str or float) –
- Can be any of:
P or p for p-polarization S or s for s-polarization L or l for LCP-polarization R or r for RCP-polarization U or u for unpolarized any float for linear polarization at angle name
- class pySCATMECH.mueller.StokesVector(*x)¶
A class for handling Stokes vectors
- Parameters:
x (4-element list or array of float or int, optional) – Default is zero Stokes vector
- DOCP()¶
Return the degree of circular polarization.
- Returns:
DOCP – The degree of circular polarization
- Return type:
float
- DOLP()¶
Return the degree of linear polarization.
- Returns:
DOLP – The degree of linear polarization
- Return type:
float
- DOP()¶
Return the degree of polarization.
- Returns:
DOP – The degree of polarization
- Return type:
float
- JonesVector()¶
Return a Jones vector associated with the polarized part of the Stokes vector.
- Returns:
j – A Jones vector that, if converted to a Stokes vector, yields the polarized part of the Stokes vector.
- Return type:
2 element np.array
- delta()¶
Return the phase difference between the two components.
- Returns:
delta – The phase difference between the two components (s and p) in radians. Uses the polarized part of the Stokes vector.
- Return type:
float
- eccentricity()¶
Return the eccentricity.
- Returns:
eccentricity – The eccentricity
- Return type:
float
- ellipticity()¶
Return the ellipticity of the field (ratio of minor to major axes).
- Returns:
e – The ellipticity of the field (ratio of the minor to major axes of the polarization ellipse.
- Return type:
float
- eta()¶
Return the principal angle of the polarization ellipse
- Returns:
eta – The principal angle of the polarization ellipse
- Return type:
float
- intensity()¶
Return the intensity.
- Returns:
I – The intensity
- Return type:
float
- normalized()¶
Return normalized Stokes vector.
- Returns:
s – The Stokes vector normalized so that its 0 element is 1.
- Return type:
- pol_part()¶
Return the polarized part of the Stokes vector.
- Returns:
s – The polarized part of the Stokes vector.
- Return type:
- psi()¶
Return arc tangent of the amplitude ratio between the two components.
- Returns:
psi – The arc tangent in radians of the ratio between the two components of the polarized part of the light. The returned value is zero for p-polarized light.
- Return type:
float
- rotate(angle)¶
Return a Stokes vector rotated by an angle.
- Parameters:
angle (float) – Angle to rotate the Stokes vector in radians
- Returns:
rot – Stokes vector rotated by angle
- Return type:
- unpol_part()¶
Return the unpolarized part of the Stokes vector.
- Returns:
s – The unpolarized part of the Stokes vector.
- Return type:
- valid()¶
Checks if the Stokes vector is valid.
- Returns:
valid – True if the Stokes vector is valid.
- Return type:
bool
- pySCATMECH.mueller.StokesZero()¶
Return zero Stokes vector
- pySCATMECH.mueller.Symmetric_Decomposition(M)¶
Perform the symmetric decomposition described by Ossikovski.
See: R. Ossikovski, J. Opt. Soc. Am. A 26, 1109-1118 (2009).
- Parameters:
M (MuellerMatrix) –
- Returns:
diatten2 (MuellerMatrix)
ret2 (MuellerMatrix)
depol (MuellerMatrix)
ret1 (MuellerMatrix)
diatten1 (MuellerMatrix) – M = diatten2 @ ret2 @ depol @ ret1 @ diatten1
- pySCATMECH.mueller.Test_Lu_Chipman_Decomposition(M)¶
Return a depolarizer, a retarder, and a diattenuator whose ordered product is the Mueller matrix.
See: S.-Y. Lu and R.A. Chipman, “Interpretation of Mueller matrices based on polar decomposition,” J. Opt. Soc. Am. A 13, 1106-1113 (1996).
- Parameters:
M (MuellerMatrix) – The matrix to be decomposed
- Returns:
depolarizer (MuellerMatrix)
retarder (MuellerMatrix)
diattenuator (MuellerMatrix) – M = depolarizer @ retarder @ diattenuator
- pySCATMECH.mueller.perpto(a, b)¶
Return a unit vector perpendicular to two vectors.
- Parameters:
a (np.array) – Two 3-vectors
b (np.array) – Two 3-vectors
- Returns:
c – A unit vector perpendicular to both a and b.
- Return type:
np.array
- pySCATMECH.mueller.unit(a)¶
Return the unit matrix associated with a vector.
- Parameters:
a (np.array) – Unnormalized vector
- Returns:
unit – Vector such that a.dot(a) == 1.
- Return type:
np.array
- pySCATMECH.model.DialogGetModel(top)¶
Opens a dialog box with a selection of Models inheriting top and returns the choice.
- Parameters:
top (str) – The top level class from which to choose a child class
- Returns:
str (The name of the selected child class)
Requires
——–
tkinter
- pySCATMECH.model.DialogGetModelParameters(model)¶
Opens a dialog box with a selection of Models inheriting top and returns the choice.
- Parameters:
model (Model) – The model to fill parameters out with.
- Returns:
Model
The model with new parameters
Requires
——–
tkinter
- class pySCATMECH.model.Model(*args, **kwargs)¶
Base class for Models.
- askParameters()¶
Queries the user for parameter values. TODO FIX!
- getModelName()¶
Returns the model’s name
- getParameter(parameter)¶
Gets a string corresponding to the value of a model parameter. Arguments: parameter: parameter name as a string Returns: parameter value
- getParameterDictionary()¶
Returns a dictionary of dictionaries for each parameter that includes values, descriptions, and types.
- getParameters()¶
Gets all of the parameters for the model.
- Return type:
dict with str keys
- printParameters()¶
Returns a printable string that includes all the parameters, their values, and their descriptions. Recommend surround with print()
- setParameter(parameter, value)¶
Sets a single parameter for the model.
- Parameters:
parameter (str) – Parameter name as a string. Subparameters must use parameter.subparameter notation.
value (float, str, or complex) – Parameter value
- setParameters(*args, **kwargs)¶
Sets one or more parameters for the model.
- Parameters:
parameter_values (dict) – Argument is a dictionary with with str keys being the parameters and values being the values. None key defines model name.
**kwargs – parameters can be set by parameter name, lambda should be replace with wavelength, since lambda is a Python keyword.
- Return type:
- pySCATMECH.model.chooseModel(model)¶
Presents user with a choice of models and returns the user’s choice, by name.
- pySCATMECH.model.chooseModelAndParameters(model)¶
Presents user with a choice of models and asks for parameters.
- pySCATMECH.model.createDictOfDict(theDict)¶
Creates a dictionary of dictionaries for a simple dictionary with dot-delimited keys. The result[gparent][parent][child] theDict[“gparent.parent.child”]–>result[“gparent”][“parent”][“child”] theDict[“gparent.parent”]–> result[gparent][parent][None]
- pySCATMECH.model.getModelDictionary(model='Model')¶
Returns a dictionary containing all the models inheriting model and their descriptions.
- pySCATMECH.model.strDictOfDict(thedict, indent='', result=None)¶
Prints a dictionary of dictionaries in a readable format
- class pySCATMECH.brdf.BRDF_Model(*args, **kwargs)¶
A class for handling BRDF Models.
Arguments *args and **kwargs can contain parameters passed to the model.
One form is to pass a dict of {“parameter” : value, … }.
The keyword argument ‘wavelength’ is automatically changed to ‘lambda’, since lambda is a Python keyword. However, as a str, it should be ‘lambda’.
- Parameters:
name (str) – The name of a SCATMECH model inheriting BRDF_Model
- BRDF(thetai=0, thetas=0, phis=0, rotation=0, coords='psps', inc=StokesVector(1, 0, 0, 0), sens=StokesVector(1, 0, 0, 0))¶
Return the scalar BRDF in a given geometry.
- Parameters:
thetai (float) – Polar angle of incidence in radians.
thetas (float) – Polar angle of viewing in radians.
phis (float, optional) – Azimuthal angle of viewing in radians. (Note: Specular occurs when thetai = thetas, phis = 0) (default is 0)
rotation (float, optional) – Sample rotation angle in radians. (Default is 0)
coords (string, optional) – The coordinate system for the Mueller matrix, either “psps”, “xyxy”, or “plane”. (Default is psps)
inc (StokesVector or 4-list of float or int, optional) – Incident polarization as Stokes vector. (Default is unpolarized)
sens (StokesVector or 4-list of float or int, optional) – Polarization sensitivity of the viewer as a Stokes vector. (Default is unpolarized)
- Returns:
BRDF – The Mueller matrix BRDF for the given incident and viewing directions and polarizations.
- Return type:
float
- JonesBRDF(thetai=0, thetas=0, phis=0, rotation=0, coords='psps')¶
Evaluate the Jones matrix BRDF in a given geometry, and coordinate system. The result, when typecast to a Mueller matrix, is the Mueller matrix BRDF, but maintains phase, if the model has phase information.
- Parameters:
thetai (float) – Polar angle of incidence in radians.
thetas (float) – Polar angle of viewing in radians.
phis (float, optional) – Azimuthal angle of viewing in radians. (Note: Specular occurs when thetai = thetas, phis = 0) (Default is 0)
rotation (float, optional) – Sample rotation angle in radians. (Default is 0)
coords (string, optional) – The coordinate system for the Mueller matrix, either “psps”, “xyxy”, or “plane.” (Default is “psps”)
- Returns:
BRDF – The Jones matrix BRDF
- Return type:
numpy.array of complex (2x2)
- MuellerBRDF(thetai=0, thetas=0, phis=0, rotation=0, coords='psps')¶
Evaluate the Mueller matrix BRDF in a given geometry, and coordinate system.
- Parameters:
thetai (float) – Polar angle of incidence in radians.
thetas (float) – Polar angle of viewing in radians.
phis (float, optional) – Azimuthal angle of viewing in radians. (Note: Specular occurs when thetai = thetas, phis = 0) (Default is 0)
rotation (float, optional) – Sample rotation angle in radians. (Default is 0)
coords (string, optional) – The coordinate system for the Mueller matrix, either “psps”, “xyxy”, or “plane.” (Default is “psps”)
- Returns:
BRDF – The Mueller matrix BRDF
- Return type:
- class pySCATMECH.local.Local_BRDF_Model(*args, **kwargs)¶
A class for handling local BRDF Models (ones that return differential scattering cross section of isolated particles
- DSC(thetai=0, thetas=0, phis=0, rotation=0, coords='psps', inc=StokesVector(1, 0, 0, 0), sens=StokesVector(1, 0, 0, 0))¶
Return the differential scattering cross section in a given geometry.
- Parameters:
thetai (float) – Polar angle of incidence in radians
thetas (float) – Polar angle of viewing in radians
phis (float) – Azimuthal angle of viewing in radians (Note: Specular occurs when thetai = thetas, phis = 0)
rotation (float) – Sample rotation angle in radians
coords (string) – The coordinate system for the Mueller matrix, either “psps”, “xyxy”, or “plane”
inc (StokesVector) – Incident polarization as Stokes vector
sens (StokesVector) – Polarization sensitivity of the viewer as a Stokes vector
- Returns:
r – The Mueller matrix differential scattering cross section for the given incident and viewing directions and polarizations
- Return type:
float
- JonesDSC(thetai=0, thetas=0, phis=0, rotation=0, coords='psps')¶
Evaluate the Mueller matrix differential scattering cross section in a given geometry, and coordinate system. The result, when typecast to a Mueller matrix, is the Mueller matrix DSC, but maintains phase, if the model has phase information.
- Parameters:
thetai (float) – Polar angle of incidence in radians
thetas (float) – Polar angle of viewing in radians
phis (float) – Azimuthal angle of viewing in radians (Note: Specular occurs when thetai = thetas, phis = 0)
rotation (float) – Sample rotation angle in radians
coords (string) – The coordinate system for the Mueller matrix, either “psps”, “xyxy”, or “plane”
- Returns:
r – The Jones matrix differential scattering cross section
- Return type:
numpy.array of complex (2x2)
- MuellerDSC(thetai=0, thetas=0, phis=0, rotation=0, coords='psps')¶
Evaluate the Mueller matrix differential scattering cross section in a given geometry, and coordinate system
- Parameters:
thetai (float) – Polar angle of incidence in radians
thetas (float) – Polar angle of viewing in radians
phis (float) – Azimuthal angle of viewing in radians (Note: Specular occurs when thetai = thetas, phis = 0)
rotation (float) – Sample rotation angle in radians
coords (string) – The coordinate system for the Mueller matrix, either “psps”, “xyxy”, or “plane”
- Returns:
r – The Mueller matrix differential scattering cross section
- Return type:
- class pySCATMECH.scatterer.Free_Space_Scatterer(*args, **kwargs)¶
A class for handling free space scatterer models
- DifferentialScatteringCrossSection(vi, vo)¶
Returns the Mueller matrix differential scattering cross section for a given geometry
- Parameters:
vi (3-vector) – The incident direction
vo (3-vector) – The scattering direction
- Returns:
DSC – Mueller matrix differential scattering cross section
- Return type:
- Extinction(v)¶
Returns the Mueller matrix extinction cross section for a given geometry
- Parameters:
v (3-vector) – The incident direction
- Returns:
e – Mueller matrix extinction cross section
- Return type:
- ScatteringMatrix(vi, vo)¶
Returns the Mueller matrix differential scattering cross section for a given geometry
- Parameters:
vi (3-vector) – The incident direction
vo (3-vector) – The scattering direction
- Returns:
s – Scattering matrix as a Jones matrix
- Return type:
numpy.array
- class pySCATMECH.rcw.RCW_Model(*args, **kwargs)¶
Class handling rigorous coupled wave (RCW) analysis for 1D gratings.
- DiffractionAmplitude(i)¶
Returns the Jones matrix diffraction amplitude for the i-th diffraction order.
- Parameters:
i (int) – Diffraction order
- Returns:
amplitude – The Jones matrix diffraction amplitude for order i
- Return type:
JonesMatrix
- DiffractionEfficiency(i)¶
Returns the Mueller matrix diffraction efficiency for the i-th diffraction order.
- Parameters:
i (int) – Diffraction order
- Returns:
efficiency – The Mueller matrix diffraction efficiency for order i
- Return type:
- Direction(i)¶
Returns a 3D unit vector [x,y,z] in the direction of propagation of the i-th diffraction order :param i: Diffraction order :type i: int
- Returns:
direction – Directional cosines of diffracted order
- Return type:
list of float
- getEpsilon(x, z, direction='x')¶
Returns the grating dielectric constant at a specific location
- Parameters:
x (float) – Location coordinates
z (float) – Location coordinates
direction (str, optional) – If the grating is anisotropic, then direction can be set to choose a particular field direction. Can be ‘x’, ‘y’, or ‘z’. (Default is ‘x’).
- Returns:
epsilon – The dielectric constant evuated at the current wavelength and grating.
- Return type:
complex
- class pySCATMECH.crossrcw.CrossRCW_Model(*args, **kwargs)¶
Class handling rigorous coupled wave (RCW) analysis for cross gratings.
- DiffractionAmplitude(i, j)¶
Returns the Jones matrix diffraction amplitude for the (i,j)-th diffraction order
- Parameters:
i (int) – Diffraction order
j (int) – Diffraction order
- Returns:
amplitude – Diffraction amplitude, as a Jones matrix, at order (i,j)
- Return type:
numpy.array
- DiffractionEfficiency(i, j)¶
Returns the Mueller matrix diffraction efficiency for the (i,j)-th diffraction order
- Parameters:
i (int) – Diffraction order
j (int) – Diffraction order
- Returns:
efficiency – Diffraction efficiency, as a Mueller matrix, at order (i,j)
- Return type:
- Direction(i, j)¶
Returns a 3D unit vector [x,y,z] in the direction of propagation of the (i,j)-th diffraction order.
- Parameters:
i (int) – Diffraction order
j (int) – Diffraction order
- Returns:
direction – Directional cosines of diffracted direction
- Return type:
list of float
- class pySCATMECH.fresnel.Film(material, thickness=None, waves=None, wavelength=None, angle=0)¶
Class for handling an optical film.
Film stores an OpticalFunction and a thickness. One feature is that multiplication by a scalar returns a Film with its thickness multiplied by that scalar.
- Parameters:
material (OpticalFunction) – The optical function for the material
thickness (float, optional) – The thickness of the film
waves (float, optional) – The number of waves for the layer
wavelength (float, optional) – The wavelength the layer should be optimized for, if waves is set
angle (float, optional) – Vacuum angle in radians the layer should be optimized for, if waves is set (default is 0)
- class pySCATMECH.fresnel.FilmStack(films=[])¶
A class for handling stacks of films
- R(theta, wavelength, no, nt, type='12')¶
Return the reflectance.
- Parameters:
theta (float) – Incident angle in radians
wavelength (float) – Wavelength in vacuum
no (OpticalFunction) – Optical constants for the incident medium
nt (OpticalFunction) – Optical constants for the transmitted medium
type (str, optional) – If 12, then the incident medium is the medium above the substrate and theta is the incident angle, evaluated as if the radiation were in vacuum. (The component of the wavevector parallel to the surface is 2*pi*sin(theta)/lambda) If 21, then the incident medium is the substrate and theta is the incident angle evaluated is evaluated as if the radiation were in vacuum. (The component of the wavevector parallel to the surface is 2*pi*sin(theta)/lambda) If 12i, then the incident medium is the medium above the substrate and theta is the incident angle in that medium. (The component of the wavevector parallel to the surface is 2*pi*sin(theta)/no/lambda) If 21i, then the incident medium is the substrate and theta is the incident angle in the substrate. (The component of the wavevector parallel to the surface is 2*pi*sin(theta)/n0/lambda) (Default is 12)
- Returns:
refl – The Mueller matrix reflectance, which is the linear relationship between radiant fluxes.
- Return type:
- Rp(theta, wavelength, no, nt, type='12')¶
Return the reflectance for p-polarized radiation.
- Parameters:
theta (float) – Incident angle in radians
wavelength (float) – Wavelength in vacuum
no (OpticalFunction) – Optical constants for the incident medium
nt (OpticalFunction) – Optical constants for the transmitted medium
type (str, optional) – If 12, then the incident medium is the medium above the substrate and theta is the incident angle, evaluated as if the radiation were in vacuum. (The component of the wavevector parallel to the surface is 2*pi*sin(theta)/lambda) If 21, then the incident medium is the substrate and theta is the incident angle evaluated is evaluated as if the radiation were in vacuum. (The component of the wavevector parallel to the surface is 2*pi*sin(theta)/lambda) If 12i, then the incident medium is the medium above the substrate and theta is the incident angle in that medium. (The component of the wavevector parallel to the surface is 2*pi*sin(theta)/no/lambda) If 21i, then the incident medium is the substrate and theta is the incident angle in the substrate. (The component of the wavevector parallel to the surface is 2*pi*sin(theta)/n0/lambda) (Default is 12)
- Returns:
refl – The reflectance for p-polarization, which is the linear relationship between radiant fluxes.
- Return type:
float
- Rs(theta, wavelength, no, nt, type='12')¶
Return the reflectance for s-polarized radiation.
- Parameters:
theta (float) – Incident angle in radians
wavelength (float) – Wavelength in vacuum
no (OpticalFunction) – Optical constants for the incident medium
nt (OpticalFunction) – Optical constants for the transmitted medium
type (str, optional) – If 12, then the incident medium is the medium above the substrate and theta is the incident angle, evaluated as if the radiation were in vacuum. (The component of the wavevector parallel to the surface is 2*pi*sin(theta)/lambda) If 21, then the incident medium is the substrate and theta is the incident angle evaluated is evaluated as if the radiation were in vacuum. (The component of the wavevector parallel to the surface is 2*pi*sin(theta)/lambda) If 12i, then the incident medium is the medium above the substrate and theta is the incident angle in that medium. (The component of the wavevector parallel to the surface is 2*pi*sin(theta)/no/lambda) If 21i, then the incident medium is the substrate and theta is the incident angle in the substrate. (The component of the wavevector parallel to the surface is 2*pi*sin(theta)/n0/lambda) (Default is 12)
- Returns:
refl – The reflectance for s-polarization, which is the linear relationship between radiant fluxes.
- Return type:
float
- T(theta, wavelength, no, nt, type='12')¶
Return the transmittance.
- Parameters:
theta (float) – Incident angle in radians
wavelength (float) – Wavelength in vacuum
no (OpticalFunction) – Optical constants for the incident medium
nt (OpticalFunction) – Optical constants for the transmitted medium
type (str, optional) – If 12, then the incident medium is the medium above the substrate and theta is the incident angle, evaluated as if the radiation were in vacuum. (The component of the wavevector parallel to the surface is 2*pi*sin(theta)/lambda) If 21, then the incident medium is the substrate and theta is the incident angle evaluated is evaluated as if the radiation were in vacuum. (The component of the wavevector parallel to the surface is 2*pi*sin(theta)/lambda) If 12i, then the incident medium is the medium above the substrate and theta is the incident angle in that medium. (The component of the wavevector parallel to the surface is 2*pi*sin(theta)/no/lambda) If 21i, then the incident medium is the substrate and theta is the incident angle in the substrate. (The component of the wavevector parallel to the surface is 2*pi*sin(theta)/n0/lambda) (Default is 12)
- Returns:
refl – The Mueller matrix transmittance, which is the linear relationship between radiant fluxes.
- Return type:
- Tp(theta, wavelength, no, nt, type='12')¶
Return the transmittance for p-polarized radiation.
- Parameters:
theta (float) – Incident angle in radians
wavelength (float) – Wavelength in vacuum
no (OpticalFunction) – Optical constants for the incident medium
nt (OpticalFunction) – Optical constants for the transmitted medium
type (str, optional) – If 12, then the incident medium is the medium above the substrate and theta is the incident angle, evaluated as if the radiation were in vacuum. (The component of the wavevector parallel to the surface is 2*pi*sin(theta)/lambda) If 21, then the incident medium is the substrate and theta is the incident angle evaluated is evaluated as if the radiation were in vacuum. (The component of the wavevector parallel to the surface is 2*pi*sin(theta)/lambda) If 12i, then the incident medium is the medium above the substrate and theta is the incident angle in that medium. (The component of the wavevector parallel to the surface is 2*pi*sin(theta)/no/lambda) If 21i, then the incident medium is the substrate and theta is the incident angle in the substrate. (The component of the wavevector parallel to the surface is 2*pi*sin(theta)/n0/lambda) (Default is ‘12’)
- Returns:
refl – The transmittance for p-polarization, which is the linear relationship between radiant fluxes.
- Return type:
float
- Ts(theta, wavelength, no, nt, type='12')¶
Return the transmittance for s-polarized radiation.
- Parameters:
theta (float) – Incident angle in radians
wavelength (float) – Wavelength in vacuum
no (OpticalFunction) – Optical constants for the incident medium
nt (OpticalFunction) – Optical constants for the transmitted medium
type (str, optional) – If 12, then the incident medium is the medium above the substrate and theta is the incident angle, evaluated as if the radiation were in vacuum. (The component of the wavevector parallel to the surface is 2*pi*sin(theta)/lambda) If 21, then the incident medium is the substrate and theta is the incident angle evaluated is evaluated as if the radiation were in vacuum. (The component of the wavevector parallel to the surface is 2*pi*sin(theta)/lambda) If 12i, then the incident medium is the medium above the substrate and theta is the incident angle in that medium. (The component of the wavevector parallel to the surface is 2*pi*sin(theta)/no/lambda) If 21i, then the incident medium is the substrate and theta is the incident angle in the substrate. (The component of the wavevector parallel to the surface is 2*pi*sin(theta)/n0/lambda) (Default is 12)
- Returns:
refl – The transmittance for s-polarization, which is the linear relationship between radiant fluxes.
- Return type:
float
- clean()¶
Clear the stack of all films.
- getModelDict()¶
Return a Model parameter dictionary. Used primarily internally so that a FilmStack can be passed as a parameter to a Model for a stack.
- getStackCommand(wavelength)¶
Get the list of films suitable for a SCATMECH::Stack_StackModel
- Parameters:
wavelength (float) – The wavelength to evaluate the complex index at.
- Returns:
command – List of films suitable for a SCATMECH::Stack_StackModel
- Return type:
str
- reflectionCoefficient(theta, wavelength, no, nt, type='12')¶
Return the reflection coefficent.
- Parameters:
theta (float) – Incident angle in radians
wavelength (float) – Wavelength in vacuum
no (OpticalFunction) – Optical constants for the incident medium
nt (OpticalFunction) – Optical constants for the transmitted medium
type (str, optional) – If 12, then the incident medium is the medium above the substrate and theta is the incident angle, evaluated as if the radiation were in vacuum. (The component of the wavevector parallel to the surface is 2*pi*sin(theta)/lambda) If 21, then the incident medium is the substrate and theta is the incident angle evaluated is evaluated as if the radiation were in vacuum. (The component of the wavevector parallel to the surface is 2*pi*sin(theta)/lambda) If 12i, then the incident medium is the medium above the substrate and theta is the incident angle in that medium. (The component of the wavevector parallel to the surface is 2*pi*sin(theta)/no/lambda) If 21i, then the incident medium is the substrate and theta is the incident angle in the substrate. (The component of the wavevector parallel to the surface is 2*pi*sin(theta)/n0/lambda) (Default is 12)
- Returns:
coeff – The Jones matrix reflection coefficient, which is the linear relationship between the electric field amplitudes. coeff[0][0] is the s-polarized reflection coefficient. coeff[1][1] is the p-polarized reflection coefficient. coeff[1][0] = coeff[0][1] = 0
- Return type:
list of list of complex
- transmissionCoefficient(theta, wavelength, no, nt, type='12')¶
Return the transmission coefficient.
- Parameters:
theta (float) – Incident angle in radians
wavelength (float) – Wavelength in vacuum
no (OpticalFunction) – Optical constants for the incident medium
nt (OpticalFunction) – Optical constants for the transmitted medium
type (str, optional) – If 12, then the incident medium is the medium above the substrate and theta is the incident angle, evaluated as if the radiation were in vacuum. (The component of the wavevector parallel to the surface is 2*pi*sin(theta)/lambda) If 21, then the incident medium is the substrate and theta is the incident angle evaluated is evaluated as if the radiation were in vacuum. (The component of the wavevector parallel to the surface is 2*pi*sin(theta)/lambda) If 12i, then the incident medium is the medium above the substrate and theta is the incident angle in that medium. (The component of the wavevector parallel to the surface is 2*pi*sin(theta)/no/lambda) If 21i, then the incident medium is the substrate and theta is the incident angle in the substrate. (The component of the wavevector parallel to the surface is 2*pi*sin(theta)/n0/lambda) (Default is 12)
- Returns:
coeff – The Jones matrix transmission coefficient, which is the linear relationship between the electric field amplitudes. coeff[0][0] is the s-polarized transmission coefficient. coeff[1][1] is the p-polarized transmission coefficient. coeff[1][0] = coeff[0][1] = 0
- Return type:
list of list of complex
- class pySCATMECH.fresnel.OpticalFunction(name, iter=None)¶
Class for handling optical functions.
- Parameters:
name (string, complex, float, or function returning complex or float) – The complex index of refraction. If a string, it can be a “(n,k)” pair or the name of a file containing a table of wavelengths, n, and k.
- nkstr(wavelength=1)¶
Evaluate the optical constants n and k at wavelength and returns a string that can be used by SCATMECH::dielectric_function.
- Parameters:
wavelength (float) – The wavelength
- Returns:
str
The complex optical constant as a string “(n,k)” or the name of
a file.
- writeToFile(filename, wavelengths)¶
Write the optical function to a file that can be used by SCATMECH routines as a SCATMECH::dielectric_function.
- Parameters:
filename (str) – The name of the file
wavelengths (iterable of float) – The wavelengths that will be written.
- Returns:
str
The filename, if successful,
(n,k) at the first wavelength if not successful
- pySCATMECH.integrate.CircularCone¶
alias of
EllipticalCone
- class pySCATMECH.integrate.EllipticalCone(theta=0, phi=0, alpha=0, gamma=0, sensitivity=StokesVector(1, 0, 0, 0), polphi=None)¶
A solid angle defined as an elliptical circular cone.
- inside(v)¶
- Parameters:
v (tuple of float) – Direction represented as directional cosines
- Returns:
is_inside (bool) – True if v is inside solid angle, False otherwise
sensitivity (StokesVector) – The Stokes vector sensitivity
- class pySCATMECH.integrate.Hemisphere(sensitivity=StokesVector(1, 0, 0, 0), polphi=None)¶
A solid angle defined by the entire hemisphere.
- inside(v)¶
- Parameters:
v (tuple of float) – Direction represented as directional cosines
- Returns:
is_inside (bool) – True if v is inside solid angle, False otherwise
sensitivity (StokesVector) – The Stokes vector sensitivity
- class pySCATMECH.integrate.Integrator(gridsize, detector, type=1)¶
Class designed to integrate scattering models.
Class designed to integrate a BRDF_Model (to obtain reflectance) or a Local_BRDF_Model (to obtain scattering cross section).
- x, y, z
The x and y projected cosines
- Type:
ndarray(float)
- w¶
The weights
- Type:
ndarray(float)
- sens¶
The Stokes sensitivities
- Type:
list of StokesVectors
- theta¶
The polar angles in radians.
- Type:
ndarray(float)
- phi¶
The azimuthal angles in radians.
- Type:
ndarray(float)
- BRDF(model, thetai, incpol=StokesVector(1, 0, 0, 0), rotation=0)¶
Returns the BRDF at each integration point.
- Parameters:
model (BRDF_Model) – The BRDF model to be integrated
thetai (float) – The incident angle in radians
incpol (StokesVector) – The incident Stokes vector
rotation (float) – The angle of rotation of the material in radians
- Returns:
BRDF – An array of BRDF
- Return type:
np.array
- CrossSection(model, thetai, incpol=StokesVector(1, 0, 0, 0), rotation=0)¶
Integrates a Local_BRDF_Model to obtain differential scattering cross section.
- Parameters:
model (Local_BRDF_Model) – The model to be integrated.
thetai (float) – The incident angle in radians
incpol (StokesVector) – Incident Stokes vector
- Returns:
crosssection – The integrated cross section
- Return type:
float
- DSC(model, thetai, incpol=StokesVector(1, 0, 0, 0), rotation=0)¶
Returns the differential scattering cross section at each integration point.
- Parameters:
model (Local_BRDF_Model) – The BRDF model to be integrated
thetai (float) – The incident angle in radians
incpol (StokesVector) – Incident Stokes vector
rotation (float) – The angle of rotation of the material in radians
- Returns:
DSC – An array of differential scattering cross-section.
- Return type:
np.array
- PlotSamplingPoints(figsize=5, expand=1, color='b', circlecolor='r')¶
Graphs the integration points on the projected hemisphere.
- Parameters:
figsize (float, optional) – Size of figure, which will be square (default is 5)
expand (float, optional) – Scaling of sampling point size (default is 1)
color (str, optional) – Color to use for the sampling points (default is ‘b’)
circlecolor (str, optional) – Color to use for the horizon (default is ‘r’)
Requires (matplotlib) –
- Reflectance(model, thetai, incpol=StokesVector(1, 0, 0, 0), rotation=0)¶
Integrates a BRDF_Model and returns reflectance.
- Parameters:
model (BRDF_Model) – The model to be integrated.
thetai (float) – The incident angle in radians
incpol (StokesVector) – The incident Stokes vector
rotation (float) – The angle of rotation of the material in radians
- Returns:
reflectance – The integrated reflectance
- Return type:
float
- class pySCATMECH.integrate.ProjectedPolygon(boundary, sensitivity=StokesVector(1, 0, 0, 0), polphi=None)¶
A solid angle defined by an array of (x,y) points in projected cosine space.
- inside(v)¶
- Parameters:
v (tuple of float) – Direction represented as directional cosines
- Returns:
is_inside (bool) – True if v is inside solid angle, False otherwise
sensitivity (StokesVector) – The Stokes vector sensitivity
- class pySCATMECH.integrate.RectangularCone(theta=0, phi=0, alpha=0, gamma=0, sensitivity=StokesVector(1, 0, 0, 0), polphi=None)¶
A solid angle defined by a rectangular collection cone.
- inside(v)¶
- Parameters:
v (tuple of float) – Direction represented as directional cosines
- Returns:
is_inside (bool) – True if v is inside solid angle, False otherwise
sensitivity (StokesVector) – The Stokes vector sensitivity
- class pySCATMECH.integrate.SolidAngle¶
Abstract class for a solid angle on a hemisphere.
Inherited classes are expected to define inside(self,v) where v contains directional cosines and returns a tuple of bool (True if (x,y) is inside solid angle, False otherwise) and the Stokes vector sensitivity.
The parent class provides __and__, __or__, and __invert__ functionality, so that solid angles can be defined by combining other solid angle classes.
- pySCATMECH.integrate.SquareCone¶
alias of
RectangularCone