-
- Downloads
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.
Showing
- src/pypfilt/config.py 4 additions, 6 deletionssrc/pypfilt/config.py
- src/pypfilt/context.py 0 additions, 3 deletionssrc/pypfilt/context.py
- src/pypfilt/examples/predation.py 39 additions, 33 deletionssrc/pypfilt/examples/predation.py
- src/pypfilt/model.py 27 additions, 14 deletionssrc/pypfilt/model.py
- src/pypfilt/params.py 4 additions, 3 deletionssrc/pypfilt/params.py
- src/pypfilt/resample.py 36 additions, 16 deletionssrc/pypfilt/resample.py
- src/pypfilt/state.py 12 additions, 7 deletionssrc/pypfilt/state.py
- src/pypfilt/summary.py 20 additions, 24 deletionssrc/pypfilt/summary.py
Loading
Please register or sign in to comment