In [1]:
%matplotlib inline

In [2]:
import pandas as pd
import matplotlib.pyplot as plt

In [3]:
array_vals = pd.read_csv("data-readonly/transportable_array/data_tohoku_norm_transpose.csv", header=None)

In [4]:
array_vals.dtypes


Out[4]:
0      float64
1      float64
2      float64
3      float64
4      float64
5      float64
6      float64
7      float64
8      float64
9      float64
10     float64
11     float64
12     float64
13     float64
14     float64
15     float64
16     float64
17     float64
18     float64
19     float64
20     float64
21     float64
22     float64
23     float64
24     float64
25     float64
26     float64
27     float64
28     float64
29     float64
        ...   
408    float64
409    float64
410    float64
411    float64
412    float64
413    float64
414    float64
415    float64
416    float64
417    float64
418    float64
419    float64
420    float64
421    float64
422    float64
423    float64
424    float64
425    float64
426    float64
427    float64
428    float64
429    float64
430    float64
431    float64
432    float64
433    float64
434    float64
435    float64
436    float64
437    float64
Length: 438, dtype: object

In [5]:
v = pd.date_range("2:46PM", "6:46PM", freq="1s")
v -= v[0]
array_vals["time"] = v
array_vals.set_index("time", inplace=True)

In [6]:
array_vals.shape


Out[6]:
(14401, 438)

In [7]:
date_range = pd.date_range("2:46PM", "6:46PM", freq="1s")

In [8]:
date_range - date_range[0]


Out[8]:
TimedeltaIndex(['00:00:00', '00:00:01', '00:00:02', '00:00:03', '00:00:04',
                '00:00:05', '00:00:06', '00:00:07', '00:00:08', '00:00:09',
                ...
                '03:59:51', '03:59:52', '03:59:53', '03:59:54', '03:59:55',
                '03:59:56', '03:59:57', '03:59:58', '03:59:59', '04:00:00'],
               dtype='timedelta64[ns]', length=14401, freq=None)

In [9]:
array_vals.loc["03:30:12":"03:45:15"][0]


Out[9]:
time
03:30:12   -0.001730
03:30:13   -0.001783
03:30:14   -0.001641
03:30:15   -0.001368
03:30:16   -0.001052
03:30:17   -0.000783
03:30:18   -0.000639
03:30:19   -0.000671
03:30:20   -0.000905
03:30:21   -0.001334
03:30:22   -0.001934
03:30:23   -0.002668
03:30:24   -0.003493
03:30:25   -0.004363
03:30:26   -0.005235
03:30:27   -0.006062
03:30:28   -0.006794
03:30:29   -0.007381
03:30:30   -0.007774
03:30:31   -0.007926
03:30:32   -0.007808
03:30:33   -0.007403
03:30:34   -0.006721
03:30:35   -0.005796
03:30:36   -0.004684
03:30:37   -0.003461
03:30:38   -0.002210
03:30:39   -0.001014
03:30:40    0.000055
03:30:41    0.000947
              ...   
03:44:46    0.000598
03:44:47   -0.000605
03:44:48   -0.001836
03:44:49   -0.003081
03:44:50   -0.004321
03:44:51   -0.005534
03:44:52   -0.006686
03:44:53   -0.007745
03:44:54   -0.008680
03:44:55   -0.009469
03:44:56   -0.010105
03:44:57   -0.010597
03:44:58   -0.010972
03:44:59   -0.011263
03:45:00   -0.011510
03:45:01   -0.011744
03:45:02   -0.011984
03:45:03   -0.012235
03:45:04   -0.012483
03:45:05   -0.012706
03:45:06   -0.012873
03:45:07   -0.012959
03:45:08   -0.012946
03:45:09   -0.012833
03:45:10   -0.012635
03:45:11   -0.012386
03:45:12   -0.012127
03:45:13   -0.011904
03:45:14   -0.011756
03:45:15   -0.011705
Name: 0, Length: 904, dtype: float64

In [10]:
array_vals[0]


Out[10]:
time
00:00:00   -0.000255
00:00:01   -0.000238
00:00:02   -0.000220
00:00:03   -0.000203
00:00:04   -0.000186
00:00:05   -0.000169
00:00:06   -0.000152
00:00:07   -0.000135
00:00:08   -0.000119
00:00:09   -0.000105
00:00:10   -0.000092
00:00:11   -0.000083
00:00:12   -0.000074
00:00:13   -0.000067
00:00:14   -0.000060
00:00:15   -0.000054
00:00:16   -0.000049
00:00:17   -0.000044
00:00:18   -0.000040
00:00:19   -0.000038
00:00:20   -0.000036
00:00:21   -0.000033
00:00:22   -0.000030
00:00:23   -0.000027
00:00:24   -0.000025
00:00:25   -0.000025
00:00:26   -0.000025
00:00:27   -0.000025
00:00:28   -0.000024
00:00:29   -0.000021
              ...   
03:59:31   -0.005350
03:59:32   -0.004568
03:59:33   -0.003665
03:59:34   -0.002656
03:59:35   -0.001557
03:59:36   -0.000378
03:59:37    0.000875
03:59:38    0.002206
03:59:39    0.003623
03:59:40    0.005135
03:59:41    0.006740
03:59:42    0.008432
03:59:43    0.010187
03:59:44    0.011971
03:59:45    0.013744
03:59:46    0.015457
03:59:47    0.017061
03:59:48    0.018507
03:59:49    0.019748
03:59:50    0.020738
03:59:51    0.021431
03:59:52    0.021788
03:59:53    0.021776
03:59:54    0.021372
03:59:55    0.020574
03:59:56    0.019400
03:59:57    0.017890
03:59:58    0.016107
03:59:59    0.014128
04:00:00    0.012042
Name: 0, Length: 14401, dtype: float64

In [11]:
plt.plot(array_vals[0])


Out[11]:
[<matplotlib.lines.Line2D at 0x7f6941ad50b8>]

In [12]:
locations = pd.read_csv("/srv/nbgrader/data/transportable_array/location.txt",
                        delimiter="\t", names =["longitude", "latitude", "a", "b"])
del locations["a"], locations["b"]

In [13]:
locations.iloc[0]


Out[13]:
longitude   -98.683
latitude     27.065
Name: 0, dtype: float64

We'll get to proper maps next week.


In [14]:
plt.scatter(locations["longitude"], locations["latitude"])


Out[14]:
<matplotlib.collections.PathCollection at 0x7f6941a35160>

In [15]:
import ipywidgets

In [16]:
array_vals.max().max()


Out[16]:
1.0

In [17]:
@ipywidgets.interact(station = (0, 437, 1))
def make_plot(station = 0):
    plt.subplot(211)
    plt.plot(array_vals[station])
    plt.xlim(0, 14000)
    plt.ylim(-1.0, 1.0)
    plt.subplot(212)
    plt.scatter(locations.iloc[station]["longitude"], locations.iloc[station]["latitude"])
    plt.xlim(-180, 180)
    plt.ylim(-90, 90)



In [18]:
from IPython.display import Audio

In [19]:
normed = (array_vals[0] - array_vals[0].min())/(array_vals[0].max() - array_vals[0].min()) * 2 - 1
Audio(normed, rate=44100/8)


Out[19]: