RAIMAD

raimad.AnSec

class AnSec( raimad.compo.Compo, ):
Annular Sector. A polygon approximating an annular sector, or, in working men's terms, a "pizza crust". An ansec is defined by two radii and two angles: the inner radius r1, the outter radius r2, the starting angle theta1 and the end angle theta2. Helper functions are available to construct ansecs from different measurements.

def _make(self, r1: float, r2: float, theta1: float, theta2: float, num_points: int = 100) -> None:

Construct and AnSec.
Parameters
r1
The inner radius
r2
The outter radius
theta1
The start angle
theta2
The stop angle
num_points
The number of points to use in each arc (inner and outter).

@classmethod def from_auto(cls, r1: float | None = None, r2: float | None = None, rmid: float | None = None, dr: float | None = None, theta1: float | None = None, theta2: float | None = None, thetamid: float | None = None, dtheta: float | None = None, num_points: int = 100) -> Self:

Produce a new ansec from any valid combination of parameters.
While AnSec._make requires the set of parameters r1, r2, theta1, theta2, this method adds additional parameters rmid (the midpoint radius), dr (radius delta), thetamid (midpoint angle) and dtheta (angle delta). You may use any valid combination of these extended parameters to make new AnSecs.
Parameters
r1
Inner radius or None
r2
Outter radius or None
rmid
Midradius or None
dr
Radius delta or None
theta1
Angle 1 or None
theta2
Angle 2 or None
tmid
middle angle or None
dt
angle delta or None
num_points:
number of points to use per arc (outter and inner)
Raises
AnSecRadiusNotEnoughArgumentsError
If not enough radius-related parameters are given
AnSecRadiusTooManyArgumentsError
If too many radius-related parameters are given
AnSecRadiusIncorrectArgumentsError
If invalid combination of radius-related arguments is given
AnSecThetaNotEnoughArgumentsError
If not enough angle-related parameters are given
AnSecThetaTooManyArgumentsError
If too many angle-related parameters are given
AnSecThetaIncorrectArgumentsError
If invalid combination of angle-related arguments is given

@staticmethod def interpret_radius(r1: float | None, r2: float | None, rmid: float | None, dr: float | None) -> tuple[float, float]:

Convert any valid combination of r1, r2, rmid, dr into r1 and r2.
Parameters
r1
Inner radius or None
r2
Outter radius or None
rmid
Midradius or None
dr
Radius delta or None
Returns
tuple[float, float]
Values for r1 and r2 calculated from the given data are returned.
Raises
AnSecRadiusNotEnoughArgumentsError
If not enough parameters are given
AnSecRadiusTooManyArgumentsError
If too many parameters are given
AnSecRadiusIncorrectArgumentsError
If invalid combination of arguments is given

@staticmethod def interpret_theta(t1: float | None, t2: float | None, tmid: float | None, dt: float | None) -> tuple[float, float]:

Convert any valid combination of t1, t2, tmid, dt into t1 and t2.
Parameters
t1
Angle 1 or None
t2
Angle 2 or None
tmid
middle angle or None
dt
angle delta or None
Returns
tuple[float, float]
Values for Theta1 and Theta2 calculated from the given data are returned.
Raises
AnSecThetaNotEnoughArgumentsError
If not enough parameters are given
AnSecThetaTooManyArgumentsError
If too many parameters are given
AnSecThetaIncorrectArgumentsError
If invalid combination of arguments is given