Question: I've setup a [Zalenium](https://opensource.zalando.com/zalenium/) in Kubernates (in the cloud not local minikube or anything else), It works perfectly and everything is OK.
When I run a test case with recordVideo capability on, Zalenium records the test and stores a video inside a container, I can access the video via Zalenium's dashboard, but I want to download the video programmatically (not by visiting the dashboard) by RemoteWebDriver or something else, the video's name is dynamically generated and it consists of sessionId (known) and a timestamp which makes it impossible to generate by client to construct a URL to the video file, 
I wonder if anyone has already experience with Zalenium and knows how to download the video ?

Answer: 
You can use the np.eye function and multiply. 

```
>>> mat = np.array([[1,1],[2,2],[3,3]])
>>> np.multiply(np.eye(2),mat[:,np.newaxis])
array([[[ 1.,  0.],
        [ 0.,  1.]],

       [[ 2.,  0.],
        [ 0.,  2.]],

       [[ 3.,  0.],
        [ 0.,  3.]]])

```
```
In [219]: m = mat.shape[-1]                                                                    
In [220]: mat2 = np.zeros(mat.shape+(m,),mat.dtype)                                            
In [221]: idx = np.arange(m)                                                                   
In [222]: mat2[...,idx,idx] = mat[...,idx]                                                     
In [223]: mat2                                                                                 
Out[223]: 
array([[[1, 0],
        [0, 1]],

       [[2, 0],
        [0, 2]],

       [[3, 0],
        [0, 3]]])

```

testing on a larger `mat`:

```
In [224]: mat = np.array([[1,2,3],[2,3,4],[3,4,5]])                                            
In [225]: m = mat.shape[-1]                                                                    
In [226]: mat2 = np.zeros(mat.shape+(m,),mat.dtype)                                            
In [227]: idx = np.arange(m)                                                                   
In [228]: mat2[...,idx,idx] = mat[...,idx]                                                     
In [230]: mat2                                                                                 
Out[230]: 
array([[[1, 0, 0],
        [0, 2, 0],
        [0, 0, 3]],

       [[2, 0, 0],
        [0, 3, 0],
        [0, 0, 4]],

       [[3, 0, 0],
        [0, 4, 0],
        [0, 0, 5]]])

```