Integrator Base (integrator_base)¶
- class pypint.integrators.integrator_base.IntegratorBase[source]¶
Bases: builtins.object
Basic and generic integrator for variable nodes and weights.
- evaluate(data, **kwargs)[source]¶
Applies this integrator to given data in specified time interval.
Parameters: - data (numpy.ndarray) – Data vector of the values at given time points. Its length must equal the number of integration nodes.
- time_start (float) – (optional) Begining of the time interval to integrate over.
- time_end (float) – (optional) End of the time interval to integrate over.
Raises: ValueError –
- if data is not a numpy.ndarray
- if either time_start or time_end are not given
- if time_start is larger or equals time_end
- init(nodes_type, num_nodes, weights_function, interval=None)[source]¶
Initializes the integrator with given nodes and weights function.
Before setting the given attributes, a consistency check is carried out testing for the correct types. INodes.init() is called on the provided nodes object. IWeightFunction.evaluate() is called on the provided weight function object.
Parameters: - nodes_type (INodes) – Type of integration nodes as the class name not instance.
- num_nodes (int) – Number of integration nodes
- weights_function (IWeightFunction or dict) – Weight function for the integration nodes. If it is a dictionary, it must have a class field with the IWeightFunction as the value. Further fields are used as parameters to IWeightFunction.init. In both cases the weight function class must be given as a name not instance.
Raises: ValueError – If the type of one of the given arguments does not match.
nodes_type must be a subclass of INodes
num_nodes must be an int
weights_function must be a subclass of IWeightFunction or dict
- if weights_function is a dictionary, its field class must be an IWeightFunction.
Examples
>>> from pypint.integrators import INTEGRATOR_PRESETS >>> integrator = IntegratorBase() >>> # create classic Gauss-Lobatto integrator with 4 integration nodes >>> options = INTEGRATOR_PRESETS['Gauss-Lobatto'] >>> options['num_nodes'] = 4 >>> integrator.init(**options)
- transform_interval(interval)[source]¶
Transform current interval to the given one
The integration nodes are transformed to fit the given interval and subsequently the weights are recomputed to match the new nodes.
See also
INodes.transform() : method called for node transformation
- __weakref__¶
list of weak references to the object (if defined)
- weights_function[source]¶
Read-only accessor for the weights function
Returns: weights_function Return type: IWeightFunction