[SciPy-user] Serializing LSQUnivariateSpline?

Robert Kern robert.kern@gmail....
Mon Jun 15 15:54:36 CDT 2009


On Mon, Jun 15, 2009 at 15:48, David Warde-Farley<dwf@cs.toronto.edu> wrote:
> I have a bit of a dilemma: I like the LSQUnivariateSpline wrapper, but
> I need to serialize the fitted splines, and be able to reconstruct
> them.  (I'm using pytables as a backend, by the way).
>
> (t,c,k) pairs are slightly easier to work with in this respect but
> less descriptive and less elegant when actually using them.
>
> The pickled description of even a simple one of these objects leans
> towards three kiliobytes, and I'm going to be working with a lot of
> them. I'm thinking of going with an HDF5 table of all the contents of
> _data as I think I  can get an okay read of what sizes and types are
> required, but what about deserializing? Is there some obvious way I'm
> missing?

def deserialize(data):
    self = LSQUnivariateSpline.__new__(LSQUnivariateSpline)
    self._data = data
    self._reset_class()
    return self

-- 
Robert Kern

"I have come to believe that the whole world is an enigma, a harmless
enigma that is made terrible by our own mad attempt to interpret it as
though it had an underlying truth."
  -- Umberto Eco


More information about the SciPy-user mailing list