In [12]:
import matplotlib.pyplot as plt
import sys

sys.path.insert(0,'../mi_instrument')
from mi.instrument.kut.ek60.ooicore import zplsc_b
# from mi.instrument.kut.ek60.ooicore.zplsc_b import parse_echogram_file


../mi_instrument/mi/instrument/kut/ek60/ooicore/zplsc_echogram.py:16: UserWarning: 
This call to matplotlib.use() has no effect because the backend has already
been chosen; matplotlib.use() must be called *before* pylab, matplotlib.pyplot,
or matplotlib.backends is imported for the first time.

The backend was *originally* set to 'module://ipykernel.pylab.backend_inline' by the following code:
  File "/Users/wu-jung/miniconda3/envs/py27/lib/python2.7/runpy.py", line 174, in _run_module_as_main
    "__main__", fname, loader, pkg_name)
  File "/Users/wu-jung/miniconda3/envs/py27/lib/python2.7/runpy.py", line 72, in _run_code
    exec code in run_globals
  File "/Users/wu-jung/miniconda3/envs/py27/lib/python2.7/site-packages/ipykernel_launcher.py", line 16, in <module>
    app.launch_new_instance()
  File "/Users/wu-jung/miniconda3/envs/py27/lib/python2.7/site-packages/traitlets/config/application.py", line 658, in launch_instance
    app.start()
  File "/Users/wu-jung/miniconda3/envs/py27/lib/python2.7/site-packages/ipykernel/kernelapp.py", line 478, in start
    self.io_loop.start()
  File "/Users/wu-jung/miniconda3/envs/py27/lib/python2.7/site-packages/zmq/eventloop/ioloop.py", line 177, in start
    super(ZMQIOLoop, self).start()
  File "/Users/wu-jung/miniconda3/envs/py27/lib/python2.7/site-packages/tornado/ioloop.py", line 888, in start
    handler_func(fd_obj, events)
  File "/Users/wu-jung/miniconda3/envs/py27/lib/python2.7/site-packages/tornado/stack_context.py", line 277, in null_wrapper
    return fn(*args, **kwargs)
  File "/Users/wu-jung/miniconda3/envs/py27/lib/python2.7/site-packages/zmq/eventloop/zmqstream.py", line 440, in _handle_events
    self._handle_recv()
  File "/Users/wu-jung/miniconda3/envs/py27/lib/python2.7/site-packages/zmq/eventloop/zmqstream.py", line 472, in _handle_recv
    self._run_callback(callback, msg)
  File "/Users/wu-jung/miniconda3/envs/py27/lib/python2.7/site-packages/zmq/eventloop/zmqstream.py", line 414, in _run_callback
    callback(*args, **kwargs)
  File "/Users/wu-jung/miniconda3/envs/py27/lib/python2.7/site-packages/tornado/stack_context.py", line 277, in null_wrapper
    return fn(*args, **kwargs)
  File "/Users/wu-jung/miniconda3/envs/py27/lib/python2.7/site-packages/ipykernel/kernelbase.py", line 283, in dispatcher
    return self.dispatch_shell(stream, msg)
  File "/Users/wu-jung/miniconda3/envs/py27/lib/python2.7/site-packages/ipykernel/kernelbase.py", line 233, in dispatch_shell
    handler(stream, idents, msg)
  File "/Users/wu-jung/miniconda3/envs/py27/lib/python2.7/site-packages/ipykernel/kernelbase.py", line 399, in execute_request
    user_expressions, allow_stdin)
  File "/Users/wu-jung/miniconda3/envs/py27/lib/python2.7/site-packages/ipykernel/ipkernel.py", line 208, in do_execute
    res = shell.run_cell(code, store_history=store_history, silent=silent)
  File "/Users/wu-jung/miniconda3/envs/py27/lib/python2.7/site-packages/ipykernel/zmqshell.py", line 537, in run_cell
    return super(ZMQInteractiveShell, self).run_cell(*args, **kwargs)
  File "/Users/wu-jung/miniconda3/envs/py27/lib/python2.7/site-packages/IPython/core/interactiveshell.py", line 2728, in run_cell
    self.events.trigger('post_run_cell')
  File "/Users/wu-jung/miniconda3/envs/py27/lib/python2.7/site-packages/IPython/core/events.py", line 74, in trigger
    func(*args, **kwargs)
  File "/Users/wu-jung/miniconda3/envs/py27/lib/python2.7/site-packages/ipykernel/pylab/backend_inline.py", line 160, in configure_once
    activate_matplotlib(backend)
  File "/Users/wu-jung/miniconda3/envs/py27/lib/python2.7/site-packages/IPython/core/pylabtools.py", line 309, in activate_matplotlib
    matplotlib.pyplot.switch_backend(backend)
  File "/Users/wu-jung/miniconda3/envs/py27/lib/python2.7/site-packages/matplotlib/pyplot.py", line 232, in switch_backend
    matplotlib.use(newbackend, warn=False, force=True)
  File "/Users/wu-jung/miniconda3/envs/py27/lib/python2.7/site-packages/matplotlib/__init__.py", line 1305, in use
    reload(sys.modules['matplotlib.backends'])
  File "/Users/wu-jung/miniconda3/envs/py27/lib/python2.7/site-packages/matplotlib/backends/__init__.py", line 14, in <module>
    line for line in traceback.format_stack()


  matplotlib.use("Agg")

In [15]:
fname = '/Users/wu-jung/code_git/echopype/OOI-D20150901-T000000.raw'

In [16]:
particle_data, data_times, power_data, freq, bin_size, config_header, config_transducer = \
            zplsc_b.parse_echogram_file(fname)


18:16:34  unpacking file: /Users/wu-jung/code_git/echopype/OOI-D20150901-T000000.raw

In [17]:
power_data


Out[17]:
{1: array([[  -3.84518784,   12.07647678,   12.07647678, ...,   12.14703068,
           12.15878967,   12.15878967],
        [   1.6344988 ,   18.1676306 ,   18.1676306 , ...,   18.22642552,
           18.22642552,   18.22642552],
        [   1.61098084,   18.14411263,   18.14411263, ...,   18.21466653,
           18.21466653,   18.21466653],
        ...,
        [-134.35815353, -116.47273856, -123.71627283, ..., -129.14892353,
         -131.46544342, -123.37526229],
        [-141.40178507, -135.98089335, -124.79809937, ..., -129.48993407,
         -124.88041226, -123.52812908],
        [-142.96572997, -123.38702127, -126.65601888, ..., -122.63444628,
         -125.42132554, -126.15038256]]),
 2: array([[  -8.38415574,   11.6884303 ,   11.67667132, ...,   11.6884303 ,
           11.70018928,   11.71194827],
        [  -1.32876522,   19.55519073,   19.55519073, ...,   19.56694972,
           19.56694972,   19.56694972],
        [  -1.55218592,   19.42584191,   19.40232394, ...,   19.43760089,
           19.43760089,   19.43760089],
        ...,
        [-109.33503514,  -88.39228427,  -87.47508351, ...,  -97.91706148,
          -91.07333267,  -84.00618316],
        [-109.31151718,  -87.09879601,  -88.13358662, ...,  -89.81512136,
          -90.35603464,  -85.617164  ],
        [-108.35903945,  -89.69753152,  -83.37119802, ...,  -91.07333267,
          -91.40258423,  -90.23844479]]),
 3: array([[-168.0358843 , -134.61685119, -129.74863172, ..., -130.21899109,
         -142.93045302, -146.64629203],
        [-160.4395805 , -140.02598392, -140.10829681, ..., -140.02598392,
         -140.00246595, -140.07301986],
        [-160.34550863, -140.04950189, -140.09653783, ..., -140.06126087,
         -140.07301986, -140.07301986],
        ...,
        [-164.0143117 , -130.94804811, -147.3400721 , ..., -139.49682963,
         -130.23075008, -127.78488136],
        [-150.99711618, -131.86524888, -140.51986126, ..., -139.28516792,
         -131.24202272, -130.91277116],
        [-153.45474388, -136.92161209, -132.26505434, ..., -141.95445733,
         -136.15727812, -147.39886702]])}

In [19]:
particle_data


Out[19]:
(defaultdict(list,
             {'filepath': 'OOI-D20150901-T000000.png',
              'zplsc_absorption_coeff': [0.03744031, 0.009785269, 0.05268759],
              'zplsc_bandwidth': [3026.3916, 2425.1497, 3088.4004],
              'zplsc_channel': [1, 2, 3],
              'zplsc_frequency': [120000.0, 38000.0, 200000.0],
              'zplsc_pulse_length': [0.001024, 0.001024, 0.001024],
              'zplsc_sample_interval': [0.000256, 0.000256, 0.000256],
              'zplsc_sound_velocity': [1493.8888, 1493.8888, 1493.8888],
              'zplsc_temperature': [10.0, 10.0, 10.0],
              'zplsc_timestamp': '20150901000000',
              'zplsc_transducer_depth': [0.0, 0.0, 0.0],
              'zplsc_transmit_power': [250.0, 500.0, 150.0]}),
 3650054400.082346)

In [18]:
import matplotlib.pyplot as plt

In [20]:
plt.imshow(power_data[2],aspect='auto')
plt.colorbar()
plt.show()



In [21]:
plt.imshow(power_data[1],aspect='auto')
plt.colorbar()
plt.show()



In [22]:
plt.imshow(power_data[3],aspect='auto')
plt.colorbar()
plt.show()



In [ ]: