tBuLi / symfit

Symbolic Fitting; fitting as it should be.
http://symfit.readthedocs.org
MIT License
233 stars 17 forks source link

Replace variabletuple by an object ModelOutput. #278

Closed tBuLi closed 4 years ago

tBuLi commented 4 years ago

A PR to solve #267 by removing the variabletuple and replacing it with an object ModelOutput, which has the same API.

So far this seems to work almost everywhere, except that numpy's assert_almost_equal does not like these objects, despite the fact that they are iterable and therefore I don't see why this is different from the old tuple subclass.

tBuLi commented 4 years ago

It is probably lines like this in the numpy.assert_almost_equal code which cause this:

isinstance(actual, (ndarray, tuple, list))

Therefore, we should somehow fake being one of those, but inheriting from collections.Sequence is not strong enough to trick this line.

tBuLi commented 4 years ago

Yes, self.keys() already comes from an OrderedDict. And in the docstring of ModelOutput it is specified that identical ordering is assumed, in case of later use. I did not want to make it initiate from an ordereddict though, because I noticed that looked more clumsy.