Skip to content
Snippets Groups Projects
Commit 60bc49d0 authored by Rob Moss's avatar Rob Moss
Browse files

Use structured model state vectors

We now use nested data types to explicitly describe the state vector
structure and to avoid using magic numbers to select specific columns.

This makes the following changes the Model base class:

* Remove Model.describe() and Model.state_size();
* Add Model.state_fields();
* Add Model.bounds(); and
* Add Model.can_smooth().

Because subsets of structured arrays cannot necessarily be treated as
normal Numpy arrays, post_regularise() and ParamCovar.add_rows() must
now repack the relevant state vector columns into new arrays and then
use a non-structured view of this new array:

    x = numpy.lib.recfunctions.repack_fields(state_vec[names])
    x = x.view((float, len(names)))

This functionality is now provided by pypfilt.state.repack().

Note that this requires that each field is a scalar float value. It is
unlikely that this restriction can be lifted.
parent f4c05cfd
No related branches found
No related tags found
No related merge requests found
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment