On 07/28/2010 11:32 PM, Christopher Barker wrote:
> Paul Probert wrote:
>> I'm trying to write numpy arrays as binary data, to support a legacy
>> file format. So I open a file and write to it:
>>
>> fp = open('somefile','w')
>> ...
&g
iff != 0:
print 'ahhah! mismatch=',diff
...
I'm observing that every once in while I get 'ahhah! mismatch=1', that
is, the file position is advanced by one more byte than x.nbytes would give.
I'm using 1.4.1 on windows, python 2.5.
An
array of booleans the same size and shape as data, so you can
write your new array as
data[ (data > 100.) & (data < 300.) ]
Note we don't use a "where" function. In numpy, "where" is a completely
different thing than in IDL.
If you really wanted to