Closed goldingn closed 9 years ago
@goldingn However, I assume that the predict(flux) method still should internally ensure that the generated movement_matrix is of the correct class type (that is, it inherits from the 'movement_matrix' class and the 'matrix class'?
Hmmm... thinking about this a bit more, I think you're right that the output should have class movement_matrix
. So the integer enforcement should just be done in movement()
. Feel free to rename this issue!
It may (or may not) be helpful to add an attribute to the class signifying whether it is an 'observed' (i.e. integer) movement matrix or not. I guess that would only be to save checking that it is integer.
Just to recap: the movement() method, using an observed movement_matrix, required integer values within the matrix. However, the predict methods, for flux or movement_models, can generate matrices with non-integer values. Therefore, move the the rounding to integer values (with the creation of a warning) from the as.movement_model functions into the movement() method.
yes, exactly!
Task completed after merging the code.
Running the example for
movement
, the step predicting form a flux model issues the following warning:Whilst we want integer predictions in this cases, in general, predictions from a
flux
ormovement_model
object should not be coerced to integer. The following should therefore work and not issue any warnings (note changes to object names):