On 10 July 2017 at 10:34, Jerome Kieffer wrote:
> On Sun, 9 Jul 2017 23:35:58 +0200
> Mikhail V wrote:
>
>> disclaimer: I am not a past contributor to numpy and I don't know
>> much about github, and what pull request means. So I just put the
>> examples here.
e often
the rectangle objects are defined as (coordinate, size) tuple and in many
cases the destination box is itself the origin (i.e. it's coordinate is 0,0,..)
But of course there can be various variants for the output format
and order.
Regards,
Mikhail V
_
;ll need some time to think out more examples and use cases.
Mikhail
>
> On Jun 29, 2017 20:17, "Mikhail V" wrote:
>>
>> Hello all
>>
>> I often need to copy one array into another array, given an offset.
>> This is how the "blit" function
Hello all
I often need to copy one array into another array, given an offset.
This is how the "blit" function can be understood, i.e. in
every graphical lib there is such a function.
The common definition is like:
blit ( dest, src, offset ):
where dest is destination array, src is source array and
On 7 June 2017 at 00:05, Chris Barker wrote:
> On Mon, Jun 5, 2017 at 3:59 PM, Mikhail V wrote:
>> s= "012 abc"
>> B = bytes(s.encode()) # convert to bytes
>> k = len(s)
>> arr = np.zeros(k,"u1") # init empty array length k
>> arr[0:2] =
On 5 June 2017 at 19:40, Chris Barker wrote:
>
>
>> > Python3 assumes 4-byte strings but in reality most of the time
>> > we deal with 1-byte strings, so there is huge waste of resources
>> > when dealing with 4-bytes. For many serious projects it is just not
>> > needed.
>>
>> That's quite enough
On 4 June 2017 at 23:59, Thomas Jollans wrote:
>
>
> For what it's worth, in Python 3 (which you probably should want to be
> using), everything behaves as you'd expect:
>
import numpy as np
s = b'012 abc'
a = np.fromstring(s, 'u1')
a
> array([48, 49, 50, 32, 97, 98, 99], dtype
Array and string interoperability
Just sharing my thoughts and few ideas about simplification of casting
strings to arrays.
In examples assume Numpy is in the namespace (from numpy import *)
Initialize array from a string currently looks like:
s= "012 abc"
A= fromstring(s,"u1")
print A ->
[48 49