Hi,

I am having a problem with some python code which runs perfectly in
straight python, bout fails inside sage, with the following error
message:



Traceback (click to the left for traceback)
...
TypeError: array cannot be safely cast to required type

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/fccoelho/.sage/sage_notebook/worksheets/admin/5/code/
8.py", line 7, in <module>
    d = lhs.lhs(stats.randint,(0,15),(10,10))''', '/home/
fccoelho/.sage/sage_notebook/worksheets/admin/5/cells/18')
  File "/home/fccoelho/Downloads/sage-3.4-linux-Ubuntu_8.10-i686-Linux/
local/lib/python2.5/site-packages/sage/server/support.py", line 353,
in syseval
    return system.eval(cmd, sage_globals, locals = sage_globals)
  File "/home/fccoelho/Downloads/sage-3.4-linux-Ubuntu_8.10-i686-Linux/
local/lib/python2.5/site-packages/sage/misc/python.py", line 56, in
eval
    eval(z, globals)
  File "/home/fccoelho/Downloads/sage-3.4-linux-Ubuntu_8.10-i686-Linux/
local/lib/python2.5/site-packages/SQLAlchemy-0.4.6-py2.5.egg/", line
1, in <module>

  File "/home/fccoelho/Downloads/sage-3.4-linux-Ubuntu_8.10-i686-Linux/
local/lib/python2.5/site-packages/BIP/Bayes/lhs.py", line 81, in lhs
    v = dist(*parms).ppf(smp)
  File "/home/fccoelho/Downloads/sage-3.4-linux-Ubuntu_8.10-i686-Linux/
local/lib/python2.5/site-packages/scipy/stats/distributions.py", line
112, in ppf
    return self.dist.ppf(q,*self.args,**self.kwds)
  File "/home/fccoelho/Downloads/sage-3.4-linux-Ubuntu_8.10-i686-Linux/
local/lib/python2.5/site-packages/scipy/stats/distributions.py", line
3604, in ppf
    place(output,cond,self._ppf(*goodargs) + loc)
  File "/home/fccoelho/Downloads/sage-3.4-linux-Ubuntu_8.10-i686-Linux/
local/lib/python2.5/site-packages/numpy/lib/function_base.py", line
1357, in place
    return _insert(arr, mask, vals)
TypeError: array cannot be safely cast to required type

the code snippet is:

from BIP.Bayes import lhs
d = lhs.lhs(stats.randint,(0,15),(10,10))

BIP is a package which is in PyPI and can be easy_installed. for this
test I installed it manually inside sage by copying the package
directory to sage's site-packages directory.

I running this code with preparser turned off: preparser(False)


--~--~---------~--~----~------------~-------~--~----~
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/sage-support
URLs: http://www.sagemath.org
-~----------~----~----~----~------~----~------~--~---

Reply via email to