Base classes and other methods#
- class lnpy.extensions.AccessorMixin[source]#
Bases:
objectMixin for accessor.
Methods:
register_accessor(name, accessor[, ...])Register a property name to class of type accessor(self)
decorate_accessor(name[, single_create])Register a property name to class of type accessor(self).
- classmethod register_accessor(name, accessor, single_create=False)[source]#
Register a property name to class of type accessor(self)
Examples
>>> class parent(AccessorMixin): ... pass >>> class hello(AccessorMixin): ... def __init__(self, parent): ... self._parent = parent ... ... def there(self): ... return f"{type(self._parent)}"
>>> parent.register_accessor("hello", hello) >>> x = parent() >>> x.hello.there() "<class 'lnpy.extensions.parent'>"
- classmethod decorate_accessor(name, single_create=False)[source]#
Register a property name to class of type accessor(self).
Examples
>>> class parent(AccessorMixin): ... pass
>>> @parent.decorate_accessor("hello") ... class hello(AccessorMixin): ... def __init__(self, parent): ... self._parent = parent ... ... def there(self): ... return f"{type(self._parent)}"
>>> x = parent() >>> x.hello.there() "<class 'lnpy.extensions.parent'>"
- class lnpy.core._attrs_utils.MyAttrsMixin[source]#
Bases:
objectBaseclass for adding some sugar to attrs.derived classes.
Methods:
asdict()Convert object to dictionary.
new_like(**kws)Create a new object with optional parameters.
assign(**kws)Alias to
new_like().- new_like(**kws)[source]#
Create a new object with optional parameters.
- Parameters:
**kws – attribute, value pairs.
- assign(**kws)[source]#
Alias to
new_like().
Typing definitions for lnpy#
Data:
Interpolation methods |
|
Convention for boolean masks. |
|
Alias for simple |
|
Signature for phases_factory function. |
|
Signature for tag_phases function. |
- lnpy.core.typing.InterpolationMethods(*args, **kwargs)#
Interpolation methods
alias of
Literal[‘akima’, ‘barycentric’, ‘cubic’, ‘krogh’, ‘linear’, ‘makima’, ‘nearest’, ‘pchip’, ‘polynomial’, ‘quadratic’, ‘quintic’, ‘slinear’, ‘spline’, ‘zero’]
- lnpy.core.typing.MaskConvention(*args, **kwargs)#
Convention for boolean masks.
- lnpy.core.typing.NDArrayAny(*args, **kwargs)#
Alias for simple
numpy.typing.NDArray[Any]