Trajectory Solution Data (trajectory_solution_data)¶
- class pypint.solutions.data_storage.trajectory_solution_data.TrajectorySolutionData[source]¶
Bases: builtins.object
Storage for a transient trajectory of solutions.
Basically, this is nothing more than an array of StepSolutionData objects and a couple of utility functions for easy data access and consistency checks.
This class provides a selected subset of Python’s mutable sequence datatype methods:
- __len__()
- Returns the number of StepSolutionData objects stored in this instance.
- __gettiem__()
- Takes the 0-based index of the StepSolutionData object to query.
- __setitem__()
- Takes a float representing the time point and a numpy.ndarray as the rvalue. Same as .add_solution_data(value=<rvalue>, time_point=<time_point>).
- __iter__()
- Gives an iterator over the stored StepSolutionData objects (proxies numpy.ndarray.__iter__()).
- __contains__()
- Finds the given StepSolutionData object in this sequence.
- _check_consistency()[source]¶
Checks for consistency of spacial dimension and numeric type of stored steps.
Raises: ValueError –
- if the numeric type of at least one step does not match numeric_type
- if the spacial dimension of at least one step does not match dim
- add_solution_data(*args, **kwargs)[source]¶
Appends solution of a new time point to the trajectory.
Parameters: - step_data (StepSolutionData) – (optional) In case a single unnamed argument is given, this is required to be an instance of StepSolutionData. If no named argument is given, the following two parameters are not optional.
- values (numpy.ndarray) – (optional) Solution values. Passed on to constructor of StepSolutionData.
- time_point (float) – (optional) Time point of the solution. Passed on to constructor of StepSolutionData.
Raises: ValueError –
- if construction of StepSolutionData fails
- if internal consistency check fails (see _check_consistency())
- append(p_object)[source]¶
See also
add_solution_data() : with one unnamed parameter
- finalize()[source]¶
Locks this storage data instance.
Raises: ValueError – If it has already been locked.
- __weakref__¶
list of weak references to the object (if defined)
- data[source]¶
Read-only accessor for the stored solution objects.
Returns: data Return type: numpy.ndarray of StepSolutionData
- errors[source]¶
Accessor for the errors of stored solution data.
Returns: error Return type: numpy.ndarray of Error
- finalized[source]¶
Accessor for the lock state.
Returns: finilized – True if it has been finalized before, False otherwise Return type: bool
- residuals[source]¶
Accessor for the residuals of stored solution data.
Returns: error Return type: numpy.ndarray of Residual