threshold module

Define an object to hold a single multipactor threshold.

Also define a place-holder to mark when a minimum or maximum of threshold was reached.

THRESHOLD_FILTER_T

Function taking in a Threshold, and returning a boolean.

alias of Callable[[Threshold], bool]

class ThresholdFilter(*args, **kwargs)[source]

Bases: Protocol

Function taking in a Threshold, and returning a boolean.

This resolves, in contrary to classic:

THRESHOLD_FILTER_T = Callable[["Threshold"], bool]
_abc_impl = <_abc._abc_data object at 0x7fe5d13c6300>
_is_protocol = True
_is_runtime_protocol = False
class Threshold(sample_index, nature, way, detecting_instrument, position, color=(1.0, 1.0, 1.0))[source]

Bases: object

Holds a single multipactor threshold.

Todo

Handle isolated mp zones? Characterized by two Threshold objects at same position, same indexes. One is upper, other is lower. One is enter, other is exit

Parameters:
sample_index: int

At which sample index the threshold was detected.

nature: Literal['upper', 'lower']

If the threshold is a lower threshold or an upper threshold.

way: Literal['enter', 'exit']

If the threshold was measured during an entry or an exit of the multipator band

detecting_instrument: str | Literal['any', 'all']

Name of the instrument that detected this threshold.

position: float

Position of the object that detected this threshold.

color: tuple[float, float, float] = (1.0, 1.0, 1.0)

Color of the Instrument that detected this threshold.

property is_global: bool

Tell if threshold is global by checking if position is nan.

create_thresholds(multipactor, growth_array, detecting_instrument, position, threshold_predicate=None, color=None)[source]

Create threshold objects corresponding to a single detecting instrument.

Parameters:
  • multipactor (ndarray[tuple[Any, ...], dtype[bool]]) – Array where True means multipactor and False no multipactor, according to detecting_instrument.

  • growth_array (ndarray[tuple[Any, ...], dtype[double]]) – Holds 1.0 where power grows, -1.0 where it decreases, and 0.0 at transition points. Used to determine threshold nature (lower/upper).

  • detecting_instrument (str | Literal['any', 'all']) – Name of Instrument that created the multipactor array.

  • position (float) – Position of Instrument that created the multipactor array.

  • threshold_predicate (ThresholdFilter | None, default: None) – Function filtering the created thresholds.

  • color (tuple[float, float, float] | None, default: None) – Color of the detecting instrument.

Returns:

All multipactor thresholds detected by the Instrument named detecting_instrument, filtered by predicate.

Return type:

list[Threshold]

class PowerExtremum(sample_index, nature)[source]

Bases: object

Place-holder for reaching a minimum or maximum of power.

Parameters:
  • sample_index (int)

  • nature (Literal['minimum', 'maximum'])

sample_index: int

At which sample index the power reached an extremum

nature: Literal['minimum', 'maximum']

If the extremum is mini/maxi

create_power_extrema(growth_array)[source]

Create power extrema.

Parameters:

growth_array (ndarray[tuple[Any, ...], dtype[double]]) – Holds 1.0 where it grows, -1.0 where it decreases, and 0.0 where it changes. We use the position of those np.nan to determine power extrema.

Return type:

list[PowerExtremum]