def __init__(self, order=2, legacy=True, module="numexpr", **kwargs): """Polynomial component (DEPRECATED) This API is deprecated and will be replaced by :py:class:`hyperspy._components.polynomial.Polynomial` in HyperSpy v2.0. To use the new API, set `legacy` to `False`. Parameters ---------- order: int Order of the polynomial. legacy: bool, default True If `False`, use the new API. module: str See the docstring of :py:class:`hyperspy._components.polynomial.Polynomial` for details. """ if legacy: from hyperspy.misc.utils import deprecation_warning msg = ( "The API of the `Polynomial` component will change in v2.0." "To use the new API set `legacy=False`.") deprecation_warning(msg) Component.__init__(self, ['coefficients', ]) self._whitelist['order'] = ('init', order) self.coefficients._number_of_elements = order + 1 self.coefficients.value = np.zeros((order + 1,)) self.coefficients.grad = self.grad_coefficients else: from hyperspy._components.polynomial import Polynomial self.__class__ = Polynomial self.__init__(order=order, module=module, **kwargs)
def __init__(self, minimum_at_zero=False, **kwargs): if minimum_at_zero: from hyperspy.misc.utils import deprecation_warning msg = ("The API of the `Arctan` component will change in v2.0. " "This component will become `EELSArctan`." "To use the new API, omit the `minimum_at_zero` option.") deprecation_warning(msg) self.__class__ = EELSArctan self.__init__(**kwargs) else: from hyperspy._components.arctan import Arctan self.__class__ = Arctan self.__init__(**kwargs)
def __init__(self, legacy=True, **kwargs): self.legacy = legacy if legacy: from hyperspy.misc.utils import deprecation_warning msg = ("The API of the `Voigt` component will change in v2.0. " "This component will become `PESVoigt`. " "To use the new API set `legacy=False`.") deprecation_warning(msg) self.__class__ = PESVoigt self.__init__(**kwargs) else: from hyperspy._components.voigt import Voigt self.__class__ = Voigt self.__init__(**kwargs)
def __init__(self, order=2, legacy=True, module="numexpr", **kwargs): if legacy: from hyperspy.misc.utils import deprecation_warning msg = ("The API of the `Polynomial` component will change in v2.0." "To use the new API set `legacy=False`.") deprecation_warning(msg) Component.__init__(self, [ 'coefficients', ]) self._whitelist['order'] = ('init', order) self.coefficients._number_of_elements = order + 1 self.coefficients.value = np.zeros((order + 1, )) self.coefficients.grad = self.grad_coefficients else: from hyperspy._components.polynomial import Polynomial self.__class__ = Polynomial self.__init__(order=order, module=module, **kwargs)