[BangPypers] array in python
jeff at taupro.com
Thu Oct 8 09:56:01 CEST 2009
Vivek Khurana wrote:
> On Thu, Oct 8, 2009 at 6:15 AM, harshal jadhav <jadhav.harshal at gmail.com> wrote:
>> Hi Everybody,
>> I am Harshal Jadhav, student at San Jose State University.
>> I am using Python for my Master's project and i am a beginner.
>> I am using python language for GNU Radio. For this i have a sampled signal.
>> The signal is a sine wave. I have to trap each sample of this sine wave in
>> an array.
>> Is it possible to capture the samples of the sine wave in an array in
> Python has list, tuples and dictionaries.. choose the most suitable datatype :)
None of the above is suitable for signal processing in Python, for (1)
speed of loading data into memory, (2) operating on it and (3) storing
it efficiently in memory (since you tend to have a lot of it).
I would use the 'array' type in the stdlib or better still, the array
type in the NumPy package. The NumPy array has a much richer set of
operators you can apply efficiently to a signal sample stream.
Years ago I used it on a contract for on-the-fly 2-D image processing
from a batch currency scanner (counterfeit detection) and it was able to
do pretty complicated calculations and keep up.
More information about the BangPypers