Using SciPy in application

Discussion in 'Python' started by Roozbeh, Apr 24, 2013.

  1. Roozbeh

    Roozbeh Guest

    Hi all,

    I want to use spline interpolation function from SciPy in an application and at the same time, I don't want the end user to have to install SciPy separately. Is there a way around this problem?

    Thanks in advance for your help
    Roozbeh, Apr 24, 2013
    #1
    1. Advertising

  2. On 24 April 2013 10:13, Roozbeh <> wrote:
    >
    > I want to use spline interpolation function from SciPy in an application and at the same time, I don't want the end user to have to install SciPy separately. Is there a way around this problem?


    They cannot use the function from scipy if scipy is not installed.
    There are three ways round this problem:
    1) Rewrite the interpolation function you need in your own code.
    2) Require the user to install scipy.
    3) Require the user to install some other package that has
    interpolation functions.

    Rewriting the interpolation function is probably not that difficult
    depending on the type of interpolation you're using.


    Oscar
    Oscar Benjamin, Apr 24, 2013
    #2
    1. Advertising

  3. Roozbeh

    Robert Kern Guest

    On 2013-04-24 16:34, Oscar Benjamin wrote:
    > On 24 April 2013 10:13, Roozbeh <> wrote:
    >>
    >> I want to use spline interpolation function from SciPy in an application and at the same time, I don't want the end user to have to install SciPy separately. Is there a way around this problem?

    >
    > They cannot use the function from scipy if scipy is not installed.
    > There are three ways round this problem:
    > 1) Rewrite the interpolation function you need in your own code.


    Variant:

    1.a) Copy the interpolation code from scipy into your own code.

    --
    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
    Robert Kern, Apr 24, 2013
    #3
  4. Roozbeh

    Roozbeh Guest

    On Wednesday, April 24, 2013 11:13:45 AM UTC+2, Roozbeh wrote: > Hi all, I want to use spline interpolation function from SciPy in an application and at the same time, I don't want the end user to have to install SciPy separately. Is there a way around this problem? Thanks in advance for your help
    Roozbeh, Apr 24, 2013
    #4
  5. Roozbeh

    Roozbeh Guest

    On Wednesday, April 24, 2013 11:13:45 AM UTC+2, Roozbeh wrote:
    > Hi all, I want to use spline interpolation function from SciPy in an application and at the same time, I don't want the end user to have to install SciPy separately. Is there a way around this problem? Thanks in advance for your help


    The thing is that the SciPy code for spline interpolation imports NumPy which also I don't want to use. So, I think I will have to write the code myself I guess.
    Roozbeh, Apr 24, 2013
    #5
  6. Roozbeh

    Roozbeh Guest

    On Wednesday, April 24, 2013 11:13:45 AM UTC+2, Roozbeh wrote:
    > Hi all, I want to use spline interpolation function from SciPy in an application and at the same time, I don't want the end user to have to install SciPy separately. Is there a way around this problem? Thanks in advance for your help


    Any idea where can I find the recipe for the spline interpolation that does not rely on NumPy and/or SciPy and is written pure Python (no C code)?
    Roozbeh, Apr 24, 2013
    #6
  7. Roozbeh

    Robert Kern Guest

    On 2013-04-24 17:04, Roozbeh wrote:
    > On Wednesday, April 24, 2013 11:13:45 AM UTC+2, Roozbeh wrote:
    >> Hi all, I want to use spline interpolation function from SciPy in an application and at the same time, I don't want the end user to have to install SciPy separately. Is there a way around this problem? Thanks in advance for your help

    >
    > Any idea where can I find the recipe for the spline interpolation that does not rely on NumPy and/or SciPy and is written pure Python (no C code)?


    If Google can't find it, it probably doesn't exist. Very few people would do
    this without numpy.

    --
    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
    Robert Kern, Apr 24, 2013
    #7
  8. On Wed, 24 Apr 2013 04:34:44 -0700, Roozbeh wrote:

    The scipy interpolation routines (splev, splrep, etc.) are on netlib:

    http://www.netlib.org/dierckx/

    This gives you FORTRAN source codes which you will have to compile
    yourself to either a DLL or an SO. Call them from python using ctypes.

    I have done that for a number of the dierckx routines. No problems at all.

    Hope this helps,
    Alex van der Spek



    > On Wednesday, April 24, 2013 11:13:45 AM UTC+2, Roozbeh wrote:
    >> Hi all, I want to use spline interpolation function from SciPy in an
    >> application and at the same time, I don't want the end user to have to
    >> install SciPy separately. Is there a way around this problem? Thanks in
    >> advance for your help

    >
    > Any idea where can I find the recipe for the spline interpolation that
    > does not rely on NumPy and/or SciPy and is written pure Python (no C
    > code)?
    Alex van der Spek, Apr 24, 2013
    #8
  9. Roozbeh

    Miki Tebeka Guest

    > I want to use spline interpolation function from SciPy in an application and at the same time, I don't want the end user to have to install SciPy separately.
    You can pack you application with py2exe, pyinstaller ... and then they won't even need to install Python.

    Another option (which is not always possible) is to make you application a web site and then only you need to install SciPy on the server.
    Miki Tebeka, Apr 24, 2013
    #9
  10. Roozbeh

    Roozbeh Guest

    On Wednesday, April 24, 2013 3:52:50 PM UTC+2, Miki Tebeka wrote:
    > > I want to use spline interpolation function from SciPy in an application and at the same time, I don't want the end user to have to install SciPy separately. You can pack you application with py2exe, pyinstaller ... and then they won't even need to install Python. Another option (which is not always possible) is to make you application a web site and then only you needto install SciPy on the server.



    I thought about the py2exe option but the problem is, this application is aplug-in written for Abaqus CAE and hence it will use the python version that comes with Abaqus CAE distribution and Abaqus must be able to compile the Python codes every time on the start-up otherwise it won't recognize the plug-in and thats why SciPy and NumPy are also not an option.
    I guess as Alex said, I will have to use DLLs or write it myself.
    Roozbeh, Apr 24, 2013
    #10
  11. Roozbeh

    Maarten Guest

    On Wednesday, April 24, 2013 1:40:14 PM UTC+2, Robert Kern wrote:
    > On 2013-04-24 17:04, Roozbeh wrote:
    >
    > > On Wednesday, April 24, 2013 11:13:45 AM UTC+2, Roozbeh wrote:

    >
    > >> Hi all, I want to use spline interpolation function from SciPy in an application and at the same time, I don't want the end user to have to install SciPy separately. Is there a way around this problem? Thanks in advance for your help

    >
    > > Any idea where can I find the recipe for the spline interpolation that does not rely on NumPy and/or SciPy and is written pure Python (no C code)?

    >
    >
    > If Google can't find it, it probably doesn't exist. Very few people would do this without numpy.


    A trivial 'pure python spline' google search yields this:
    http://urchin.earth.li/~twic/splines.py

    (Warning: old code, python 2.2 era).

    Maarten
    Maarten, Apr 24, 2013
    #11
  12. On 2013-04-24, Roozbeh <> wrote:

    > I want to use spline interpolation function from SciPy in an
    > application and at the same time, I don't want the end user to have
    > to install SciPy separately. Is there a way around this problem?


    You could bundle you app along with python and SciPy and whatever
    other libraries are required using py2exe, py2app, cx_Freeze, Freeze,
    etc.

    --
    Grant Edwards grant.b.edwards Yow! JAPAN is a WONDERFUL
    at planet -- I wonder if we'll
    gmail.com ever reach their level of
    COMPARATIVE SHOPPING ...
    Grant Edwards, Apr 24, 2013
    #12
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Paxcal
    Replies:
    0
    Views:
    1,825
    Paxcal
    Feb 11, 2004
  2. Replies:
    1
    Views:
    334
    Robert Kern
    May 11, 2006
  3. Replies:
    2
    Views:
    424
    sturlamolden
    Jan 7, 2007
  4. vml
    Replies:
    3
    Views:
    678
  5. Christopher Barrington-Leigh

    scipy / stats : quantiles using sample weights from survey data

    Christopher Barrington-Leigh, Aug 4, 2010, in forum: Python
    Replies:
    1
    Views:
    392
Loading...

Share This Page