def __init__(self, f_file_name, sp_file_name):
        #self.variant_param_spaces = variant_param_spaces
        #self.device_id = device_id
        #self.names_of_backends = names_of_backends

        f = open(f_file_name, "rb")

        print "...Reading in HTK feature file..."
        
        #=== Read Feature File ==
        try:
            nSamples = struct.unpack('>i', f.read(4))[0]
            sampPeriod = struct.unpack('>i', f.read(4))[0]
            sampSize = struct.unpack('>h', f.read(2))[0]
            sampKind = struct.unpack('>h', f.read(2))[0]

            print "INFO: total number of frames read: ", nSamples
            self.total_num_frames = nSamples
                
            D = sampSize/4 #dimension of feature vector
            l = []
            count = 0
            while count < (nSamples * D):
                bFloat = f.read(4)
                fl = struct.unpack('>f', bFloat)[0]
                l.append(fl)
                count = count + 1
        finally:
            f.close()

        #=== Prune to Speech Only ==
        print "...Reading in speech/nonspeech file..."
        pruned_list = []
        num_speech_frames = nSamples            

        if sp_file_name:
            sp = open(sp_file_name, "r")
                        
            l_start = []
            l_end = []
            num_speech_frames = 0
            for line in sp:
                s = line.split(' ')
                st = math.floor(100 * float(s[2]) + 0.5)
                en = math.floor(100 * float(s[3].replace('\n','')) + 0.5)
                st1 = int(st)
                en1 = int(en)
                l_start.append(st1*19)
                l_end.append(en1*19)
                num_speech_frames = num_speech_frames + (en1 - st1 + 1)

            print "INFO: total number of speech frames: ", num_speech_frames

            total = 0
            for start in l_start:
                end = l_end[l_start.index(start)]
                total += (end/19 - start/19 + 1)
                x = 0
                index = start
                while x < (end-start+19):
                    pruned_list.append(l[index])
                    index += 1
                    x += 1
        else: #no speech file, take in all features
            pruned_list = l

        floatArray = np.array(pruned_list, dtype = np.float32)
        self.X = floatArray.reshape(num_speech_frames, D)
        
        self.N = self.X.shape[0]
        self.D = self.X.shape[1]
dataset/ETHPy150Open hcook/gmm/examples/cluster.py/Diarizer.__init__/original