[PD-cvs] externals/grill/py/scripts buffer.py,1.2,1.3 sig.py,1.2,1.3
Thomas Grill
xovo at users.sourceforge.net
Fri Mar 25 05:54:18 CET 2005
Update of /cvsroot/pure-data/externals/grill/py/scripts
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv7326/scripts
Modified Files:
buffer.py sig.py
Log Message:
fixes for maxmsp
added generic numpy support (not working)
Index: buffer.py
===================================================================
RCS file: /cvsroot/pure-data/externals/grill/py/scripts/buffer.py,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** buffer.py 10 Mar 2005 04:59:00 -0000 1.2
--- buffer.py 25 Mar 2005 04:54:16 -0000 1.3
***************
*** 8,14 ****
"""This is an example script for the py/pyext object's buffer support.
! PD/Max buffers can be mapped to numarray arrays.
! For numarray see http://numeric.scipy.org
! It will probably once be replaced by Numeric(3)
"""
--- 8,14 ----
"""This is an example script for the py/pyext object's buffer support.
! PD/Max buffers can be mapped to Python arrays.
! Currently, there are three implementations:
! Numeric, numarray and Numeric3 (for all of them see http://numeric.scipy.org)
"""
***************
*** 20,24 ****
print "ERROR: This script must be loaded by the PD/Max py/pyext external"
! try:
from numarray import *
except:
--- 20,24 ----
print "ERROR: This script must be loaded by the PD/Max py/pyext external"
! try:
from numarray import *
except:
***************
*** 32,36 ****
b = pyext.Buffer(args[2])
! # slicing causes numarrays (mapped to buffers) to be created
# note the c[:] - to assign contents you must assign to a slice of the buffer
c[:] = a[:]*b[:]
--- 32,36 ----
b = pyext.Buffer(args[2])
! # slicing causes Python arrays (mapped to buffers) to be created
# note the c[:] - to assign contents you must assign to a slice of the buffer
c[:] = a[:]*b[:]
***************
*** 42,47 ****
# this is also possible, but is probably slower
! # the + converts a into a numarray, the argument b is taken as a sequence
! # depending on the implementation in numarray this may be as fast
# as above or not
c[:] = a+b
--- 42,47 ----
# this is also possible, but is probably slower
! # the + converts a into a Python array, the argument b is taken as a sequence
! # depending on the implementation this may be as fast
# as above or not
c[:] = a+b
***************
*** 54,58 ****
def neg(target):
a = pyext.Buffer(target)
! # in place transformation (see numarray ufuncs)
negative(a[:],a[:])
# must mark buffer content as dirty to update graph
--- 54,58 ----
def neg(target):
a = pyext.Buffer(target)
! # in place transformation (see Python array ufuncs)
negative(a[:],a[:])
# must mark buffer content as dirty to update graph
Index: sig.py
===================================================================
RCS file: /cvsroot/pure-data/externals/grill/py/scripts/sig.py,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** sig.py 14 Mar 2005 04:58:12 -0000 1.2
--- sig.py 25 Mar 2005 04:54:16 -0000 1.3
***************
*** 49,54 ****
def _dsp(self):
! # cache vectors
! self.invec =self._invec(0)
self.outvec = self._outvec(0)
# initialize _signal method here for optimized version
--- 49,54 ----
def _dsp(self):
! # cache vectors in this scope
! self.invec = self._invec(0)
self.outvec = self._outvec(0)
# initialize _signal method here for optimized version
More information about the Pd-cvs
mailing list