pmrf.fitting.BaseFitter
- class pmrf.fitting.BaseFitter(model, measured, frequency=None, features=None)[source]
Bases:
ABC
An abstract base class that provides the foundation for all fitting algorithms in pmrf.
Initializes the BaseFitter.
- Args:
model (Model): The parametric pmrf model to be fitted. measured (str | skrf.Network | dict[str, skrf.Network]): The measured network data to fit the model against.
A dict can optionally be passed, in which case the keys of the networks must can be referenced during feature extraction by also specifying features as a dictionary. See the documentation for the features argument below.
- frequency (Frequency | None, optional): The frequency axis to perform the fit on. If None, the frequency
from the first measured network is used. All networks will be interpolated onto this single frequency axis. Defaults to None.
- features (FeatureInputT | None, optional): Defines the features to be extracted from the network data and model for fitting.
See extract_features(..) for a detail explanation. As an overview using string aliases, this can be a single feature e.g. ‘s11’, a list of features (e.g., [‘s11’, ‘s11_mag’]), or a dictionary with either of the above as value. In the dictionary case, keys must be network names in the sequence passed by measured, which must also correspond to submodels which are attributes of the model. As an example, {‘source_name1’, (‘s11’), {‘source_name2’, (‘s21’)} can be passed. Note that if a sequence of networks is passed, but a dictionary is not. it is assumed that those feature(s) should be extract for all measured networks/submodels. Defaults to None, in which case real and imaginary features for all ports are used.
- Parameters:
model (Model)
measured (Network | dict[str, Network])
frequency (Frequency | None)
features (str | tuple[str, str] | tuple[str, str, tuple[int, int]] | Sequence[str | tuple[str, str] | tuple[str, str, tuple[int, int]]] | dict[str, str | tuple[str, str] | tuple[str, str, tuple[int, int]] | Sequence[str | tuple[str, str] | tuple[str, str, tuple[int, int]]]] | None)
- __init__(model, measured, frequency=None, features=None)[source]
Initializes the BaseFitter.
- Args:
model (Model): The parametric pmrf model to be fitted. measured (str | skrf.Network | dict[str, skrf.Network]): The measured network data to fit the model against.
A dict can optionally be passed, in which case the keys of the networks must can be referenced during feature extraction by also specifying features as a dictionary. See the documentation for the features argument below.
- frequency (Frequency | None, optional): The frequency axis to perform the fit on. If None, the frequency
from the first measured network is used. All networks will be interpolated onto this single frequency axis. Defaults to None.
- features (FeatureInputT | None, optional): Defines the features to be extracted from the network data and model for fitting.
See extract_features(..) for a detail explanation. As an overview using string aliases, this can be a single feature e.g. ‘s11’, a list of features (e.g., [‘s11’, ‘s11_mag’]), or a dictionary with either of the above as value. In the dictionary case, keys must be network names in the sequence passed by measured, which must also correspond to submodels which are attributes of the model. As an example, {‘source_name1’, (‘s11’), {‘source_name2’, (‘s21’)} can be passed. Note that if a sequence of networks is passed, but a dictionary is not. it is assumed that those feature(s) should be extract for all measured networks/submodels. Defaults to None, in which case real and imaginary features for all ports are used.
- Parameters:
model (Model)
measured (str | Network | dict[str, Network])
frequency (Frequency | None)
features (str | tuple[str, str] | tuple[str, str, tuple[int, int]] | Sequence[str | tuple[str, str] | tuple[str, str, tuple[int, int]]] | dict[str, str | tuple[str, str] | tuple[str, str, tuple[int, int]] | Sequence[str | tuple[str, str] | tuple[str, str, tuple[int, int]]]] | None)
- Return type:
None
Methods
__delattr__
(name, /)Implement delattr(self, name).
__dir__
()Default dir() implementation.
__eq__
(value, /)Return self==value.
__format__
(format_spec, /)Default object formatter.
__ge__
(value, /)Return self>=value.
__getattribute__
(name, /)Return getattr(self, name).
__getstate__
()Helper for pickle.
__gt__
(value, /)Return self>value.
__hash__
()Return hash(self).
__init__
(model, measured[, frequency, features])Initializes the BaseFitter.
__init_subclass__
This method is called when a class is subclassed.
__le__
(value, /)Return self<=value.
__lt__
(value, /)Return self<value.
__ne__
(value, /)Return self!=value.
__new__
(*args, **kwargs)__reduce__
()Helper for pickle.
__reduce_ex__
(protocol, /)Helper for pickle.
__repr__
()Return repr(self).
__setattr__
(name, value, /)Implement setattr(self, name, value).
__sizeof__
()Size of object in memory, in bytes.
__str__
()Return str(self).
__subclasshook__
Abstract classes can override this to customize issubclass().
_make_feature_function
([as_numpy])_settings
([solver_kwargs, fitter_kwargs])run
(*args, **kwargs)Executes the fitting algorithm.
Attributes
__abstractmethods__
__annotations__
__dict__
__doc__
__module__
__slots__
__weakref__
list of weak references to the object
_abc_impl
- measured: Network | dict[str, Network]