title: Size function in Matlab and Python
body: <p>I am attempting to translate this MATLAB code into Python. Here is the code:</p>
  
  <pre class="lang-matlab prettyprint-override"><code>function snr_est = estimate_snr(R,r_m,x)
  
           [L N]=size(R);           % L number of bands (channels)
                                    % N number of pixels (Lines x Columns) 
           [p N]=size(x);           % p number of endmembers (reduced dimension)
  
           P_y = sum(R(:).^2)/N;
           P_x = sum(x(:).^2)/N + r_m'*r_m;
           snr_est = 10*log10( (P_x - p/L*P_y)/(P_y- P_x) );
  
  return;
  </code></pre>
  
  <p>My question pertains to the size method. For the usage of size as is in the MATLAB code, MATLAB says that "it returns the number of rows and columns when <code>A</code> is a Matrix". I want to do the same thing in Python. I know that <code>a.shape</code> also returns the dimensions of the array. Can those then be accessed in the same way that the MATLAB code requires them in this function?</p>