tidy3d.ModeSortSpec#
- class ModeSortSpec[source]#
Bases:
Tidy3dBaseModelSpecification for filtering and sorting modes within each frequency.
- Parameters:
attrs (dict = {}) – Dictionary storing arbitrary metadata for a Tidy3D object. This dictionary can be freely used by the user for storing data without affecting the operation of Tidy3D as it is not used internally. Note that, unlike regular Tidy3D fields,
attrsare mutable. For example, the following is allowed for setting anattrobj.attrs['foo'] = bar. Also note that Tidy3D will raise aTypeErrorifattrscontain objects that can not be serialized. One can check ifattrsare serializable by callingobj.json().filter_key (Optional[Literal['n_eff', 'k_eff', 'TE_fraction', 'TM_fraction', 'wg_TE_fraction', 'wg_TM_fraction', 'mode_area']] = None) – Quantity used to filter modes into two groups before sorting.
filter_reference (float = 0.0) – Reference value used in the filtering stage.
filter_order (Literal['over', 'under'] = over) – Select whether the first group contains values over or under the reference.
sort_key (Optional[Literal['n_eff', 'k_eff', 'TE_fraction', 'TM_fraction', 'wg_TE_fraction', 'wg_TM_fraction', 'mode_area']] = None) – Quantity used to sort modes within each filtered group. If
None, sorting is by descending effective index.sort_reference (Optional[float] = None) – If provided, sorting is based on the absolute difference to this reference value.
sort_order (Literal['ascending', 'descending'] = ascending) – Sort order for the selected key or difference to reference value.
track_freq (Optional[Literal['central', 'lowest', 'highest']] = central) – If provided, enables cross-frequency mode tracking. Can be ‘lowest’, ‘central’, or ‘highest’, which refers to the frequency index in the list of frequencies. The mode sorting would then be exact at the specified frequency, while at other frequencies it can change depending on the mode tracking.
Notes
First, an optional filtering step splits the modes into two groups based on a threshold applied to
filter_key: modes “over” or “under”filter_referenceare placed first, with the remaining modes placed next. Second, an optional sorting step orders modes within each group according tosort_key, optionally with respect tosort_referenceand in the specifiedsort_order.Attributes
Methods
Inherited Common Usage
- filter_key#
- filter_reference#
- filter_order#
- sort_key#
- sort_reference#
- sort_order#
- track_freq#
- __hash__()#
Hash method.