In [1]:
#from __future__ import print_function
from os.path import split as pathsplit, join as pathjoin, splitext, isfile, basename
import sys
sys.path.append('../../GBT/filterbank_tools/')
%matplotlib inline  
#sys.path.append('/Users/urebbapr/research/ptf/trunk/util')


import numpy as np
import pylab as pl
from file_utils import *

from filterbank import Filterbank as FB, db
from skimage.feature import hog, daisy

In [8]:
f_fillist = 'blc03_guppi_files.txt'
fillist = read_list_from_file(f_fillist)

data = np.array([])
images = []

for i, url_fil in enumerate(fillist):
    f_fil = basename(url_fil)
    f_filnpy = f_fil + "_rebin.npy"
    
    # check file exists
    if isfile(f_fil):
        fbin = FB(f_fil)
        f, obs = fbin.grab_data()
        obs = db(obs)
        reduced_obs = np.load(f_filnpy)
        hog_feats, hog_image = hog(reduced_obs, orientations=3, pixels_per_cell=(21,16), cells_per_block=(3,3),visualise=True)
        print reduced_obs.shape, hog_feats.shape
        pl.figure(figsize=(10,6))
        pl.subplot(1, 3, 1)
        pl.imshow(obs,aspect='auto')
        pl.subplot(1, 3, 2)
        pl.imshow(reduced_obs,aspect='auto')
        pl.subplot(1, 3, 3)
        pl.imshow(hog_image,aspect='auto')
        
        if i == 10:
            break
#         if data.shape[0] == 0:
#             data = np.array(hog_feats)
#         else:
#             data = np.vstack( (data, hog_feats) )

#         images.append(reduced_obs)
            
                
        #pl.figure(figsize=(16,2))

# images = np.array(images)
# print data.shape


(164, 64) (216,)
(164, 64) (216,)
(164, 64) (216,)
(164, 64) (216,)
(164, 64) (216,)
(164, 64) (216,)
(277, 64) (405,)
(277, 64) (405,)
(277, 64) (405,)
(277, 64) (405,)
(277, 64) (405,)

In [ ]:
#np.save('blc03.hog216.npy',data)
#np.save('blc03.images.reduced.npy',images)

In [ ]: