prdtools.designer

class prdtools.designer.Designer(aspect_ratio_min: numbers.Number = 0.4, aspect_ratio_max: numbers.Number = 2.5)[source]

Bases: object

A utility to assist in choosing correct values for TableParameters

ncols: int

Current number of columns

nrows: int

Current number of rows

prime_num: int

Current prime number

aspect_ratio_min: numbers.Number

Minimum valid value for aspect_ratio

aspect_ratio_max: numbers.Number

Maximum valid value for aspect_ratio

property aspect_ratio: float

The aspect ratio of ncols and nrows

is_valid() bool[source]

Check whether the current values are valid

from_ncols(ncols: int) Iterable[prdtools.designer.DesignResult][source]

Find possible choices for nrows (and thus prime_num) with the given value for ncols

Iterates through all possible values for nrows that are valid using the constraints listed in is_valid(). For each valid result, a DesignResult is yielded.

from_prime_num(prime_num: int) Iterable[prdtools.designer.DesignResult][source]

Find possible choices for ncols and nrows for the given prime number

Iterates through all coprime pairs of prime_num - 1 that match the constraints listed in is_valid(). For each valid pair, a DesignResult is yielded.

class prdtools.designer.DesignResult(ncols: int, nrows: int, prime_num: int)[source]

Bases: object

Result from Designer

ncols: int

Number of columns

nrows: int

Number of rows

prime_num: int

Prime number

property aspect_ratio: float

The aspect ratio of ncols and nrows

get_primitive_roots() List[int][source]

Get all primitive roots of prime_num

choose_primitive_root() int[source]

Find the smallest primitive root of prime_num

Raises

ValueError – if no primitive roots exist

to_parameters(design_freq: int, prime_root: Optional[int] = None, well_width: Optional[float] = 3.81, speed_of_sound: Optional[int] = 343) prdtools.table.TableParameters[source]

Create a TableParameters instance using this result

All arguments of this method will be passed to the constructor (documented here). If prime_root is not given, a value will be chosen by choose_primitive_root()