<h3 dir="auto">Proposed new feature or change:</h3>
<div class="highlight highlight-source-python notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="@jit(nopython=True)
def slidingWindow(a,window):
	'''
	Make an ndarray with a sliding window of the first dimension(axis = 0)
	Parameters
	----------
	a : array_like
		Array to add sliding window to
	window : int
		Size of sliding window

	Returns
	-------
	Array that is a view of the original array with a added dimension of size w.
	'''
	if window &lt; 1:
		raise Exception('Arg: window must be at least 1.')

	if window &gt; a.shape[0]:
		raise Exception('Arg: window cannot bigger than a.shape[0]')

	shape = (a.shape[0] - window + 1,) + a.shape[1:] + (window,)
	strides = a.strides + (a.strides[0],)

	return np.lib.stride_tricks.as_strided(a, shape=shape, strides=strides)

def TSPctlInterMean(m,d,p1,p2):
	'''
	TSMean for interval:[p1,p2] in past d dates 
	p1/p2: in np.array([0.1,0.25,0.5,0.75,0.9])
	'''

	if m.dtype == 'bool':
		raise Exception('Cannot be Bool!!!')

	size = m.size
	if size == 1:
		raise Exception('Cannot be Scalar!!!')

	rowNum,colNum = m.shape[0],m.shape[1]
	if rowNum &lt; d:
		raise Exception('RowNum Cannot Lesser than d!!!')

	m_ = m.copy()

	m_3d = slidingWindow(m_,d)	 #3 dimension (i,j,k:rowNum-d+1,column,d), m_3d[:,0,:] is 2-DimensionSlideWindow for 1th column
        
        PctMat1 = np.nanpercentile(m_3d,p1 * 100,axis = 2).reshape(rowNum-d+1,colNum,1)  #percentile p for each row 
        PctMat2 = np.nanpercentile(m_3d,p2 * 100,axis = 2).reshape(rowNum-d+1,colNum,1)  #percentile p for each row 
	indLogic1 = m_3d &gt;= PctMat1
	indLogic2 = m_3d &lt;= PctMat2
	indLogic = np.logical_and(indLogic1,indLogic2)
	#return indLogic
	m_3d_slice = m_3d[indLogic]	#cannot keep dimension 
	return bt.nanmean(m_3d_slice,axis=2)"><pre class="notranslate"><span class="pl-en">@<span class="pl-en">jit</span>(<span class="pl-s1">nopython</span><span class="pl-c1">=</span><span class="pl-c1">True</span>)</span>
<span class="pl-k">def</span> <span class="pl-en">slidingWindow</span>(<span class="pl-s1">a</span>,<span class="pl-s1">window</span>):
	<span class="pl-s">'''</span>
<span class="pl-s">	Make an ndarray with a sliding window of the first dimension(axis = 0)</span>
<span class="pl-s">	Parameters</span>
<span class="pl-s">	----------</span>
<span class="pl-s">	a : array_like</span>
<span class="pl-s">		Array to add sliding window to</span>
<span class="pl-s">	window : int</span>
<span class="pl-s">		Size of sliding window</span>
<span class="pl-s"></span>
<span class="pl-s">	Returns</span>
<span class="pl-s">	-------</span>
<span class="pl-s">	Array that is a view of the original array with a added dimension of size w.</span>
<span class="pl-s">	'''</span>
	<span class="pl-k">if</span> <span class="pl-s1">window</span> <span class="pl-c1">&lt;</span> <span class="pl-c1">1</span>:
		<span class="pl-k">raise</span> <span class="pl-v">Exception</span>(<span class="pl-s">'Arg: window must be at least 1.'</span>)

	<span class="pl-k">if</span> <span class="pl-s1">window</span> <span class="pl-c1">&gt;</span> <span class="pl-s1">a</span>.<span class="pl-s1">shape</span>[<span class="pl-c1">0</span>]:
		<span class="pl-k">raise</span> <span class="pl-v">Exception</span>(<span class="pl-s">'Arg: window cannot bigger than a.shape[0]'</span>)

	<span class="pl-s1">shape</span> <span class="pl-c1">=</span> (<span class="pl-s1">a</span>.<span class="pl-s1">shape</span>[<span class="pl-c1">0</span>] <span class="pl-c1">-</span> <span class="pl-s1">window</span> <span class="pl-c1">+</span> <span class="pl-c1">1</span>,) <span class="pl-c1">+</span> <span class="pl-s1">a</span>.<span class="pl-s1">shape</span>[<span class="pl-c1">1</span>:] <span class="pl-c1">+</span> (<span class="pl-s1">window</span>,)
	<span class="pl-s1">strides</span> <span class="pl-c1">=</span> <span class="pl-s1">a</span>.<span class="pl-s1">strides</span> <span class="pl-c1">+</span> (<span class="pl-s1">a</span>.<span class="pl-s1">strides</span>[<span class="pl-c1">0</span>],)

	<span class="pl-k">return</span> <span class="pl-s1">np</span>.<span class="pl-s1">lib</span>.<span class="pl-s1">stride_tricks</span>.<span class="pl-en">as_strided</span>(<span class="pl-s1">a</span>, <span class="pl-s1">shape</span><span class="pl-c1">=</span><span class="pl-s1">shape</span>, <span class="pl-s1">strides</span><span class="pl-c1">=</span><span class="pl-s1">strides</span>)

<span class="pl-k">def</span> <span class="pl-v">TSPctlInterMean</span>(<span class="pl-s1">m</span>,<span class="pl-s1">d</span>,<span class="pl-s1">p1</span>,<span class="pl-s1">p2</span>):
	<span class="pl-s">'''</span>
<span class="pl-s">	TSMean for interval:[p1,p2] in past d dates </span>
<span class="pl-s">	p1/p2: in np.array([0.1,0.25,0.5,0.75,0.9])</span>
<span class="pl-s">	'''</span>

	<span class="pl-k">if</span> <span class="pl-s1">m</span>.<span class="pl-s1">dtype</span> <span class="pl-c1">==</span> <span class="pl-s">'bool'</span>:
		<span class="pl-k">raise</span> <span class="pl-v">Exception</span>(<span class="pl-s">'Cannot be Bool!!!'</span>)

	<span class="pl-s1">size</span> <span class="pl-c1">=</span> <span class="pl-s1">m</span>.<span class="pl-s1">size</span>
	<span class="pl-k">if</span> <span class="pl-s1">size</span> <span class="pl-c1">==</span> <span class="pl-c1">1</span>:
		<span class="pl-k">raise</span> <span class="pl-v">Exception</span>(<span class="pl-s">'Cannot be Scalar!!!'</span>)

	<span class="pl-s1">rowNum</span>,<span class="pl-s1">colNum</span> <span class="pl-c1">=</span> <span class="pl-s1">m</span>.<span class="pl-s1">shape</span>[<span class="pl-c1">0</span>],<span class="pl-s1">m</span>.<span class="pl-s1">shape</span>[<span class="pl-c1">1</span>]
	<span class="pl-k">if</span> <span class="pl-s1">rowNum</span> <span class="pl-c1">&lt;</span> <span class="pl-s1">d</span>:
		<span class="pl-k">raise</span> <span class="pl-v">Exception</span>(<span class="pl-s">'RowNum Cannot Lesser than d!!!'</span>)

	<span class="pl-s1">m_</span> <span class="pl-c1">=</span> <span class="pl-s1">m</span>.<span class="pl-en">copy</span>()

	<span class="pl-s1">m_3d</span> <span class="pl-c1">=</span> <span class="pl-en">slidingWindow</span>(<span class="pl-s1">m_</span>,<span class="pl-s1">d</span>)	 <span class="pl-c">#3 dimension (i,j,k:rowNum-d+1,column,d), m_3d[:,0,:] is 2-DimensionSlideWindow for 1th column</span>
        
        <span class="pl-v">PctMat1</span> <span class="pl-c1">=</span> <span class="pl-s1">np</span>.<span class="pl-en">nanpercentile</span>(<span class="pl-s1">m_3d</span>,<span class="pl-s1">p1</span> <span class="pl-c1">*</span> <span class="pl-c1">100</span>,<span class="pl-s1">axis</span> <span class="pl-c1">=</span> <span class="pl-c1">2</span>).<span class="pl-en">reshape</span>(<span class="pl-s1">rowNum</span><span class="pl-c1">-</span><span class="pl-s1">d</span><span class="pl-c1">+</span><span class="pl-c1">1</span>,<span class="pl-s1">colNum</span>,<span class="pl-c1">1</span>)  <span class="pl-c">#percentile p for each row </span>
        <span class="pl-v">PctMat2</span> <span class="pl-c1">=</span> <span class="pl-s1">np</span>.<span class="pl-en">nanpercentile</span>(<span class="pl-s1">m_3d</span>,<span class="pl-s1">p2</span> <span class="pl-c1">*</span> <span class="pl-c1">100</span>,<span class="pl-s1">axis</span> <span class="pl-c1">=</span> <span class="pl-c1">2</span>).<span class="pl-en">reshape</span>(<span class="pl-s1">rowNum</span><span class="pl-c1">-</span><span class="pl-s1">d</span><span class="pl-c1">+</span><span class="pl-c1">1</span>,<span class="pl-s1">colNum</span>,<span class="pl-c1">1</span>)  <span class="pl-c">#percentile p for each row </span>
	<span class="pl-s1">indLogic1</span> <span class="pl-c1">=</span> <span class="pl-s1">m_3d</span> <span class="pl-c1">&gt;=</span> <span class="pl-v">PctMat1</span>
	<span class="pl-s1">indLogic2</span> <span class="pl-c1">=</span> <span class="pl-s1">m_3d</span> <span class="pl-c1">&lt;=</span> <span class="pl-v">PctMat2</span>
	<span class="pl-s1">indLogic</span> <span class="pl-c1">=</span> <span class="pl-s1">np</span>.<span class="pl-en">logical_and</span>(<span class="pl-s1">indLogic1</span>,<span class="pl-s1">indLogic2</span>)
	<span class="pl-c">#return indLogic</span>
	<span class="pl-s1">m_3d_slice</span> <span class="pl-c1">=</span> <span class="pl-s1">m_3d</span>[<span class="pl-s1">indLogic</span>]	<span class="pl-c">#cannot keep dimension </span>
	<span class="pl-k">return</span> <span class="pl-s1">bt</span>.<span class="pl-en">nanmean</span>(<span class="pl-s1">m_3d_slice</span>,<span class="pl-s1">axis</span><span class="pl-c1">=</span><span class="pl-c1">2</span>)</pre></div>
<p dir="auto"><code class="notranslate">m1 = np.random.randn(300,3000)</code><br>
<code class="notranslate">TSPctlInterMean(m1 ,21,0.2,0.7)</code>  will raise Error!!!<br>
<code class="notranslate">m_3d_slice = m_3d[indLogic]</code> will be a vector<br>
how can I keep the same dimension with m_3d<br>
Thanks!!!</p>
<p dir="auto">-Operating System: Raspbian Stretch (9)<br>
-How Python was installed: Python 3.5.3 is default Python3 on Stretch<br>
-How numpy was installed: pip installed under virtual environment (version 1.17.3)<br>
-Python2.7 is also installed by default</p>
<p dir="auto">I want to use OpenVINO's dldt library for inference on raspberry pi 3. I've run into issues before but following some instructions <a href="https://github.com/opencv/dldt/blob/2019/inference-engine/README.md#build-for-raspbian-stretch-os">here</a>, I built the most recent version of the library using cmake for native compilation under raspbian stretch (It took hours).</p>
<p dir="auto">I first noticed the error when running their model optimizer python code:</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="$ python3 &lt;dldt_dir&gt;/model-optimizer/mo.py --input_model [input model] --data_type [data type] --output_dir [output_dir]
Traceback (most recent call last):
  File &quot;/home/pi/.virtualenvs/openvino/lib/python3.5/site-packages/numpy/core/__init__.py&quot;, line 17, in &lt;module&gt;
    from . import multiarray
  File &quot;/home/pi/.virtualenvs/openvino/lib/python3.5/site-packages/numpy/core/multiarray.py&quot;, line 14, in &lt;module&gt;
    from . import overrides
  File &quot;/home/pi/.virtualenvs/openvino/lib/python3.5/site-packages/numpy/core/overrides.py&quot;, line 7, in &lt;module&gt;
    from numpy.core._multiarray_umath import (
ImportError: libf77blas.so.3: cannot open shared object file: No such file or directory

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File &quot;&lt;stdin&gt;&quot;, line 1, in &lt;module&gt;
  File &quot;/home/pi/.virtualenvs/openvino/lib/python3.5/site-packages/numpy/__init__.py&quot;, line 142, in &lt;module&gt;
    from . import core
  File &quot;/home/pi/.virtualenvs/openvino/lib/python3.5/site-packages/numpy/core/__init__.py&quot;, line 47, in &lt;module&gt;
    raise ImportError(msg)
ImportError: 

IMPORTANT: PLEASE READ THIS FOR ADVICE ON HOW TO SOLVE THIS ISSUE!

Importing the numpy c-extensions failed.
- Try uninstalling and reinstalling numpy.
- If you have already done that, then:
  1. Check that you expected to use Python3.5 from &quot;/home/pi/.virtualenvs/openvino/bin/python&quot;,
     and that you have no directories in your PATH or PYTHONPATH that can
     interfere with the Python and numpy version &quot;1.17.3&quot; you're trying to use.
  2. If (1) looks fine, you can open a new issue at
     https://github.com/numpy/numpy/issues.  Please include details on:
     - how you installed Python
     - how you installed numpy
     - your operating system
     - whether or not you have multiple versions of Python installed
     - if you built from source, your compiler versions and ideally a build log

- If you're working with a numpy git repository, try `git clean -xdf`
  (removes all files not under version control) and rebuild numpy.

Note: this error has many possible causes, so please don't comment on
an existing issue about this - open a new one instead.

Original error was: libf77blas.so.3: cannot open shared object file: No such file or directory"><pre class="notranslate"><code class="notranslate">$ python3 &lt;dldt_dir&gt;/model-optimizer/mo.py --input_model [input model] --data_type [data type] --output_dir [output_dir]
Traceback (most recent call last):
  File "/home/pi/.virtualenvs/openvino/lib/python3.5/site-packages/numpy/core/__init__.py", line 17, in &lt;module&gt;
    from . import multiarray
  File "/home/pi/.virtualenvs/openvino/lib/python3.5/site-packages/numpy/core/multiarray.py", line 14, in &lt;module&gt;
    from . import overrides
  File "/home/pi/.virtualenvs/openvino/lib/python3.5/site-packages/numpy/core/overrides.py", line 7, in &lt;module&gt;
    from numpy.core._multiarray_umath import (
ImportError: libf77blas.so.3: cannot open shared object file: No such file or directory

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "&lt;stdin&gt;", line 1, in &lt;module&gt;
  File "/home/pi/.virtualenvs/openvino/lib/python3.5/site-packages/numpy/__init__.py", line 142, in &lt;module&gt;
    from . import core
  File "/home/pi/.virtualenvs/openvino/lib/python3.5/site-packages/numpy/core/__init__.py", line 47, in &lt;module&gt;
    raise ImportError(msg)
ImportError: 

IMPORTANT: PLEASE READ THIS FOR ADVICE ON HOW TO SOLVE THIS ISSUE!

Importing the numpy c-extensions failed.
- Try uninstalling and reinstalling numpy.
- If you have already done that, then:
  1. Check that you expected to use Python3.5 from "/home/pi/.virtualenvs/openvino/bin/python",
     and that you have no directories in your PATH or PYTHONPATH that can
     interfere with the Python and numpy version "1.17.3" you're trying to use.
  2. If (1) looks fine, you can open a new issue at
     https://github.com/numpy/numpy/issues.  Please include details on:
     - how you installed Python
     - how you installed numpy
     - your operating system
     - whether or not you have multiple versions of Python installed
     - if you built from source, your compiler versions and ideally a build log

- If you're working with a numpy git repository, try `git clean -xdf`
  (removes all files not under version control) and rebuild numpy.

Note: this error has many possible causes, so please don't comment on
an existing issue about this - open a new one instead.

Original error was: libf77blas.so.3: cannot open shared object file: No such file or directory
</code></pre></div>
<p dir="auto">However I quickly found out that this problem persists when importing numpy from Python3</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="&gt;&gt;&gt; import numpy as np
[...]
Importing the numpy c-extensions failed.
[...]
Original error was: libf77blas.so.3: cannot open shared object file: No such file or directory"><pre class="notranslate"><code class="notranslate">&gt;&gt;&gt; import numpy as np
[...]
Importing the numpy c-extensions failed.
[...]
Original error was: libf77blas.so.3: cannot open shared object file: No such file or directory
</code></pre></div>
<p dir="auto">I've tried uninstalling and reinstalling numpy. I've made sure that numpy worked in Python3 before installing the dldt library.<br>
Please help. You're my only hope.</p>