Expand a multidimentional array with another array of different shape - python

I have the following arrays:
A = np.array([
[[[0, 1, 2, 3],
[3, 0, 1, 2],
[2, 3, 0, 1],
[1, 3, 2, 1],
[1, 2, 3, 0]]],
[[[9, 8, 7, 6],
[5, 4, 3, 2],
[0, 9, 8, 3],
[1, 9, 2, 3],
[1, 0, -1, 2]]],
[[[0, 7, 1, 2],
[1, 2, 1, 0],
[0, 2, 0, 7],
[-1, 3, 0, 1],
[1, 0, 1, 0]]]
])
A.shape
(3,1,5,4)
B = np.array([
[[[1, 0],
[-1, 2],
[9, 1],
[8, 2],
[7, 0]]],
[[[9, 6],
[5, 2],
[0, 3],
[1, 9],
[1, 0]]],
[[[0, 7],
[1, 0],
[0, 7],
[-1, 1],
[0, 0]]]
])
B.shape
(3,1,5,2)
Then I want to expand array A with B in the last dimension of A. Such that, the result X is:
X = np.array([
[[[0, 1, 2, 3, 1, 0],
[3, 0, 1, 2,-1, 2],
[2, 3, 0, 1, 9, 1],
[1, 3, 2, 1, 8, 2],
[1, 2, 3, 0, 7, 0]]],
[[[9, 8, 7, 6, 9, 6],
[5, 4, 3, 2, 5, 2],
[0, 9, 8, 3, 0, 3],
[1, 9, 2, 3, 1, 9],
[1, 0,-1, 2, 1, 0]]],
[[[0, 7, 1, 2, 0, 7],
[1, 2, 1, 0, 1, 0],
[0, 2, 0, 7, 0, 7],
[-1,3, 0, 1,-1, 1],
[1, 0, 1, 0, 0, 0]]]
])
X.shape
(3,1,5,6)
``

You have to concatenate the 2 arrays together along the axis you need:
C = np.concatenate((A, B), axis=3)

Related

Problem with element-wise operations in numpy

This is my first Question here, let me know if I could've done anything better.
I'm trying to do a element-wise operation between two arrays, but the broadcasting wont work like I want it to.
I have an array of shape (N,4).
square_list = np.array([[1,2,255,255], [255,255,4,4], [255,255,8,8], [255,255,16,16], [255,255,8,4], [255,1,8,8], [1,255,8,8]], dtype='B')
I also have an array of shape (4,).
square = np.array([1, 8, 8, 1], dtype='B')
What I am able to do is compare my square against each element in the square_list and it is being broadcast into shape (N,4) as expected.
Now I want to compare my square in each possible rotation against the square_list. I've written a function which returns an array of shape (4,4), which contains each possible rotation.
square.rotations
array([[1, 8, 8, 1],
[1, 1, 8, 8],
[8, 1, 1, 8],
[8, 8, 1, 1]], dtype=uint8)
I know how to do this using a loop. I'd prefer however to use an element-wise operator that returns my desired shape.
What I get:
rotations & square_list
ValueError: operands could not be broadcast together with shapes (4,4) (6,4)
What I'd like to get:
rotations & square_list
array([[[1, 0, 8, 1],
[1, 8, 0, 0],
[1, 8, 8, 0],
[1, 8, 0, 0],
[1, 8, 8, 0],
[1, 0, 8, 0]],
[[1, 0, 8, 8],
[1, 1, 0, 0],
[1, 1, 8, 8],
[1, 1, 0, 0],
[1, 1, 8, 0],
[1, 1, 8, 8]],
[[0, 0, 1, 8],
[8, 1, 0, 0],
[8, 1, 0, 8],
[8, 1, 0, 0],
[8, 1, 0, 0],
[8, 1, 0, 8],
[0, 1, 0, 8]],
[[0, 0, 1, 1],
[8, 8, 0, 0],
[8, 8, 0, 0],
[8, 8, 0, 0],
[8, 8, 0, 0],
[8, 0, 0, 0],
[0, 8, 0, 0]]], dtype=uint8)
This is just to visualize what I want, I don't particularly care about the order of the axis'. A shape of either (4, N, 4) or (N, 4, 4) would be great.
I have the feeling that this can be achieved easily by just reshaping one of the input arrays but I couldn't figure it out.
Thanks in advance!
Add an extra dimension to rotations:
square_list & rotations[:,None]
output:
array([[[1, 0, 8, 1],
[1, 8, 0, 0],
[1, 8, 8, 0],
[1, 8, 0, 0],
[1, 8, 8, 0],
[1, 0, 8, 0],
[1, 8, 8, 0]],
[[1, 0, 8, 8],
[1, 1, 0, 0],
[1, 1, 8, 8],
[1, 1, 0, 0],
[1, 1, 8, 0],
[1, 1, 8, 8],
[1, 1, 8, 8]],
[[0, 0, 1, 8],
[8, 1, 0, 0],
[8, 1, 0, 8],
[8, 1, 0, 0],
[8, 1, 0, 0],
[8, 1, 0, 8],
[0, 1, 0, 8]],
[[0, 0, 1, 1],
[8, 8, 0, 0],
[8, 8, 0, 0],
[8, 8, 0, 0],
[8, 8, 0, 0],
[8, 0, 0, 0],
[0, 8, 0, 0]]], dtype=uint8)

numpy equivalent of tf.math.segment_sum

What is the equivalent of tf.math.segment_sum in numpy?
So basically I like to rewrite the exact same code in tf to np where I am using segment sum to group together certain elements using a segment_ids array and sum those segments. What is the equivalent code in numpy? I have an array and the segment_ids array and I like to perform segment_sum but in numpy.
You can create something pretty close to tf.math.segment_sum with the method numpy.add.at, which is the at method of the add ufunc:
def segment_sum(data, segment_ids):
data = np.asarray(data)
s = np.zeros((np.max(segment_ids)+1,) + data.shape[1:], dtype=data.dtype)
np.add.at(s, segment_ids, data)
return s
For example,
In [53]: c = np.array([[1, 2, 3, 4], [4, 3, 2, 1], [5, 6, 7, 8]])
In [54]: ids = [0, 0, 1]
In [55]: segment_sum(c, ids)
Out[55]:
array([[5, 5, 5, 5],
[5, 6, 7, 8]])
In [56]: x = [10, 20, 20, 30, 10, 0, 1, 2]
In [57]: xids = [1, 1, 0, 0, 2, 2, 2, 3]
In [58]: segment_sum(x, xids)
Out[58]: array([50, 30, 11, 2])
In [59]: w = np.arange(72).reshape(6, 2, 6) % 5
In [60]: w
Out[60]:
array([[[0, 1, 2, 3, 4, 0],
[1, 2, 3, 4, 0, 1]],
[[2, 3, 4, 0, 1, 2],
[3, 4, 0, 1, 2, 3]],
[[4, 0, 1, 2, 3, 4],
[0, 1, 2, 3, 4, 0]],
[[1, 2, 3, 4, 0, 1],
[2, 3, 4, 0, 1, 2]],
[[3, 4, 0, 1, 2, 3],
[4, 0, 1, 2, 3, 4]],
[[0, 1, 2, 3, 4, 0],
[1, 2, 3, 4, 0, 1]]])
In [61]: wids = [0, 0, 1, 2, 2, 2]
In [62]: segment_sum(w, wids)
Out[62]:
array([[[2, 4, 6, 3, 5, 2],
[4, 6, 3, 5, 2, 4]],
[[4, 0, 1, 2, 3, 4],
[0, 1, 2, 3, 4, 0]],
[[4, 7, 5, 8, 6, 4],
[7, 5, 8, 6, 4, 7]]])

Finding spots in a numpy matrix

I have the following Matrix made of 0s and 1s which I want to identify its spots(elements with the value 1 and connected to eachothers).
M = np.array([[1,1,1,0,0,0,0,0,0,0,0],
[1,1,1,0,0,0,0,0,0,1,1],
[1,1,1,0,0,0,0,0,0,1,1],
[1,1,1,0,0,1,1,1,0,0,0],
[0,0,0,0,0,1,1,1,0,0,0],
[1,1,1,0,1,1,1,1,0,0,0],
[1,1,1,0,0,1,1,1,0,0,0],
[1,1,1,0,0,1,1,1,0,0,0]])
In the matrix there are four spots.
an example of my output should seem the following
spot_0 = array[(0,0),(0,1), (0,2), (1,0),(1,1), (1,2), (2,0),(2,1), (2,2), (3,0),(3,1), (3,2)]
Nbr_0 = 12
Top_Left = (0, 0)
and that is the same process for the other 3 spots
Does anyone know how can I identify each spot with the number of its elements and top_left element, using numpy functions ?
Thanks
You can use a connected component labeling to find the spots. Then, you can use np.max so to find the number of component and np.argwhere so to find the locations of each component. Here is an example:
# OpenCV provides a similar function
from skimage.measure import label
components = label(M)
# array([[1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0],
# [1, 1, 1, 0, 0, 0, 0, 0, 0, 2, 2],
# [1, 1, 1, 0, 0, 0, 0, 0, 0, 2, 2],
# [1, 1, 1, 0, 0, 3, 3, 3, 0, 0, 0],
# [0, 0, 0, 0, 0, 3, 3, 3, 0, 0, 0],
# [4, 4, 4, 0, 3, 3, 3, 3, 0, 0, 0],
# [4, 4, 4, 0, 0, 3, 3, 3, 0, 0, 0],
# [4, 4, 4, 0, 0, 3, 3, 3, 0, 0, 0]])
for i in range(1, np.max(components)+1):
spot_i = np.argwhere(components == i)
Nbr_i = len(spot_i)
Top_Left_i = spot_i[0]
Note that Top_Left only make sense for a rectangular area. If they are not rectangular this point needs to be carefully defined.
Note also that this method is only efficient with few component. If there are many component, then it is better to replace the current loop by an iteration over the components array (in this case the output structure is stored in a list l and l[components[i,j]] is updated with the information found for all item location (i,j) of components). This last algorithm will be slow unless Numba/Cython are used to speed the process up.
You could use skimage.measure.label or other tools (for instance, OpenCV or igraph) to create labels for connected components:
#from #Jérôme's answer
from skimage.measure import label
components = label(M)
# array([[1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0],
# [1, 1, 1, 0, 0, 0, 0, 0, 0, 2, 2],
# [1, 1, 1, 0, 0, 0, 0, 0, 0, 2, 2],
# [1, 1, 1, 0, 0, 3, 3, 3, 0, 0, 0],
# [0, 0, 0, 0, 0, 3, 3, 3, 0, 0, 0],
# [4, 4, 4, 0, 3, 3, 3, 3, 0, 0, 0],
# [4, 4, 4, 0, 0, 3, 3, 3, 0, 0, 0],
# [4, 4, 4, 0, 0, 3, 3, 3, 0, 0, 0]])
In the later part you could create a one-dimensional view of image, sort values of pixels and find dividing points of sorted label values:
components_ravel = components.ravel()
c = np.arange(1, np.max(components_ravel) + 1)
argidx = np.argsort(components_ravel)
div_points = np.searchsorted(components_ravel, c, sorter=argidx)
# Sorted label values are:
# [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
# 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1
# 2, 2, 2, 2
# 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3
# 4, 4, 4, 4, 4, 4, 4, 4, 4
# So you find indices that divides these groups:
# [47, 59, 63, 79]
After that you could split array of indices that sorts your one-dimensional view of image at these points and convert them into two-dimensional ones:
spots = []
for n in np.split(argidx, div_points)[1:]: #in case there are no zeros, cancel `[1:]`
x, y = np.unravel_index(n, components.shape)
spots.append(np.transpose([x, y]))
It creates a list of spot coordinates of each group:
[array([[1, 0], [1, 2], [0, 2], [0, 1], [1, 1], [0, 0], [2, 2], [2, 1], [2, 0], [3, 2], [3, 1], [3, 0]]),
array([[2, 10], [1, 9], [2, 9], [1, 10]]),
array([[6, 5], [7, 5], [7, 6], [7, 7], [6, 7], [6, 6], [3, 5], [4, 6], [3, 6], [4, 5], [3, 7], [5, 7], [5, 6], [4, 7], [5, 5], [5, 4]]),
array([[5, 0], [5, 1], [5, 2], [6, 2], [7, 0], [6, 0], [6, 1], [7, 1], [7, 2]])]
Note that an order of pixels of each group is mixed. This is because np.argsort uses a sort which is not stable. You could fix it like so:
argidx = np.argsort(components_ravel, kind='stable')
In this case you'll get:
[array([[0, 0], [0, 1], [0, 2], [1, 0], [1, 1], [1, 2], [2, 0], [2, 1], [2, 2], [3, 0], [3, 1], [3, 2]]),
array([[1, 9], [1, 10], [2, 9], [2, 10]]),
array([[3, 5], [3, 6], [3, 7], [4, 5], [4, 6], [4, 7], [5, 4], [5, 5], [5, 6], [5, 7], [6, 5], [6, 6], [6, 7], [7, 5], [7, 6], [7, 7]]),
array([[5, 0], [5, 1], [5, 2], [6, 0], [6, 1], [6, 2], [7, 0], [7, 1], [7, 2]])]

Find all k combination length of n elements

Hey im trying to find all k combination length of n elements with recursion without using any module
For example n = 4 so [0,1,2,3] and k=3 so the all the combination length 3 are
>>>[0,0,0],[0,0,1],[0,0,2],[0,0,3],[0,0,4],[0,1,0],[0,1,1],[0,1,2]....
I tried to think on that like a tree but i didn't mange to go from here [0,0,4] for example to here [0,1,0] all i got was [0,0,0],[0,0,1],[0,0,2],[0,0,3],[0,0,4]
We can achieve the bare minimum by using simple recursion.
def combination(n, k):
if not k:
return [[]]
res = []
nums = list(range(n + 1))
for comb in combination(n, k - 1):
for num in nums:
comb_copy = comb.copy()
comb_copy.append(num)
res.append(comb_copy)
return res
Let's take a look at how this code works. First, as with any recursion problem, we establish the base case, which is when k == 0. In this case, we would return an empty nested list.
If k != 0, then we need to perform recursion. The gist of this problem is that we need to append some numbers to the result returned by combination(n, k - 1). For example, let's say we want to obtain the result for combination(2, 2). The result returned by combination(2, 1) would be
>>> combination(2, 1)
[[0], [1], [2]]
Given this information, how can we get combination(2, 2)? For some intuition, here is the result we want:
>>> combination(2, 2)
[[0, 0], [0, 1], [0, 2], [1, 0], [1, 1], [1, 2], [2, 0], [2, 1], [2, 2]]
Observe that all we need to do is to append the values 0, 1, and 2 to each element of combination(3, 1). In other words, take the first element, [0]. We append 0, 1, and 2 to this list, which results in [0, 0], [0, 1], [0, 2]. These are the first three elements of combination(3, 2).
Back to the code, we first call combination(n, k - 1), and append num to each list in the nested list returned by that function call. Finally, when the appending is over, we return res.
One fine detail here is that we create a copy of the list instead of appending to it directly. We do this in order to prevent modifying the original comb.
Here is the function in action with n = 4, k = 3:
>>> combination(4, 3)
[[0, 0, 0], [0, 0, 1], [0, 0, 2], [0, 0, 3], [0, 0, 4], [0, 1, 0], [0, 1, 1], [0, 1, 2], [0, 1, 3], [0, 1, 4], [0, 2, 0], [0, 2, 1], [0, 2, 2], [0, 2, 3], [0, 2, 4], [0, 3, 0], [0, 3, 1], [0, 3, 2], [0, 3, 3], [0, 3, 4], [0, 4, 0], [0, 4, 1], [0, 4, 2], [0, 4, 3], [0, 4, 4], [1, 0, 0], [1, 0, 1], [1, 0, 2], [1, 0, 3], [1, 0, 4], [1, 1, 0], [1, 1, 1], [1, 1, 2], [1, 1, 3], [1, 1, 4], [1, 2, 0], [1, 2, 1], [1, 2, 2], [1, 2, 3], [1, 2, 4], [1, 3, 0], [1, 3, 1], [1, 3, 2], [1, 3, 3], [1, 3, 4], [1, 4, 0], [1, 4, 1], [1, 4, 2], [1, 4, 3], [1, 4, 4], [2, 0, 0], [2, 0, 1], [2, 0, 2], [2, 0, 3], [2, 0, 4], [2, 1, 0], [2, 1, 1], [2, 1, 2], [2, 1, 3], [2, 1, 4], [2, 2, 0], [2, 2, 1], [2, 2, 2], [2, 2, 3], [2, 2, 4], [2, 3, 0], [2, 3, 1], [2, 3, 2], [2, 3, 3], [2, 3, 4], [2, 4, 0], [2, 4, 1], [2, 4, 2], [2, 4, 3], [2, 4, 4], [3, 0, 0], [3, 0, 1], [3, 0, 2], [3, 0, 3], [3, 0, 4], [3, 1, 0], [3, 1, 1], [3, 1, 2], [3, 1, 3], [3, 1, 4], [3, 2, 0], [3, 2, 1], [3, 2, 2], [3, 2, 3], [3, 2, 4], [3, 3, 0], [3, 3, 1], [3, 3, 2], [3, 3, 3], [3, 3, 4], [3, 4, 0], [3, 4, 1], [3, 4, 2], [3, 4, 3], [3, 4, 4], [4, 0, 0], [4, 0, 1], [4, 0, 2], [4, 0, 3], [4, 0, 4], [4, 1, 0], [4, 1, 1], [4, 1, 2], [4, 1, 3], [4, 1, 4], [4, 2, 0], [4, 2, 1], [4, 2, 2], [4, 2, 3], [4, 2, 4], [4, 3, 0], [4, 3, 1], [4, 3, 2], [4, 3, 3], [4, 3, 4], [4, 4, 0], [4, 4, 1], [4, 4, 2], [4, 4, 3], [4, 4, 4]]
Note that we can get fancier here by implementing things like dynamic programming, but is an optimization detail you might want to consider later.
You can use itertools.combinations
import itertools
itertools.combinations('ABCD', 2)

Create a 5 x 5 matrix using Nested list comprehensions [duplicate]

This question already has answers here:
How to define a two-dimensional array?
(30 answers)
Closed 3 years ago.
Matrices can be represented as a list of lists in Python.
For example a 5 x 5 matrix with values 0 to 4 in each row can be written as:
matrix = [[0, 1, 2, 3, 4],
[0, 1, 2, 3, 4],
[0, 1, 2, 3, 4],
[0, 1, 2, 3, 4],
[0, 1, 2, 3, 4]]
How to recreate this matrix by using nested listed comprehensions?
Here is my code:
num = [[num1,num2,num3,num4,num5] for num1 in range(5) for num2 in range(5)for num3 in range(5)for num4 in range(5)for num5 in range(5)]
And it produce the following output:
[[0, 0, 0, 0, 0],
[0, 0, 0, 0, 1],
[0, 0, 0, 0, 2],
[0, 0, 0, 0, 3],
[0, 0, 0, 0, 4],
[0, 0, 0, 1, 0],
[0, 0, 0, 1, 1],
[0, 0, 0, 1, 2],
[0, 0, 0, 1, 3],
[0, 0, 0, 1, 4],
[0, 0, 0, 2, 0],
[0, 0, 0, 2, 1],
[0, 0, 0, 2, 2],
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[1, 2, 3, 4, 3],
[1, 2, 3, 4, 4],
[1, 2, 4, 0, 0],
[1, 2, 4, 0, 1],
[1, 2, 4, 0, 2],
[1, 2, 4, 0, 3],
[1, 2, 4, 0, 4],
[1, 2, 4, 1, 0],
[1, 2, 4, 1, 1],
[1, 2, 4, 1, 2],
[1, 2, 4, 1, 3],
[1, 2, 4, 1, 4],
[1, 2, 4, 2, 0],
[1, 2, 4, 2, 1],
[1, 2, 4, 2, 2],
[1, 2, 4, 2, 3],
[1, 2, 4, 2, 4],
[1, 2, 4, 3, 0],
[1, 2, 4, 3, 1],
[1, 2, 4, 3, 2],
[1, 2, 4, 3, 3],
[1, 2, 4, 3, 4],
[1, 2, 4, 4, 0],
[1, 2, 4, 4, 1],
[1, 2, 4, 4, 2],
[1, 2, 4, 4, 3],
[1, 2, 4, 4, 4]]
Please someone help me to solve this.
Try this,
>>> [[j for j in range(5)] for i in range(5)]
Output:
[[0, 1, 2, 3, 4],
[0, 1, 2, 3, 4],
[0, 1, 2, 3, 4],
[0, 1, 2, 3, 4],
[0, 1, 2, 3, 4]]

Categories

Resources