title: AttributeError: exp when using numpy on data loaded using scipy.io.loadmat
body: <p>I get the following output from the unit test below:</p>
  
  <pre><code>[[array([[-1.57079633]])]]
  [[array([[0.+1.57079633j]])]]
  &lt;module 'numpy' from '/usr/local/lib/python2.7/dist-packages/numpy/__init__.pyc'&gt;
  E
  ======================================================================
  ERROR: test_TestWECTrain_BasicEnv_SetupAndStepping (__main__.Test_exp)
  ----------------------------------------------------------------------
  Traceback (most recent call last):
    File "Test_exp.py", line 34, in test_TestWECTrain_BasicEnv_SetupAndStepping
      expsigmatphase = np.exp(tmp)
  AttributeError: exp
  
  ----------------------------------------------------------------------
  Ran 1 test in 0.001s
  
  FAILED (errors=1)
  </code></pre>
  
  <p>Here is the unit test</p>
  
  <pre><code>import unittest
  import os
  import scipy.io as sio
  import numpy as np
  from pprint import pprint
  
  class Test_exp (unittest.TestCase):
  
      def test_exp (self):
  
          data_file = "test_buoysimoptions.mat"
  
          buoysimoptions = sio.loadmat (data_file)
  
          t = 0.0
          phase = buoysimoptions['SeaParameters']['phase']
          sigma = buoysimoptions['SeaParameters']['sigma']
  
          sigmatminusphase = sigma * t - phase; print (sigmatminusphase)
          tmp = -1.0j * sigmatminusphase; print (tmp)
          print (np)
          tmp = np.asarray(tmp)
          expsigmatphase = np.exp(tmp)
  
  
  if __name__ == '__main__':
      unittest.main()
  </code></pre>
  
  <p>The input file (2.9kB) can be downloaded here: <a href="https://www.dropbox.com/s/psq1gq8xpjivrim/test_buoysimoptions.mat?dl=0" rel="nofollow noreferrer">https://www.dropbox.com/s/psq1gq8xpjivrim/test_buoysimoptions.mat?dl=0</a></p>
  
  <p>Why do I get the error <code>AttributeError: exp</code>?</p>
  
  <p>Note this is identical to <a href="https://stackoverflow.com/questions/24467970/attributeerror-exp-while-using-numpy-exp-on-an-apparently-ordinary-array">&quot;AttributeError: exp&quot; while using numpy.exp() on an apparently ordinary array</a> but this question was never answered and provides no minimal example like I do.</p>
  
  <p>This is in Python 2.7, In Python 3.5 I get:</p>
  
  <pre><code>[[array([[-1.57079633]])]]
  [[array([[0.+1.57079633j]])]]
  E
  ======================================================================
  ERROR: test_exp (__main__.Test_exp)
  ----------------------------------------------------------------------
  Traceback (most recent call last):
    File "Test_exp.py", line 25, in test_exp
      expsigmatphase = np.exp(tmp)
  AttributeError: 'numpy.ndarray' object has no attribute 'exp'
  
  ----------------------------------------------------------------------
  Ran 1 test in 0.002s
  
  FAILED (errors=1)
  </code></pre>
  
  <p>Edit: some further information on the loaded data </p>
  
  <p>I expected <code>buoysimoptions['SeaParameters']['phase']</code> to just be a numpy array, but it seems not, see below, which ultimately causes the error</p>
  
  <pre><code>&gt;&gt;&gt; phase = buoysimoptions['SeaParameters']['phase']
  &gt;&gt;&gt; phase
  array([[array([[1.57079633]])]], dtype=object)
  &gt;&gt;&gt; phase = buoysimoptions['SeaParameters']['phase'][0]
  &gt;&gt;&gt; phase
  array([array([[1.57079633]])], dtype=object)
  &gt;&gt;&gt; phase = buoysimoptions['SeaParameters']['phase'][0][0]
  &gt;&gt;&gt; phase
  array([[1.57079633]])
  </code></pre>
  
  <p>do I need to index [0][0] always to just get the actual array? What is the right thing to do here? If I use the last one, the exp error goes away.</p>