Geometric Shape Drawing Functions for Electromagnetic Inverse Scattering.
This module provides a comprehensive collection of functions for drawing various
geometric shapes with specified electromagnetic properties. These functions are
designed to create synthetic test objects for electromagnetic inverse scattering
simulations and algorithm validation.
The module supports drawing both simple and complex shapes with customizable
electromagnetic properties (relative permittivity and conductivity), positioning,
rotation, and scaling. All shapes can be drawn on existing images or create new
ones with specified resolution and background properties.
Key Features:
- Support for both dielectric and conductive objects
- Flexible positioning and rotation capabilities
- Multiple drawing modes (new image or overlay on existing)
- Consistent interface across all shape functions
- Proper coordinate system handling with origin at image center
- Rotation around object center with degree-based angles
Each function returns a tuple of (relative_permittivity, conductivity) arrays
representing the electromagnetic properties of the created scene.
Coordinate System:
- Origin (0, 0) is at the center of the image
- X-axis points right, Y-axis points up
- Angles are measured in degrees, counterclockwise from +X axis
- Image coordinates use standard matrix indexing (row, column)
All functions follow a consistent parameter naming convention:
- Geometric parameters come first (size, dimensions)
- Image parameters follow (axis_length_x, axis_length_y, resolution)
- Background electromagnetic properties
- Object electromagnetic properties
- Positioning and rotation parameters
- Optional existing image arrays for overlay operations
The functions handle input validation and provide appropriate error messages
for missing required parameters. Either resolution or existing image arrays
must be provided.
For wave-based patterns, the functions support both periodic and random
wave generation with customizable amplitude and frequency characteristics.
axis_length_x (float, default: 2.0) – Length of the size of the image.
axis_length_y (float, default: 2.0) – Length of the size of the image.
resolution (2-tuple) – Image resolution, in y and x directions, i.e., (NY, NX).
Either this argument or rel_permittivity or
conductivity must be given!
background_rel_permittivity (float, default: 1.0)
background_conductivity (float, default: 0.0)
object_rel_permittivity (float, default: 1.0)
object_conductivity (float, default: 0.0)
center (list, default: [0.0, 0.0]) – Center of the object in the image. The center of the image
corresponds to the origin of the coordinates.
rel_permittivity (numpy.ndarray, default:None) – A predefined image in which the object will be drawn.
conductivity (numpy.ndarray, default:None) – A predefined image in which the object will be drawn.
axis_length_x (float, default: 2.0) – Length of the size of the image.
axis_length_y (float, default: 2.0) – Length of the size of the image.
resolution (2-tuple) – Image resolution, in y and x directions, i.e., (NY, NX).
Either this argument or rel_permittivity or
conductivity must be given!
background_rel_permittivity (float, default: 1.0)
background_conductivity (float, default: 0.0)
object_rel_permittivity (float, default: 1.0)
object_conductivity (float, default: 0.0)
center (list, default: [0.0, 0.0]) – Center of the object in the image. The center of the image
corresponds to the origin of the coordinates.
rel_permittivity (numpy.ndarray, default:None) – A predefined image in which the object will be drawn.
conductivity (numpy.ndarray, default:None) – A predefined image in which the object will be drawn.
rotate (float, default: 0.0 degrees) – Rotation of the object around its center. In degrees.
axis_length_x (float, default: 2.0) – Length of the size of the image.
axis_length_y (float, default: 2.0) – Length of the size of the image.
resolution (2-tuple) – Image resolution, in y and x directions, i.e., (NY, NX).
Either this argument or rel_permittivity or
conductivity must be given!
background_rel_permittivity (float, default: 1.0)
background_conductivity (float, default: 0.0)
object_rel_permittivity (float, default: 1.0)
object_conductivity (float, default: 0.0)
center (list, default: [0.0, 0.0]) – Center of the object in the image. The center of the image
corresponds to the origin of the coordinates.
rel_permittivity (numpy.ndarray, default:None) – A predefined image in which the object will be drawn.
conductivity (numpy.ndarray, default:None) – A predefined image in which the object will be drawn.
rotate (float, default: 0.0 degrees) – Rotation of the object around its center. In degrees.
axis_length_x (float, default: 2.0) – Length of the size of the image.
axis_length_y (float, default: 2.0) – Length of the size of the image.
resolution (2-tuple) – Image resolution, in y and x directions, i.e., (NY, NX).
Either this argument or rel_permittivity or
conductivity must be given!
background_rel_permittivity (float, default: 1.0)
background_conductivity (float, default: 0.0)
object_rel_permittivity (float, default: 1.0)
object_conductivity (float, default: 0.0)
center (list, default: [0.0, 0.0]) – Center of the object in the image. The center of the image
corresponds to the origin of the coordinates.
rel_permittivity (numpy.ndarray, default:None) – A predefined image in which the object will be drawn.
conductivity (numpy.ndarray, default:None) – A predefined image in which the object will be drawn.
rotate (float, default: 0.0 degrees) – Rotation of the object around its center. In degrees.
axis_length_x (float, default: 2.0) – Length of the size of the image.
axis_length_y (float, default: 2.0) – Length of the size of the image.
resolution (2-tuple) – Image resolution, in y and x directions, i.e., (NY, NX).
Either this argument or rel_permittivity or
conductivity must be given!
background_rel_permittivity (float, default: 1.0)
background_conductivity (float, default: 0.0)
object_rel_permittivity (float, default: 1.0)
object_conductivity (float, default: 0.0)
center (list, default: [0.0, 0.0]) – Center of the object in the image. The center of the image
corresponds to the origin of the coordinates.
rel_permittivity (numpy.ndarray, default:None) – A predefined image in which the object will be drawn.
conductivity (numpy.ndarray, default: None) – A predefined image in which the object will be drawn.
rotate (float, default: 0.0 degrees) – Rotation of the object around its center. In degrees.
radius (float) – Radius from the center to each vertex.
axis_length_x (float, default: 2.0) – Length of the size of the image.
axis_length_y (float, default: 2.0) – Length of the size of the image.
resolution (2-tuple) – Image resolution, in y and x directions, i.e., (NY, NX).
Either this argument or rel_permittivity or
conductivity must be given!
background_rel_permittivity (float, default: 1.0)
background_conductivity (float, default: 0.0)
object_rel_permittivity (float, default: 1.0)
object_conductivity (float, default: 0.0)
center (list, default: [0.0, 0.0]) – Center of the object in the image. The center of the image
corresponds to the origin of the coordinates.
rel_permittivity (numpy.ndarray, default:None) – A predefined image in which the object will be drawn.
conductivity (numpy.ndarray, default:None) – A predefined image in which the object will be drawn.
rotate (float, default: 0.0 degrees) – Rotation of the object around its center. In degrees.
number_sides (int) – Number of sides of the polygon.
maximum_radius (float) – Maximum radius from the origin to each vertex.
axis_length_x (float, default: 2.0) – Length of the size of the image.
axis_length_y (float, default: 2.0) – Length of the size of the image.
resolution (2-tuple) – Image resolution, in y and x directions, i.e., (NY, NX).
Either this argument or rel_permittivity or
conductivity must be given!
background_rel_permittivity (float, default: 1.0)
background_conductivity (float, default: 0.0)
object_rel_permittivity (float, default: 1.0)
object_conductivity (float, default: 0.0)
center (list, default: [0.0, 0.0]) – Center of the object in the image. The center of the image
corresponds to the origin of the coordinates.
rel_permittivity (numpy.ndarray, default:None) – A predefined image in which the object will be drawn.
conductivity (numpy.ndarray, default:None) – A predefined image in which the object will be drawn.
rotate (float, default: 0.0 degrees) – Rotation of the object around its center. In degrees.
axis_length_x (float, default: 2.0) – Length of the size of the image.
axis_length_y (float, default: 2.0) – Length of the size of the image.
resolution (2-tuple) – Image resolution, in y and x directions, i.e., (NY, NX).
Either this argument or rel_permittivity or
conductivity must be given!
background_rel_permittivity (float, default: 1.0)
background_conductivity (float, default: 0.0)
object_rel_permittivity (float, default: 1.0)
object_conductivity (float, default: 0.0)
center (list, default: [0.0, 0.0]) – Center of the object in the image. The center of the image
corresponds to the origin of the coordinates.
rel_permittivity (numpy.ndarray, default:None) – A predefined image in which the object will be drawn.
conductivity (numpy.ndarray, default: None) – A predefined image in which the object will be drawn.
rotate (float, default: 0.0 degrees) – Rotation of the object around its center. In degrees.
inner_radius (float) – Inner and outer radii of the ring.
outer_radius (float) – Inner and outer radii of the ring.
axis_length_x (float, default: 2.0) – Length of the size of the image.
axis_length_y (float, default: 2.0) – Length of the size of the image.
resolution (2-tuple) – Image resolution, in y and x directions, i.e., (NY, NX).
Either this argument or rel_permittivity or
conductivity must be given!
background_rel_permittivity (float, default: 1.0)
background_conductivity (float, default: 0.0)
object_rel_permittivity (float, default: 1.0)
object_conductivity (float, default: 0.0)
center (list, default: [0.0, 0.0]) – Center of the object in the image. The center of the image
corresponds to the origin of the coordinates.
rel_permittivity (numpy.ndarray, default:None) – A predefined image in which the object will be drawn.
conductivity (numpy.ndarray, default:None) – A predefined image in which the object will be drawn.
Draw a square with specified electromagnetic properties.
This function creates a square object with customizable electromagnetic
properties, positioning, and rotation on a 2D grid. The square can be
drawn on a new image or overlaid on existing permittivity and conductivity
arrays.
Parameters:
side_length (float) – Length of the square’s side in the same units as axis_length_x/y.
axis_length_x (float, default=2.0) – Physical length of the image in the x-direction.
axis_length_y (float, default=2.0) – Physical length of the image in the y-direction.
resolution (tuple of int, optional) – Image resolution as (NY, NX). Required if rel_permittivity and
conductivity are not provided.
background_rel_permittivity (float, default=1.0) – Relative permittivity of the background medium.
background_conductivity (float, default=0.0) – Conductivity of the background medium in S/m.
object_rel_permittivity (float, default=1.0) – Relative permittivity of the square object.
object_conductivity (float, default=0.0) – Conductivity of the square object in S/m.
center (list of float, default=[0.0, 0.0]) – Center position of the square as [x, y] coordinates.
rotate (float, default=0.0) – Rotation angle in degrees (counterclockwise).
rel_permittivity (numpy.ndarray, optional) – Existing relative permittivity array to overlay on.
conductivity (numpy.ndarray, optional) – Existing conductivity array to overlay on.
radius (float) – Radius of the vertex from the center of the star.
axis_length_x (float, default: 2.0) – Length of the size of the image.
axis_length_y (float, default: 2.0) – Length of the size of the image.
resolution (2-tuple) – Image resolution, in y and x directions, i.e., (NY, NX).
Either this argument or rel_permittivity or
conductivity must be given!
background_rel_permittivity (float, default: 1.0)
background_conductivity (float, default: 0.0)
object_rel_permittivity (float, default: 1.0)
object_conductivity (float, default: 0.0)
center (list, default: [0.0, 0.0]) – Center of the object in the image. The center of the image
corresponds to the origin of the coordinates.
rel_permittivity (numpy.ndarray, default:None) – A predefined image in which the object will be drawn.
conductivity (numpy.ndarray, default: None) – A predefined image in which the object will be drawn.
rotate (float, default: 0.0 degrees) – Rotation of the object around its center. In degrees.
radius (int) – Length from the center of the star to the main vertices.
maximum_radius (float) – Maximum radius from the origin to each vertex.
axis_length_x (float, default: 2.0) – Length of the size of the image.
axis_length_y (float, default: 2.0) – Length of the size of the image.
resolution (2-tuple) – Image resolution, in y and x directions, i.e., (NY, NX).
Either this argument or rel_permittivity or
conductivity must be given!
background_rel_permittivity (float, default: 1.0)
background_conductivity (float, default: 0.0)
object_rel_permittivity (float, default: 1.0)
object_conductivity (float, default: 0.0)
center (list, default: [0.0, 0.0]) – Center of the object in the image. The center of the image
corresponds to the origin of the coordinates.
rel_permittivity (numpy.ndarray, default:None) – A predefined image in which the object will be drawn.
conductivity (numpy.ndarray, default:None) – A predefined image in which the object will be drawn.
rotate (float, default: 0.0 degrees) – Rotation of the object around its center. In degrees.
radius (float) – Length from the center to the maximum edge.
axis_length_x (float, default: 2.0) – Length of the size of the image.
axis_length_y (float, default: 2.0) – Length of the size of the image.
resolution (2-tuple) – Image resolution, in y and x directions, i.e., (NY, NX).
Either this argument or rel_permittivity or
conductivity must be given!
background_rel_permittivity (float, default: 1.0)
background_conductivity (float, default: 0.0)
object_rel_permittivity (float, default: 1.0)
object_conductivity (float, default: 0.0)
center (list, default: [0.0, 0.0]) – Center of the object in the image. The center of the image
corresponds to the origin of the coordinates.
rel_permittivity (numpy.ndarray, default:None) – A predefined image in which the object will be drawn.
conductivity (numpy.ndarray, default:None) – A predefined image in which the object will be drawn.
rotate (float, default: 0.0 degrees) – Rotation of the object around its center. In degrees.
axis_length_x (float, default: 2.0) – Length of the size of the image.
axis_length_y (float, default: 2.0) – Length of the size of the image.
resolution (2-tuple) – Image resolution, in y and x directions, i.e., (NY, NX).
Either this argument or rel_permittivity or
conductivity must be given!
background_rel_permittivity (float, default: 1.0)
background_conductivity (float, default: 0.0)
object_rel_permittivity (float, default: 1.0)
object_conductivity (float, default: 0.0)
center (list, default: [0.0, 0.0]) – Center of the object in the image. The center of the image
corresponds to the origin of the coordinates.
rel_permittivity (numpy.ndarray, default:None) – A predefined image in which the object will be drawn.
conductivity (numpy.ndarray, default: None) – A predefined image in which the object will be drawn.
rotate (float, default: 0.0 degrees) – Rotation of the object around its center. In degrees.
This routine plots a figure comparing the confidence interval of
means among samples. The confidence intervals are computed at a
0.95 confidence level. This routine does not show any plot. It only
draws the graphic.
Parameters:
data (either numpy.ndarray or list) – A 2-d array with the samples in which each column is a
single sample or a list of 1-d arrays.
axes (matplotlib.Axes.axes, default: None) – A specified axes for plotting the graphics. If none is
provided, then one will be created and returned.
title (str, default: None) – A possible title to the plot.
xlabel (str, default: None) – The label of the x-axis which represent the unit of the
data.
ylabel (list of str, default: None) – A list with the name of the samples.
Try data transformation for normal distribution assumptions.
Currently, it only implements the Log and Square-Root
transformations. The normality assumption may be tested on the data
or in the residuals.
Parameters:
data (either numpy.ndarray or list) – If residuals is False, then the argument must be an 1-d
array with the sample to be tested. Otherwise, it must be
a list of arrays.
residuals (bool) – If True, the transformation will be tried over the
residuals of the observations. Otherwise, the transformation
will be tried over the own sample.
Returns:
If the transformation succeeds, then it returns the transformed
data and a string containing the type of transformation.
Otherwise, it returns None.
Perform all-to-one comparisons through Dunnett’s test.
The Dunnett’s test is a procedure for comparing a set of \(a-1\)
treatments against a single one called the control group [1]_. The
test is a modification of the usual t-test where, in each
comparison, the null hypothesis is the equality of means. The
significance level is fixed in 0.05.
Parameters:
y0 (numpy.ndarray) – Control sample (1-d array).
y (list or numpy.ndarray) – \(a-1\) treatments to be compared. The argument must be
either a list of Numpy arrays or a matrix with shape
(a-1, n).
Returns:
null_hypothesislist of bool
List of boolean values indicating the result of the null
hypothesis. If True, it means that the test has failed in
rejecting the null hypothesis. If False, then the null
hypothesis of equality of means for the respective
comparison has been reject at a 0.05 significance level.
Given a data set with some amount of factors and levels, the method
performs the factorial analysis in order to find evidences for
impact of single factors (main effects) and combination among them
(interaction effects) [1]_.
In this current version, it only supports two or three factors and
balanced data.
Parameters:
data (numpy.ndarray) – The data set in array format in which each dimension
represents a factor and the number of elements represents
the number of levels of respective factor. The shape must be
either (a, b, n), for two-factors, or (a, b, c, n), for
three factors. Obs.: the last dimension is the number of
samples for each combination of factors-levels.
group_names (list, default: None) – Factor names for plot purposes.
ylabel (str) – Y-axis label for plot purposes (meaning of the data).
Returns:
null_hypothesislist
The list with the results of the null hypothesis of the
statistic tests. If True, means that the test failed to
reject the null hypothesis; if False, means the null
hypothesis was rejected. For two-factor anaylsis, the each
element represents the test on the following factors
[A, B, AB]. For three-factor,
[A, B, C, AB, AC, BC, ABC].
pvalueslist
The list with the p-values of each test. The order follows
the same defined for null_hypothesis.
shapiro_pvalue: float
The p-value of the Shapiro-Wilk’s test for normality of
residuals assumption. A p-value less than 0.05 means the
rejection of the assumption.
fligner_pvalue: float
The p-value of the Fligner-Killen’s test for homoscedascity
(variance equality) of samples. A p-value less than 0.05
means the rejection of the assumption.
figmatplotlib.figure.Figure
A plot showing the normality and homoscedascity assumption.
The graphic way to anaylise the assumptions.
transformationNone or str
If None, no transformation was applied on the data in
order to fix it for following the assumption. Otherwise,
it is a string saying the type of transformation.
References
eispy2d.utils.statisticsutils.fittedcurve(x, a, b, c)#
Evaluate standard curve \(ax^b + c\) for Dunnett’s test fitting.
Graphic investigation of homoscedasticity assumption.
This routine plots a figure comparing variance of samples for the
purpose of investigating the assumption of homoscedasticity
(samples with equal variance). Each samples is positioned in the
x-axis in the correspondent value of its own mean. This routine does
not show any plot. It only draws the graphic.
Parameters:
data (either numpy.ndarray or list) – A 2-d array with the samples in which each row is a single
sample or a list of 1-d arrays.
axes (matplotlib.Axes.axes, default: None) – A specified axes for plotting the graphics. If none is
provided, then one will be created and returned.
title (str, default: None) – A possible title to the plot.
ylabel (str, default: None) – The label of the y-axis which represent the unit of the
data.
names (list of str, default: None) – A list with the name of the samples for legend purpose.
This routine plots a figure comparing a sample to a standard normal
distribution for the purpose of investigating the assumption of
normality. This routine does not show any plot. It only draws the
graphic.
Parameters:
data (numpy.ndarray) – An 1-d array representing the sample.
axes (matplotlib.Axes.axes, default: None) – A specified axes for plotting the graphics. If none is
provided, then one will be created and returned.
title (str, default: None) – A possible title to the plot.
Result of the null hypothesis test. If True, it means that
the test has failed to reject the null hypothesis. If
False, it means that the null hypothesis has been rejected
at 1-alpha confidence level.
t0float
T statistic.
pvalue: float
nufloat
Degrees of freedom.
confinttuple of 2-float
Confidence interval (lower and upper bounds) of the true
mean difference.
Obs: if no axes is provided, then a figure will be created and
showed or saved.
Parameters:
data (list of numpy.ndarray) – A list of 1-d arrays meaning the samples.
axes (matplotlib.Axes.axes, default: None) – A specified axes for plotting the graphics. If none is
provided, then one will be created and showed or saved.
labels (list of str, default: None) – Names of the samples.
xlabel (str, default: None)
ylabel (list of str, default: None)
color (str, default: 'b') – Color of boxes. Check some here
yscale (None or {'linear', 'log', 'symlog', 'logit', ...}) – Scale of y-axis. Check some options here <https://
matplotlib.org/3.1.1/api/_as_gen/
matplotlib.pyplot.yscale.html>
title (str, default: None) – A possible title to the plot.
show (bool) – If True, then the figure is shown. Otherwise, the figure
is saved.
file_name (str) – File name when saving the figure.
file_path (str) – Path to the saved figure.
file_format ({'eps', 'png', 'pdf', 'svg'}) – Format of the saved figure.
Initialize stopping criteria for iterative algorithms.
Parameters:
max_evaluations (int, optional) – Maximum number of objective function evaluations.
max_iterations (int, optional) – Maximum number of iterations.
max_evals_woimp (int, optional) – Maximum number of evaluations without improvement.
max_iter_woimp (int, optional) – Maximum number of iterations without improvement.
cost_function_threshold (float, optional) – Threshold for the objective function value.
improvement_threshold (float, optional) – Minimum relative improvement (percentage) to be considered as
improvement. Required if max_evals_woimp or max_iter_woimp is set.
Raises:
Error – If no stopping criterion is provided, or if improvement_threshold
is missing when using improvement-based criteria.
MissingInputError – If improvement_threshold is missing when required.
Initialize stopping criteria for iterative algorithms.
Parameters:
max_evaluations (int, optional) – Maximum number of objective function evaluations.
max_iterations (int, optional) – Maximum number of iterations.
max_evals_woimp (int, optional) – Maximum number of evaluations without improvement.
max_iter_woimp (int, optional) – Maximum number of iterations without improvement.
cost_function_threshold (float, optional) – Threshold for the objective function value.
improvement_threshold (float, optional) – Minimum relative improvement (percentage) to be considered as
improvement. Required if max_evals_woimp or max_iter_woimp is set.
Raises:
Error – If no stopping criterion is provided, or if improvement_threshold
is missing when using improvement-based criteria.
MissingInputError – If improvement_threshold is missing when required.
choice (int, float, or {'fixed', 'mozorov', 'lcurve'}) – Regularization parameter selection strategy:
- If int or float: fixed regularization parameter value.
- ‘fixed’: use a fixed parameter value (must provide parameter).
- ‘mozorov’: use Morozov’s discrepancy principle.
- ‘lcurve’: use L-curve criterion.
parameter (float, optional) – Fixed regularization parameter value (required if choice=’fixed’).
Solve the linear system using Tikhonov regularization.
Parameters:
K (numpy.ndarray) – Coefficient matrix (kernel) with shape (M, N).
y (numpy.ndarray) – Right-hand side vector or matrix with shape (M,) or (M, P).
Returns:
Solution vector or matrix with shape (N,) or (N, P).
Return type:
numpy.ndarray
Notes
The solution is computed as:
- For fixed parameter: \(x = (K^*K + \alpha I)^{-1}K^*y\)
- For Morozov: automatically selects \(\alpha\) using discrepancy principle
- For L-curve: automatically selects \(\alpha\) using L-curve criterion
axis_length_x (float, default: 2.0) – Length of the size of the image.
axis_length_y (float, default: 2.0) – Length of the size of the image.
resolution (2-tuple) – Image resolution, in y and x directions, i.e., (NY, NX).
Either this argument or rel_permittivity or
conductivity must be given!
background_rel_permittivity (float, default: 1.0)
background_conductivity (float, default: 0.0)
object_rel_permittivity (float, default: 1.0)
object_conductivity (float, default: 0.0)
center (list, default: [0.0, 0.0]) – Center of the object in the image. The center of the image
corresponds to the origin of the coordinates.
rel_permittivity (numpy.ndarray, default:None) – A predefined image in which the object will be drawn.
conductivity (numpy.ndarray, default:None) – A predefined image in which the object will be drawn.
This routine plots a figure comparing the confidence interval of
means among samples. The confidence intervals are computed at a
0.95 confidence level. This routine does not show any plot. It only
draws the graphic.
Parameters:
data (either numpy.ndarray or list) – A 2-d array with the samples in which each column is a
single sample or a list of 1-d arrays.
axes (matplotlib.Axes.axes, default: None) – A specified axes for plotting the graphics. If none is
provided, then one will be created and returned.
title (str, default: None) – A possible title to the plot.
xlabel (str, default: None) – The label of the x-axis which represent the unit of the
data.
ylabel (list of str, default: None) – A list with the name of the samples.
axis_length_x (float, default: 2.0) – Length of the size of the image.
axis_length_y (float, default: 2.0) – Length of the size of the image.
resolution (2-tuple) – Image resolution, in y and x directions, i.e., (NY, NX).
Either this argument or rel_permittivity or
conductivity must be given!
background_rel_permittivity (float, default: 1.0)
background_conductivity (float, default: 0.0)
object_rel_permittivity (float, default: 1.0)
object_conductivity (float, default: 0.0)
center (list, default: [0.0, 0.0]) – Center of the object in the image. The center of the image
corresponds to the origin of the coordinates.
rel_permittivity (numpy.ndarray, default:None) – A predefined image in which the object will be drawn.
conductivity (numpy.ndarray, default:None) – A predefined image in which the object will be drawn.
rotate (float, default: 0.0 degrees) – Rotation of the object around its center. In degrees.
Perform all-to-one comparisons through Dunnett’s test.
The Dunnett’s test is a procedure for comparing a set of \(a-1\)
treatments against a single one called the control group [1]_. The
test is a modification of the usual t-test where, in each
comparison, the null hypothesis is the equality of means. The
significance level is fixed in 0.05.
Parameters:
y0 (numpy.ndarray) – Control sample (1-d array).
y (list or numpy.ndarray) – \(a-1\) treatments to be compared. The argument must be
either a list of Numpy arrays or a matrix with shape
(a-1, n).
Returns:
null_hypothesislist of bool
List of boolean values indicating the result of the null
hypothesis. If True, it means that the test has failed in
rejecting the null hypothesis. If False, then the null
hypothesis of equality of means for the respective
comparison has been reject at a 0.05 significance level.
axis_length_x (float, default: 2.0) – Length of the size of the image.
axis_length_y (float, default: 2.0) – Length of the size of the image.
resolution (2-tuple) – Image resolution, in y and x directions, i.e., (NY, NX).
Either this argument or rel_permittivity or
conductivity must be given!
background_rel_permittivity (float, default: 1.0)
background_conductivity (float, default: 0.0)
object_rel_permittivity (float, default: 1.0)
object_conductivity (float, default: 0.0)
center (list, default: [0.0, 0.0]) – Center of the object in the image. The center of the image
corresponds to the origin of the coordinates.
rel_permittivity (numpy.ndarray, default:None) – A predefined image in which the object will be drawn.
conductivity (numpy.ndarray, default:None) – A predefined image in which the object will be drawn.
rotate (float, default: 0.0 degrees) – Rotation of the object around its center. In degrees.
Given a data set with some amount of factors and levels, the method
performs the factorial analysis in order to find evidences for
impact of single factors (main effects) and combination among them
(interaction effects) [1]_.
In this current version, it only supports two or three factors and
balanced data.
Parameters:
data (numpy.ndarray) – The data set in array format in which each dimension
represents a factor and the number of elements represents
the number of levels of respective factor. The shape must be
either (a, b, n), for two-factors, or (a, b, c, n), for
three factors. Obs.: the last dimension is the number of
samples for each combination of factors-levels.
group_names (list, default: None) – Factor names for plot purposes.
ylabel (str) – Y-axis label for plot purposes (meaning of the data).
Returns:
null_hypothesislist
The list with the results of the null hypothesis of the
statistic tests. If True, means that the test failed to
reject the null hypothesis; if False, means the null
hypothesis was rejected. For two-factor anaylsis, the each
element represents the test on the following factors
[A, B, AB]. For three-factor,
[A, B, C, AB, AC, BC, ABC].
pvalueslist
The list with the p-values of each test. The order follows
the same defined for null_hypothesis.
shapiro_pvalue: float
The p-value of the Shapiro-Wilk’s test for normality of
residuals assumption. A p-value less than 0.05 means the
rejection of the assumption.
fligner_pvalue: float
The p-value of the Fligner-Killen’s test for homoscedascity
(variance equality) of samples. A p-value less than 0.05
means the rejection of the assumption.
figmatplotlib.figure.Figure
A plot showing the normality and homoscedascity assumption.
The graphic way to anaylise the assumptions.
transformationNone or str
If None, no transformation was applied on the data in
order to fix it for following the assumption. Otherwise,
it is a string saying the type of transformation.
Graphic investigation of homoscedasticity assumption.
This routine plots a figure comparing variance of samples for the
purpose of investigating the assumption of homoscedasticity
(samples with equal variance). Each samples is positioned in the
x-axis in the correspondent value of its own mean. This routine does
not show any plot. It only draws the graphic.
Parameters:
data (either numpy.ndarray or list) – A 2-d array with the samples in which each row is a single
sample or a list of 1-d arrays.
axes (matplotlib.Axes.axes, default: None) – A specified axes for plotting the graphics. If none is
provided, then one will be created and returned.
title (str, default: None) – A possible title to the plot.
ylabel (str, default: None) – The label of the y-axis which represent the unit of the
data.
names (list of str, default: None) – A list with the name of the samples for legend purpose.
axis_length_x (float, default: 2.0) – Length of the size of the image.
axis_length_y (float, default: 2.0) – Length of the size of the image.
resolution (2-tuple) – Image resolution, in y and x directions, i.e., (NY, NX).
Either this argument or rel_permittivity or
conductivity must be given!
background_rel_permittivity (float, default: 1.0)
background_conductivity (float, default: 0.0)
object_rel_permittivity (float, default: 1.0)
object_conductivity (float, default: 0.0)
center (list, default: [0.0, 0.0]) – Center of the object in the image. The center of the image
corresponds to the origin of the coordinates.
rel_permittivity (numpy.ndarray, default:None) – A predefined image in which the object will be drawn.
conductivity (numpy.ndarray, default:None) – A predefined image in which the object will be drawn.
rotate (float, default: 0.0 degrees) – Rotation of the object around its center. In degrees.
axis_length_x (float, default: 2.0) – Length of the size of the image.
axis_length_y (float, default: 2.0) – Length of the size of the image.
resolution (2-tuple) – Image resolution, in y and x directions, i.e., (NY, NX).
Either this argument or rel_permittivity or
conductivity must be given!
background_rel_permittivity (float, default: 1.0)
background_conductivity (float, default: 0.0)
object_rel_permittivity (float, default: 1.0)
object_conductivity (float, default: 0.0)
center (list, default: [0.0, 0.0]) – Center of the object in the image. The center of the image
corresponds to the origin of the coordinates.
rel_permittivity (numpy.ndarray, default:None) – A predefined image in which the object will be drawn.
conductivity (numpy.ndarray, default: None) – A predefined image in which the object will be drawn.
rotate (float, default: 0.0 degrees) – Rotation of the object around its center. In degrees.
radius (float) – Radius from the center to each vertex.
axis_length_x (float, default: 2.0) – Length of the size of the image.
axis_length_y (float, default: 2.0) – Length of the size of the image.
resolution (2-tuple) – Image resolution, in y and x directions, i.e., (NY, NX).
Either this argument or rel_permittivity or
conductivity must be given!
background_rel_permittivity (float, default: 1.0)
background_conductivity (float, default: 0.0)
object_rel_permittivity (float, default: 1.0)
object_conductivity (float, default: 0.0)
center (list, default: [0.0, 0.0]) – Center of the object in the image. The center of the image
corresponds to the origin of the coordinates.
rel_permittivity (numpy.ndarray, default:None) – A predefined image in which the object will be drawn.
conductivity (numpy.ndarray, default:None) – A predefined image in which the object will be drawn.
rotate (float, default: 0.0 degrees) – Rotation of the object around its center. In degrees.
number_sides (int) – Number of sides of the polygon.
maximum_radius (float) – Maximum radius from the origin to each vertex.
axis_length_x (float, default: 2.0) – Length of the size of the image.
axis_length_y (float, default: 2.0) – Length of the size of the image.
resolution (2-tuple) – Image resolution, in y and x directions, i.e., (NY, NX).
Either this argument or rel_permittivity or
conductivity must be given!
background_rel_permittivity (float, default: 1.0)
background_conductivity (float, default: 0.0)
object_rel_permittivity (float, default: 1.0)
object_conductivity (float, default: 0.0)
center (list, default: [0.0, 0.0]) – Center of the object in the image. The center of the image
corresponds to the origin of the coordinates.
rel_permittivity (numpy.ndarray, default:None) – A predefined image in which the object will be drawn.
conductivity (numpy.ndarray, default:None) – A predefined image in which the object will be drawn.
rotate (float, default: 0.0 degrees) – Rotation of the object around its center. In degrees.
axis_length_x (float, default: 2.0) – Length of the size of the image.
axis_length_y (float, default: 2.0) – Length of the size of the image.
resolution (2-tuple) – Image resolution, in y and x directions, i.e., (NY, NX).
Either this argument or rel_permittivity or
conductivity must be given!
background_rel_permittivity (float, default: 1.0)
background_conductivity (float, default: 0.0)
object_rel_permittivity (float, default: 1.0)
object_conductivity (float, default: 0.0)
center (list, default: [0.0, 0.0]) – Center of the object in the image. The center of the image
corresponds to the origin of the coordinates.
rel_permittivity (numpy.ndarray, default:None) – A predefined image in which the object will be drawn.
conductivity (numpy.ndarray, default: None) – A predefined image in which the object will be drawn.
rotate (float, default: 0.0 degrees) – Rotation of the object around its center. In degrees.
inner_radius (float) – Inner and outer radii of the ring.
outer_radius (float) – Inner and outer radii of the ring.
axis_length_x (float, default: 2.0) – Length of the size of the image.
axis_length_y (float, default: 2.0) – Length of the size of the image.
resolution (2-tuple) – Image resolution, in y and x directions, i.e., (NY, NX).
Either this argument or rel_permittivity or
conductivity must be given!
background_rel_permittivity (float, default: 1.0)
background_conductivity (float, default: 0.0)
object_rel_permittivity (float, default: 1.0)
object_conductivity (float, default: 0.0)
center (list, default: [0.0, 0.0]) – Center of the object in the image. The center of the image
corresponds to the origin of the coordinates.
rel_permittivity (numpy.ndarray, default:None) – A predefined image in which the object will be drawn.
conductivity (numpy.ndarray, default:None) – A predefined image in which the object will be drawn.
Draw a square with specified electromagnetic properties.
This function creates a square object with customizable electromagnetic
properties, positioning, and rotation on a 2D grid. The square can be
drawn on a new image or overlaid on existing permittivity and conductivity
arrays.
Parameters:
side_length (float) – Length of the square’s side in the same units as axis_length_x/y.
axis_length_x (float, default=2.0) – Physical length of the image in the x-direction.
axis_length_y (float, default=2.0) – Physical length of the image in the y-direction.
resolution (tuple of int, optional) – Image resolution as (NY, NX). Required if rel_permittivity and
conductivity are not provided.
background_rel_permittivity (float, default=1.0) – Relative permittivity of the background medium.
background_conductivity (float, default=0.0) – Conductivity of the background medium in S/m.
object_rel_permittivity (float, default=1.0) – Relative permittivity of the square object.
object_conductivity (float, default=0.0) – Conductivity of the square object in S/m.
center (list of float, default=[0.0, 0.0]) – Center position of the square as [x, y] coordinates.
rotate (float, default=0.0) – Rotation angle in degrees (counterclockwise).
rel_permittivity (numpy.ndarray, optional) – Existing relative permittivity array to overlay on.
conductivity (numpy.ndarray, optional) – Existing conductivity array to overlay on.
radius (float) – Radius of the vertex from the center of the star.
axis_length_x (float, default: 2.0) – Length of the size of the image.
axis_length_y (float, default: 2.0) – Length of the size of the image.
resolution (2-tuple) – Image resolution, in y and x directions, i.e., (NY, NX).
Either this argument or rel_permittivity or
conductivity must be given!
background_rel_permittivity (float, default: 1.0)
background_conductivity (float, default: 0.0)
object_rel_permittivity (float, default: 1.0)
object_conductivity (float, default: 0.0)
center (list, default: [0.0, 0.0]) – Center of the object in the image. The center of the image
corresponds to the origin of the coordinates.
rel_permittivity (numpy.ndarray, default:None) – A predefined image in which the object will be drawn.
conductivity (numpy.ndarray, default: None) – A predefined image in which the object will be drawn.
rotate (float, default: 0.0 degrees) – Rotation of the object around its center. In degrees.
radius (int) – Length from the center of the star to the main vertices.
maximum_radius (float) – Maximum radius from the origin to each vertex.
axis_length_x (float, default: 2.0) – Length of the size of the image.
axis_length_y (float, default: 2.0) – Length of the size of the image.
resolution (2-tuple) – Image resolution, in y and x directions, i.e., (NY, NX).
Either this argument or rel_permittivity or
conductivity must be given!
background_rel_permittivity (float, default: 1.0)
background_conductivity (float, default: 0.0)
object_rel_permittivity (float, default: 1.0)
object_conductivity (float, default: 0.0)
center (list, default: [0.0, 0.0]) – Center of the object in the image. The center of the image
corresponds to the origin of the coordinates.
rel_permittivity (numpy.ndarray, default:None) – A predefined image in which the object will be drawn.
conductivity (numpy.ndarray, default:None) – A predefined image in which the object will be drawn.
rotate (float, default: 0.0 degrees) – Rotation of the object around its center. In degrees.
radius (float) – Length from the center to the maximum edge.
axis_length_x (float, default: 2.0) – Length of the size of the image.
axis_length_y (float, default: 2.0) – Length of the size of the image.
resolution (2-tuple) – Image resolution, in y and x directions, i.e., (NY, NX).
Either this argument or rel_permittivity or
conductivity must be given!
background_rel_permittivity (float, default: 1.0)
background_conductivity (float, default: 0.0)
object_rel_permittivity (float, default: 1.0)
object_conductivity (float, default: 0.0)
center (list, default: [0.0, 0.0]) – Center of the object in the image. The center of the image
corresponds to the origin of the coordinates.
rel_permittivity (numpy.ndarray, default:None) – A predefined image in which the object will be drawn.
conductivity (numpy.ndarray, default:None) – A predefined image in which the object will be drawn.
rotate (float, default: 0.0 degrees) – Rotation of the object around its center. In degrees.
axis_length_x (float, default: 2.0) – Length of the size of the image.
axis_length_y (float, default: 2.0) – Length of the size of the image.
resolution (2-tuple) – Image resolution, in y and x directions, i.e., (NY, NX).
Either this argument or rel_permittivity or
conductivity must be given!
background_rel_permittivity (float, default: 1.0)
background_conductivity (float, default: 0.0)
object_rel_permittivity (float, default: 1.0)
object_conductivity (float, default: 0.0)
center (list, default: [0.0, 0.0]) – Center of the object in the image. The center of the image
corresponds to the origin of the coordinates.
rel_permittivity (numpy.ndarray, default:None) – A predefined image in which the object will be drawn.
conductivity (numpy.ndarray, default: None) – A predefined image in which the object will be drawn.
rotate (float, default: 0.0 degrees) – Rotation of the object around its center. In degrees.