Designer

class fird.designer.FIRDesigner(filter_order: int, objective: Objective, constraints: Constraint | Sequence[Constraint] | None = None, *, fractional_bits: int | None = None, even_symmetry: bool = True, cascade_filter: Buffer | _SupportsArray[dtype[Any]] | _NestedSequence[_SupportsArray[dtype[Any]]] | complex | bytes | str | _NestedSequence[complex | bytes | str] | None = None, period: int = 1, bigM: float = 100)

Bases: object

Base class for designing FIR filters.

Parameters:
filter_orderint

Order of the filter to be designed.

objectiveObjective

The objective function to optimize for.

constraintsConstraint or sequence of Objective, optional

The constraints to consider during optimization.

fractional_bitsint, optional

Number of fractional bits for fixed-point coefficients. If not provided, continuous (floating-point) coefficients are used.

even_symmetrybool, default: True

If the filter to be designed is of odd or even symmetry.

cascade_filter1D array, optional

The optional filter in cascade with the designed.

periodint, default: 1

The period of the designed filter in relation to the specification.

bigMfloat, default: 100

The big-M value to use for Linf constraints. An estimate of the maximum absolute coefficient value expected. Smaller values gives tighter constraints and faster solving times, but may lead to worse approximations if set too small.

get_impulse_response(apytypes: bool = False) ndarray[tuple[Any, ...], dtype[float64]] | APyFixedArray

Return the impulse response of the optimized FIR filter.

Parameters:
apytypesbool, default: False

If True, return the impulse response as an APyTypes array.

property objective_value: float

The objective value of the optimized problem.

solve(solver: LpSolver | None = None) None

Optimize FIR filter using solver.

Parameters:
solverLpSolver, optional

The solver to use. To see which solvers are available:

import pulp

print(pulp.listSolvers(onlyAvailable=True))