Measurement model inverse functions aren't vectorised
Unlike function on the measurement models, the inverse_function on many/all models isn't vectorised, and limits its use in some places.
I just had a look through all the nonlinear measurement models and it looks like all of the reversible models are vectorized. Did you have anything else in mind? Everything beyond nonlinear does not appear to have an inverse_function.
Hi @ajland. So thought was more on the inverse_function. For example:
https://github.com/dstl/Stone-Soup/blob/a890a748f937112c7c6cd827492b0b55a1d9ca6d/stonesoup/models/measurement/nonlinear.py#L289-L300
I think this need to be changed to something like this (not tested):
def inverse_function(self, detection, **kwargs) -> StateVector:
theta, phi, rho = detection.state_vector[0, :], detection.state_vector[1, :], detection.state_vector[2, :]
xyz = StateVector(sphere2cart(rho, phi, theta))
inv_rotation_matrix = inv(self.rotation_matrix)
xyz = inv_rotation_matrix @ xyz
res = np.zeros((self.ndim_state, detection.state_vector.shape[1])).view(StateVector)
res[self.mapping, :] = xyz + self.translation_offset
return res
@sdhiscocks oh I see, so accommodating StateVectors instead of just a single StateVector. Thanks for the clarification!