This tutorial will show you how to programmatically download the SETI code challenge data to your local file space and start to analyze it.
Please see the Step_1_Get_Data.ipynb notebook on information about all of the data available for this code challenge.
This tutorial will use the basic
data set, but will work, of course, with any of the data sets.
In [1]:
#The ibmseti package contains some useful tools to faciliate reading the data.
#The `ibmseti` package version 1.0.5 works on Python 2.7.
# !pip install --user ibmseti
#A development version runs on Python 3.5.
# !pip install --user ibmseti==2.0.0.dev5
# If running on DSX, YOU WILL NEED TO RESTART YOUR SPARK KERNEL to use a newly installed Python Package.
# Click Kernel -> Restart above!
In [ ]:
import ibmseti
import os
In [ ]:
import zipfile
In [21]:
!ls my_data_folder/basic4
In [ ]:
zz = zipfile.ZipFile(mydatafolder + '/' + 'basic4.zip')
In [ ]:
basic4list = zz.namelist()
In [24]:
firstfile = basic4list[0]
print firstfile
In [ ]:
import ibmseti
aca = ibmseti.compamp.SimCompamp(zz.open(firstfile, 'rb').read())
In [27]:
# This data file is classified as a 'squiggle'
aca.header()
Out[27]:
The goal is to take each simulation data file and
There are multiple ways to improve your model's ability to classify signals. You can
Here we just show how to view the data as a spectrogram
In [28]:
%matplotlib inline
import numpy as np
import matplotlib.pyplot as plt
In [42]:
## ibmseti.compamp.SimCompamp has a method to calculate the spectrogram for you (without any signal processing applied to the time-series data)
spectrogram = aca.get_spectrogram()
In [43]:
fig, ax = plt.subplots(figsize=(10, 5))
ax.imshow(np.log(spectrogram), aspect = 0.5*float(spectrogram.shape[1]) / spectrogram.shape[0])
Out[43]:
In [44]:
complex_data = aca.complex_data()
In [45]:
#complex valued time-series
complex_data
Out[45]:
In [46]:
complex_data = complex_data.reshape(32, 6144)
In [47]:
complex_data
Out[47]:
In [48]:
#Apply a Hanning Window
complex_data = complex_data * np.hanning(complex_data.shape[1])
In [49]:
complex_data
Out[49]:
In [50]:
# Build Spectogram & Plot
cpfft = np.fft.fftshift( np.fft.fft(complex_data), 1)
spectrogram = np.abs(cpfft)**2
fig, ax = plt.subplots(figsize=(10, 5))
ax.imshow(np.log(spectrogram), aspect = 0.5*float(spectrogram.shape[1]) / spectrogram.shape[0])
Out[50]:
Maybe try a different windowing? Or different method for calculating the spectrogram (see Welch's periodigram? Ask a SETI Researcher?)
In [ ]: