[SciPy-user] c2d

Rob Clewley rhc28 at cornell.edu
Fri Jan 19 16:45:00 EST 2007


Hi Ryan,

I don't think there is, but PyDSTool has such a function, after a
similar question was asked on this list last year (see
http://projects.scipy.org/pipermail/scipy-user/2006-March/007327.html).
The code adapts the interp1d class that's been in Scipy for a while
(you could just dig out my interp0d class).

You can see an example in PyDSTool/Tests/interp_pcwc.py, which
contains code like

timeData = linspace(0, 10, 30)
sindata = sin(timeData)
xData = makeDataDict(['sinx'], [sindata])  # a PyDSTool util to "zip"
names and arrays
pcwc_interp = InterpolateTable({
                            'tdata': timeData,
                            'ics': xData,
                            'name': 'interp0d',
                            'method': 'constant',
                            }).compute('interp')

x = linspace(0,10,300)
plot(x, pcwc_interp(x, ['sinx']))
plot(x, sin(x))


I've attached the output as a JPG graphic. I hope this helps.
Rob
-------------- next part --------------
A non-text attachment was scrubbed...
Name: pydstool_sin_c2d_example.jpg
Type: image/jpeg
Size: 24163 bytes
Desc: not available
URL: <http://mail.scipy.org/pipermail/scipy-user/attachments/20070119/2ce86ba3/attachment.jpg>


More information about the SciPy-User mailing list